who mined block

This commit is contained in:
Anton Evangelatov 2020-06-26 22:07:49 +02:00
parent 0487d60d0e
commit 0d908c18b4
2 changed files with 58 additions and 8 deletions

View File

@ -16,7 +16,7 @@
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 16, "id": 16,
"iteration": 1593188264284, "iteration": 1593201827692,
"links": [], "links": [],
"panels": [ "panels": [
{ {
@ -180,6 +180,12 @@
], ],
"type": "tag" "type": "tag"
}, },
{
"params": [
"miner"
],
"type": "tag"
},
{ {
"params": [ "params": [
"0" "0"
@ -187,7 +193,7 @@
"type": "fill" "type": "fill"
} }
], ],
"measurement": "diagnostics.miner.mine.counter", "measurement": "diagnostics.block.mine.counter",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"refId": "A", "refId": "A",
@ -207,6 +213,48 @@
] ]
], ],
"tags": [] "tags": []
},
{
"groupBy": [
{
"params": [
"$myinterval"
],
"type": "time"
},
{
"params": [
"run"
],
"type": "tag"
},
{
"params": [
"0"
],
"type": "fill"
}
],
"measurement": "diagnostics.block.mine.counter",
"orderByTime": "ASC",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"count"
],
"type": "field"
},
{
"params": [],
"type": "sum"
}
]
],
"tags": []
} }
], ],
"thresholds": [], "thresholds": [],
@ -918,5 +966,5 @@
"timezone": "", "timezone": "",
"title": "Project Oni - Baseline test", "title": "Project Oni - Baseline test",
"uid": "8em8RXWMz", "uid": "8em8RXWMz",
"version": 4 "version": 6
} }

View File

@ -37,6 +37,11 @@ func runMiner(t *TestEnvironment) error {
clients := t.IntParam("clients") clients := t.IntParam("clients")
miners := t.IntParam("miners") miners := t.IntParam("miners")
myActorAddr, err := miner.minerApi.ActorAddress(ctx)
if err != nil {
return err
}
// mine / stop mining // mine / stop mining
mine := true mine := true
done := make(chan struct{}) done := make(chan struct{})
@ -44,7 +49,6 @@ func runMiner(t *TestEnvironment) error {
defer close(done) defer close(done)
var i int var i int
for i = 0; mine; i++ { for i = 0; mine; i++ {
// synchronize all miners to mine the next block // synchronize all miners to mine the next block
t.RecordMessage("synchronizing all miners to mine next block [%d]", i) t.RecordMessage("synchronizing all miners to mine next block [%d]", i)
stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i)) stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i))
@ -53,10 +57,8 @@ func runMiner(t *TestEnvironment) error {
// add some random delay to encourage a different miner winning each round // add some random delay to encourage a different miner winning each round
time.Sleep(time.Duration(100 + rand.Intn(int(100*time.Millisecond)))) time.Sleep(time.Duration(100 + rand.Intn(int(100*time.Millisecond))))
err := miner.MineOne(ctx, func(bool) { err := miner.MineOne(ctx, func(mined bool) {
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
t.D().Counter("miner.mine").Inc(1)
// after a block is mined
}) })
if err != nil { if err != nil {
panic(err) panic(err)