Skip to content

Commit

Permalink
Used System.nanoTime to calculate the time that snapshot creation t…
Browse files Browse the repository at this point in the history
…akes.

Signed-off-by: Ivan Malygin <ivan@swirldslabs.com>
  • Loading branch information
imalygin committed Sep 20, 2024
1 parent 3820588 commit 3b721f5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import com.hedera.hapi.block.stream.output.StateChanges;
import com.hedera.hapi.node.base.SemanticVersion;
import com.swirlds.base.time.Time;
import com.swirlds.common.constructable.ConstructableIgnored;
import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.io.streams.MerkleDataOutputStream;
Expand Down Expand Up @@ -1107,12 +1106,13 @@ public void computeHash() {
*/
@Override
public void createSnapshot(Path targetPath) {
Time time = platformContext.getTime();
final long start = time.nanoTime();
throwIfMutable();
throwIfDestroyed();
long start = System.nanoTime();
createSnapshot(this, targetPath);
snapshotMetrics.getWriteStateToDiskTimeMetric().update(TimeUnit.NANOSECONDS.toMillis(time.nanoTime() - start));
snapshotMetrics
.getWriteStateToDiskTimeMetric()
.update(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
}

static void createSnapshot(MerkleRoot merkleRoot, Path targetPath) {
Expand Down

0 comments on commit 3b721f5

Please sign in to comment.