Skip to content

Commit

Permalink
Fix and reformat produced block timing log (hyperledger#6916)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 authored and matthew1001 committed Jun 7, 2024
1 parent 294c5f9 commit 0ecf60c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Duration end(final String step) {

@Override
public String toString() {
final var sb = new StringBuilder("Started at " + startedAt + ", ");
final var sb = new StringBuilder("started at " + startedAt + ", ");

var prevDuration = Duration.ZERO;
for (final var entry : timing.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected boolean mineBlock() throws InterruptedException {
}

private void logProducedBlock(final Block block, final BlockCreationTiming blockCreationTiming) {
String log =
LOG.info(
String.format(
"Produced #%,d / %d tx / %d om / %,d (%01.1f%%) gas / (%s) in %01.3fs",
block.getHeader().getNumber(),
Expand All @@ -177,13 +177,9 @@ private void logProducedBlock(final Block block, final BlockCreationTiming block
block.getHeader().getGasUsed(),
(block.getHeader().getGasUsed() * 100.0) / block.getHeader().getGasLimit(),
block.getHash(),
blockCreationTiming.end("log").getSeconds() / 1000.0);
blockCreationTiming.end("log").toMillis() / 1000.0));

if (LOG.isDebugEnabled()) {
log = log + ", timing [" + blockCreationTiming + "]";
}

LOG.info(log);
LOG.debug("Timing #{} / {}", block.getHeader().getNumber(), blockCreationTiming);
}

public void cancel() {
Expand Down

0 comments on commit 0ecf60c

Please sign in to comment.