src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationPrinter.java
changeset 58299 6df94ce3ab2f
parent 52910 583fd71c47d6
equal deleted inserted replaced
58298:0152ad7b38b8 58299:6df94ce3ab2f
     1 /*
     1 /*
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    97      * printed to {@link TTY}.
    97      * printed to {@link TTY}.
    98      */
    98      */
    99     public void finish(CompilationResult result) {
    99     public void finish(CompilationResult result) {
   100         if (id != null) {
   100         if (id != null) {
   101             final long stop = System.nanoTime();
   101             final long stop = System.nanoTime();
   102             final long duration = (stop - start) / 1000000;
   102             final long duration = (stop - start) / 1000;
   103             final int targetCodeSize = result != null ? result.getTargetCodeSize() : -1;
   103             final int targetCodeSize = result != null ? result.getTargetCodeSize() : -1;
   104             final int bytecodeSize = result != null ? result.getBytecodeSize() : 0;
   104             final int bytecodeSize = result != null ? result.getBytecodeSize() : 0;
   105             if (allocatedBytesBefore == -1) {
   105             if (allocatedBytesBefore == -1) {
   106                 TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dB", duration, bytecodeSize, targetCodeSize));
   106                 TTY.println(getMethodDescription() + String.format(" | %4dus %5dB bytecodes %5dB codesize", duration, bytecodeSize, targetCodeSize));
   107             } else {
   107             } else {
   108                 final long allocatedBytesAfter = getCurrentThreadAllocatedBytes();
   108                 final long allocatedBytesAfter = getCurrentThreadAllocatedBytes();
   109                 final long allocatedKBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024;
   109                 final long allocatedKBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024;
   110                 TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dB %5dkB", duration, bytecodeSize, targetCodeSize, allocatedKBytes));
   110                 TTY.println(getMethodDescription() + String.format(" | %4dus %5dB bytecodes %5dB codesize %5dkB allocated", duration, bytecodeSize, targetCodeSize, allocatedKBytes));
   111             }
   111             }
   112         }
   112         }
   113     }
   113     }
   114 }
   114 }