Skip to content

Commit

Permalink
Log time for hash created every 10 blocks
Browse files Browse the repository at this point in the history
Signed-off-by: HenrikJannsen <[email protected]>
  • Loading branch information
HenrikJannsen committed Jun 29, 2024
1 parent fd17a29 commit 2478da1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void onParseBlockChainComplete() {
verifyCheckpoints();
}

log.info("ParseBlockChainComplete: Accumulated updateHashChain() calls for {} block took {} ms " +
log.info("ParseBlockChainComplete: Accumulated updateHashChain() calls for {} blocks took {} ms " +
"({} ms in average / block)",
numCalls,
accumulatedDuration,
Expand Down Expand Up @@ -370,12 +370,19 @@ private Optional<DaoStateBlock> createDaoStateBlock(Block block) {
UserThread.runAfter(() -> daoStateNetworkService.broadcastMyStateHash(myDaoStateHash), delayInSec);
}
long duration = System.currentTimeMillis() - ts;
// We don't want to spam the output. We log accumulated time after parsing is completed.
log.trace("updateHashChain for block {} took {} ms",
block.getHeight(),
duration);
accumulatedDuration += duration;
numCalls++;

if (numCalls % 10 == 0) {
log.info("Accumulated updateHashChain() calls for {} blocks took {} ms " +
"({} ms in average / block)",
numCalls,
accumulatedDuration,
(int) ((double) accumulatedDuration / (double) numCalls));
}
listeners.forEach(Listener::onDaoStateBlockCreated);
return Optional.of(daoStateBlock);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@Getter
@EqualsAndHashCode(callSuper = true)
public final class DaoStateHash extends StateHash {
// If we have built the hash by ourself opposed to that we got delivered the hash from seed nodes or resources
// If we have built the hash by ourselves opposed to that we got delivered the hash from seed nodes or resources
private final boolean isSelfCreated;

public DaoStateHash(int height, byte[] hash, boolean isSelfCreated) {
Expand Down

0 comments on commit 2478da1

Please sign in to comment.