Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/TimerImpl.java @ 21565:f5b549811bac
fixed eclipseformat issues
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 29 May 2015 00:35:10 +0200 |
parents | b1530a6cce8c |
children |
rev | line source |
---|---|
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19686
diff
changeset
|
23 package com.oracle.jvmci.debug.internal; |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19686
diff
changeset
|
25 import static com.oracle.jvmci.debug.DebugCloseable.*; |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
26 |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
27 import java.lang.management.*; |
12778
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
11630
diff
changeset
|
28 import java.util.concurrent.*; |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
29 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19686
diff
changeset
|
30 import com.oracle.jvmci.debug.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19686
diff
changeset
|
31 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
32 public final class TimerImpl extends AccumulatedDebugValue implements DebugTimer { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7247
diff
changeset
|
33 |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
34 private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
11617
0d10c6717edf
fixed TimerImpl to account for (i.e., deduct) all nested timers, not just the most recent one
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
36 /** |
0d10c6717edf
fixed TimerImpl to account for (i.e., deduct) all nested timers, not just the most recent one
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
37 * Records the most recent active timer. |
0d10c6717edf
fixed TimerImpl to account for (i.e., deduct) all nested timers, not just the most recent one
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
38 */ |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
39 private static final ThreadLocal<CloseableCounterImpl> currentTimer = new ThreadLocal<>(); |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
40 |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
41 static class FlatTimer extends DebugValue implements DebugTimer { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
42 private TimerImpl accm; |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
43 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
44 public FlatTimer(String name, boolean conditional) { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
45 super(name + "_Flat", conditional); |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
46 } |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
47 |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
48 @Override |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
49 public String toString(long value) { |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
50 return valueToString(value); |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
51 } |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
52 |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
53 public TimeUnit getTimeUnit() { |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
54 return accm.getTimeUnit(); |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
55 } |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
56 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
57 public DebugCloseable start() { |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
58 return accm.start(); |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
59 } |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
60 } |
11630
103e4438bb19
added support for accumulative times to TimerImpl
Doug Simon <doug.simon@oracle.com>
parents:
11629
diff
changeset
|
61 |
11562
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
62 public TimerImpl(String name, boolean conditional) { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
63 super(name, conditional, new FlatTimer(name, conditional)); |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
64 ((FlatTimer) flat).accm = this; |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 @Override |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
68 public DebugCloseable start() { |
11629
a0da0bff042e
made TimerImpl respect conditional flag (GRAAL-470)
Doug Simon <doug.simon@oracle.com>
parents:
11628
diff
changeset
|
69 if (!isConditional() || Debug.isTimeEnabled()) { |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
70 AbstractTimer result; |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
71 if (threadMXBean.isCurrentThreadCpuTimeSupported()) { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
72 result = new CpuTimeTimer(this); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
73 } else { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
74 result = new SystemNanosTimer(this); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
75 } |
11617
0d10c6717edf
fixed TimerImpl to account for (i.e., deduct) all nested timers, not just the most recent one
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
76 currentTimer.set(result); |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
77 return result; |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
78 } else { |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
79 return VOID_CLOSEABLE; |
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
80 } |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 } |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
82 |
11628
febd01be55e0
moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents:
11617
diff
changeset
|
83 public static String valueToString(long value) { |
febd01be55e0
moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents:
11617
diff
changeset
|
84 return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10); |
febd01be55e0
moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents:
11617
diff
changeset
|
85 } |
febd01be55e0
moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents:
11617
diff
changeset
|
86 |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
87 public DebugTimer getFlat() { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
88 return (FlatTimer) flat; |
17174
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
89 } |
2cb007e99ed0
added support for getting the flat time from a DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
14017
diff
changeset
|
90 |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
91 @Override |
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
92 public String toString(long value) { |
11628
febd01be55e0
moved 'conditional' field and related methods down in DebugValue
Doug Simon <doug.simon@oracle.com>
parents:
11617
diff
changeset
|
93 return valueToString(value); |
5134
4eb9895d9afe
Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
94 } |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
95 |
12778
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
11630
diff
changeset
|
96 public TimeUnit getTimeUnit() { |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
11630
diff
changeset
|
97 return TimeUnit.NANOSECONDS; |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
11630
diff
changeset
|
98 } |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
11630
diff
changeset
|
99 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
100 private abstract static class AbstractTimer extends CloseableCounterImpl implements DebugCloseable { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7247
diff
changeset
|
101 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
102 private AbstractTimer(AccumulatedDebugValue counter) { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
103 super(currentTimer.get(), counter); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
104 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
105 |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
106 @Override |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
107 public void close() { |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
108 super.close(); |
11617
0d10c6717edf
fixed TimerImpl to account for (i.e., deduct) all nested timers, not just the most recent one
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
109 currentTimer.set(parent); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
110 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
111 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
112 |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
113 private final class SystemNanosTimer extends AbstractTimer { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7247
diff
changeset
|
114 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
115 public SystemNanosTimer(TimerImpl timer) { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
116 super(timer); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
117 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
118 |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
119 @Override |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
120 protected long getCounterValue() { |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
121 return System.nanoTime(); |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
122 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
123 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
124 |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
125 private final class CpuTimeTimer extends AbstractTimer { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7247
diff
changeset
|
126 |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
127 public CpuTimeTimer(TimerImpl timer) { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
128 super(timer); |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
129 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
130 |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
131 @Override |
19686
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
132 protected long getCounterValue() { |
7247
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
133 return threadMXBean.getCurrentThreadCpuTime(); |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
134 } |
1706be855f0e
Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5134
diff
changeset
|
135 } |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 } |