mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
call nanoTime() only if we have flag set to dump timing
This commit is contained in:
@@ -63,12 +63,12 @@ public class CompressionUtil {
|
||||
public static final boolean DUMP_COMPRESSION_STATS = SystemProperties.getBooleanProperty("idea.dump.compression.stats", false);
|
||||
|
||||
public static int writeCompressedWithoutOriginalBufferLength(@NotNull DataOutput out, @NotNull byte[] bytes, int length) throws IOException {
|
||||
long started = System.nanoTime();
|
||||
long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;
|
||||
|
||||
final byte[] compressedOutputBuffer = spareBufferLocal.getBuffer(Snappy.maxCompressedLength(length));
|
||||
int compressedSize = Snappy.compress(bytes, 0, length, compressedOutputBuffer, 0);
|
||||
|
||||
final long time = System.nanoTime() - started;
|
||||
final long time = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
|
||||
mySizeAfterCompression.addAndGet(compressedSize);
|
||||
mySizeBeforeCompression.addAndGet(length);
|
||||
int requests = myCompressionRequests.incrementAndGet();
|
||||
@@ -92,11 +92,11 @@ public class CompressionUtil {
|
||||
in.readFully(bytes, 0, size);
|
||||
|
||||
int decompressedRequests = myDecompressionRequests.incrementAndGet();
|
||||
long started = System.nanoTime();
|
||||
long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;
|
||||
|
||||
byte[] decompressedResult = Snappy.uncompress(bytes, 0, size);
|
||||
|
||||
long doneTime = System.nanoTime() - started;
|
||||
long doneTime = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
|
||||
long decompressedSize = myDecompressedSize.addAndGet(size);
|
||||
long decompressedTime = myDecompressionTime.addAndGet(doneTime);
|
||||
if (DUMP_COMPRESSION_STATS && decompressedRequests % 1000 == 0) {
|
||||
|
||||
@@ -354,7 +354,7 @@ public class PersistentHashMapValueStorage {
|
||||
forceAppender(myPath);
|
||||
|
||||
checkCancellation();
|
||||
long startedTime = System.nanoTime();
|
||||
long startedTime = ourDumpChunkRemovalTime ? System.nanoTime() : 0;
|
||||
long chunk = tailChunkAddress;
|
||||
int chunkCount = 0;
|
||||
|
||||
@@ -426,7 +426,7 @@ public class PersistentHashMapValueStorage {
|
||||
|
||||
if (chunkCount > 1 && !myCompactionMode) {
|
||||
checkCancellation();
|
||||
long endCompactionTime = System.nanoTime();
|
||||
long endCompactionTime = ourDumpChunkRemovalTime ? System.nanoTime() : 0;
|
||||
long diff = endCompactionTime - startedTime;
|
||||
|
||||
myChunksRemovalTime += diff;
|
||||
|
||||
Reference in New Issue
Block a user