From 3b721f57615b2b05747cc4cac9a33d082414db85 Mon Sep 17 00:00:00 2001 From: Ivan Malygin Date: Fri, 20 Sep 2024 16:32:37 -0400 Subject: [PATCH] Used `System.nanoTime` to calculate the time that snapshot creation takes. Signed-off-by: Ivan Malygin --- .../java/com/swirlds/platform/state/MerkleStateRoot.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleStateRoot.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleStateRoot.java index b74ea8635bc..4fcf6109a45 100644 --- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleStateRoot.java +++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/MerkleStateRoot.java @@ -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; @@ -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) {