src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/debug/BenchmarkCounters.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54328 37648a9c4a6a
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 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.
    36 import java.util.TreeMap;
    36 import java.util.TreeMap;
    37 import java.util.TreeSet;
    37 import java.util.TreeSet;
    38 import java.util.concurrent.ConcurrentHashMap;
    38 import java.util.concurrent.ConcurrentHashMap;
    39 import java.util.concurrent.atomic.AtomicLong;
    39 import java.util.concurrent.atomic.AtomicLong;
    40 
    40 
       
    41 import org.graalvm.compiler.core.GraalServiceThread;
    41 import org.graalvm.compiler.core.common.SuppressFBWarnings;
    42 import org.graalvm.compiler.core.common.SuppressFBWarnings;
    42 import org.graalvm.compiler.debug.CSVUtil;
    43 import org.graalvm.compiler.debug.CSVUtil;
    43 import org.graalvm.compiler.debug.GraalError;
    44 import org.graalvm.compiler.debug.GraalError;
    44 import org.graalvm.compiler.debug.TTY;
    45 import org.graalvm.compiler.debug.TTY;
    45 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
    46 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
   443         }
   444         }
   444         if (Options.GenericDynamicCounters.getValue(options)) {
   445         if (Options.GenericDynamicCounters.getValue(options)) {
   445             enabled = true;
   446             enabled = true;
   446         }
   447         }
   447         if (Options.TimedDynamicCounters.getValue(options) > 0) {
   448         if (Options.TimedDynamicCounters.getValue(options) > 0) {
   448             Thread thread = new Thread() {
   449             Thread thread = new GraalServiceThread(new Runnable() {
   449                 long lastTime = System.nanoTime();
   450                 long lastTime = System.nanoTime();
   450 
   451 
   451                 @Override
   452                 @Override
   452                 public void run() {
   453                 public void run() {
   453                     try (PrintStreamScope scope = getPrintStream(options)) {
   454                     try (PrintStreamScope scope = getPrintStream(options)) {
   460                             dump(options, scope.out, (time - lastTime) / 1000000000d, jvmciRuntime.collectCounters(), 10);
   461                             dump(options, scope.out, (time - lastTime) / 1000000000d, jvmciRuntime.collectCounters(), 10);
   461                             lastTime = time;
   462                             lastTime = time;
   462                         }
   463                         }
   463                     }
   464                     }
   464                 }
   465                 }
   465             };
   466             });
   466             thread.setDaemon(true);
   467             thread.setDaemon(true);
   467             thread.setPriority(Thread.MAX_PRIORITY);
   468             thread.setPriority(Thread.MAX_PRIORITY);
   468             thread.start();
   469             thread.start();
   469             enabled = true;
   470             enabled = true;
   470         }
   471         }