Skip to content

Commit af61317

Browse files
committed
Add helper for displaying profiler times.
1 parent 540ed4a commit af61317

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Common/src/main/java/net/darkhax/bookshelf/api/util/MathsHelper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,10 @@ public static VoxelShape rotateShape(Direction facing, double x1, double y1, dou
217217
throw new IllegalArgumentException("Can not rotate face in direction " + facing.name());
218218
}
219219
}
220+
221+
public static String profileNanoTime(long start, long stop) {
222+
223+
final double duration = stop - start;
224+
return duration < 10_000 ? "ns (<0.01ms)" : DECIMAL_2.format(duration / 1_000_000d) + "ms";
225+
}
220226
}

0 commit comments

Comments
 (0)