forked from tendermint/tendermint
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* draft * add round * 100 pins limitation * sort go imports * refine import * get rid of func (Mempool) LastBlockGasUsed() uint64
- Loading branch information
1 parent
aa8a44c
commit c4e6ab1
Showing
9 changed files
with
170 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,8 @@ | ||
package state | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/tendermint/tendermint/libs/log" | ||
) | ||
|
||
var IgnoreSmbCheck bool = false | ||
|
||
func SetIgnoreSmbCheck(check bool) { | ||
IgnoreSmbCheck = check | ||
} | ||
|
||
var lastDump int64 = time.Now().UnixNano() | ||
|
||
type Tracer struct { | ||
startTime int64 | ||
|
||
lastPin string | ||
lastTime int64 | ||
|
||
pins []string | ||
times []int64 | ||
} | ||
|
||
func (t *Tracer) pin(tag string) { | ||
if len(tag) == 0 { | ||
//panic("invalid tag") | ||
return | ||
} | ||
|
||
now := time.Now().UnixNano() | ||
|
||
if t.startTime == 0 { | ||
t.startTime = now | ||
} | ||
|
||
if len(t.lastPin) > 0 { | ||
t.pins = append(t.pins, t.lastPin) | ||
t.times = append(t.times, (now-t.lastTime)/1e6) | ||
} | ||
t.lastTime = now | ||
t.lastPin = tag | ||
} | ||
|
||
func (t *Tracer) dump(caller string, logger log.Logger) { | ||
t.pin("_") | ||
|
||
now := time.Now().UnixNano() | ||
info := fmt.Sprintf("Interval<%dms>, %s, elapsed<%dms>", | ||
(now-lastDump)/1e6, | ||
caller, | ||
(now-t.startTime)/1e6, | ||
) | ||
for i := range t.pins { | ||
info += fmt.Sprintf(", %s<%dms>", t.pins[i], t.times[i]) | ||
} | ||
logger.Info(info) | ||
lastDump = now | ||
} |
Oops, something went wrong.