Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java @ 21709:3c17c0c41a6b
moved com.oracle.asm.**.test to JVMCI namespace (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 03 Jun 2015 18:33:23 +0200 |
parents | 7a7cf422160b |
children |
rev | line source |
---|---|
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
f03c71a0aeb8
Added draft debug classes.
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:
21140
diff
changeset
|
23 package com.oracle.jvmci.debug; |
4343
f03c71a0aeb8
Added draft debug classes.
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:
21140
diff
changeset
|
25 import static com.oracle.jvmci.debug.Debug.Initialization.*; |
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:
21140
diff
changeset
|
26 import static com.oracle.jvmci.debug.DelegatingDebugConfig.Feature.*; |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
27 import static java.util.FormattableFlags.*; |
5302
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
28 |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
29 import java.io.*; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
30 import java.util.*; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
31 import java.util.concurrent.*; |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
32 |
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:
21140
diff
changeset
|
33 import com.oracle.jvmci.debug.DelegatingDebugConfig.Level; |
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:
21140
diff
changeset
|
34 import com.oracle.jvmci.debug.internal.*; |
21605
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
35 import com.oracle.jvmci.service.*; |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
36 |
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
37 /** |
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
38 * Scope based debugging facility. This facility is {@link #isEnabled()} if assertions are enabled |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
39 * for the {@link Debug} class or the {@value Initialization#INITIALIZER_PROPERTY_NAME} system |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
40 * property is {@code "true"} when {@link Debug} is initialized. |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
41 */ |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
42 public class Debug { |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
21605
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
44 static { |
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
45 for (DebugInitializationPropertyProvider p : Services.load(DebugInitializationPropertyProvider.class)) { |
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
46 p.apply(); |
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
47 } |
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
48 } |
7a7cf422160b
replaced OptionsParsed with DebugInitializationPropertyProvider
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
49 |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
50 /** |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
51 * Class to assist with initialization of {@link Debug}. |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
52 */ |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
53 public static class Initialization { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
54 |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
55 public static final String INITIALIZER_PROPERTY_NAME = "jvmci.debug.enable"; |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
56 |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
57 private static boolean initialized; |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
58 |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
59 /** |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
60 * Determines if {@link Debug} has been initialized. |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
61 */ |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
62 public static boolean isDebugInitialized() { |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
63 return initialized; |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
64 } |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
65 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
66 } |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
68 @SuppressWarnings("all") |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
69 private static boolean initialize() { |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
70 boolean assertionsEnabled = false; |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
71 assert assertionsEnabled = true; |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
72 Initialization.initialized = true; |
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
73 return assertionsEnabled || Boolean.getBoolean(INITIALIZER_PROPERTY_NAME); |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
74 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
75 |
11612
54dff87002e0
check that Debug has not been initialized before HotSpotOptions.finalizeOptions() is called
Doug Simon <doug.simon@oracle.com>
parents:
11611
diff
changeset
|
76 private static final boolean ENABLED = initialize(); |
11611
a27678c47948
made Debug.ENABLED static (i.e. a compile-time constant)
Doug Simon <doug.simon@oracle.com>
parents:
11562
diff
changeset
|
77 |
4369
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
78 public static boolean isEnabled() { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
79 return ENABLED; |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
80 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
81 |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
82 public static boolean isDumpEnabledForMethod() { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
83 if (!ENABLED) { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
84 return false; |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
85 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
86 DebugConfig config = DebugScope.getConfig(); |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
87 if (config == null) { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
88 return false; |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
89 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
90 return config.isDumpEnabledForMethod(); |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
91 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
92 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
93 public static final int DEFAULT_LOG_LEVEL = 2; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
94 |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
95 public static boolean isDumpEnabled() { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
96 return isDumpEnabled(DEFAULT_LOG_LEVEL); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
97 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
98 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
99 public static boolean isDumpEnabled(int dumpLevel) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
100 return ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel); |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
101 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
102 |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
103 /** |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
104 * Determines if verification is enabled in the current method, regardless of the |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
105 * {@linkplain Debug#currentScope() current debug scope}. |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
106 * |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
107 * @see Debug#verify(Object, String) |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
108 */ |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
109 public static boolean isVerifyEnabledForMethod() { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
110 if (!ENABLED) { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
111 return false; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
112 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
113 DebugConfig config = DebugScope.getConfig(); |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
114 if (config == null) { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
115 return false; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
116 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
117 return config.isVerifyEnabledForMethod(); |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
118 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
119 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
120 /** |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
121 * Determines if verification is enabled in the {@linkplain Debug#currentScope() current debug |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
122 * scope}. |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
123 * |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
124 * @see Debug#verify(Object, String) |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
125 */ |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
126 public static boolean isVerifyEnabled() { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
127 return ENABLED && DebugScope.getInstance().isVerifyEnabled(); |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
128 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
129 |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
130 public static boolean isMeterEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
131 return ENABLED && DebugScope.getInstance().isMeterEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
132 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
133 |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
134 public static boolean isTimeEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
135 return ENABLED && DebugScope.getInstance().isTimeEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
136 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
137 |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
138 public static boolean isMemUseTrackingEnabled() { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
139 return ENABLED && DebugScope.getInstance().isMemUseTrackingEnabled(); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
140 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
141 |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
142 public static boolean isLogEnabledForMethod() { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
143 if (!ENABLED) { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
144 return false; |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
145 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
146 DebugConfig config = DebugScope.getConfig(); |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
147 if (config == null) { |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
148 return false; |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
149 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
150 return config.isLogEnabledForMethod(); |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
151 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
152 |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
153 public static boolean isLogEnabled() { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
154 return isLogEnabled(DEFAULT_LOG_LEVEL); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
155 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
156 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
157 public static boolean isLogEnabled(int logLevel) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
158 return ENABLED && DebugScope.getInstance().isLogEnabled(logLevel); |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
159 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
160 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
161 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
162 public static Runnable decorateDebugRoot(Runnable runnable, String name, DebugConfig config) { |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
163 return runnable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
164 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
165 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
166 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
167 public static <T> Callable<T> decorateDebugRoot(Callable<T> callable, String name, DebugConfig config) { |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
168 return callable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
169 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
170 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
171 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
172 public static Runnable decorateScope(Runnable runnable, String name, Object... context) { |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
173 return runnable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
174 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
175 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
176 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
177 public static <T> Callable<T> decorateScope(Callable<T> callable, String name, Object... context) { |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
178 return callable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
179 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
180 |
9199
2ff3499d408e
enhanced support for sandboxed debug scope such that their debug config can be specified
Doug Simon <doug.simon@oracle.com>
parents:
9103
diff
changeset
|
181 /** |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
182 * Gets a string composed of the names in the current nesting of debug |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
183 * {@linkplain #scope(Object) scopes} separated by {@code '.'}. |
9199
2ff3499d408e
enhanced support for sandboxed debug scope such that their debug config can be specified
Doug Simon <doug.simon@oracle.com>
parents:
9103
diff
changeset
|
184 */ |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
185 public static String currentScope() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
186 if (ENABLED) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
187 return DebugScope.getInstance().getQualifiedName(); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
188 } else { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
189 return ""; |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
190 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
191 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
192 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
193 /** |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
194 * Represents a debug scope entered by {@link Debug#scope(Object)} or |
14906 | 195 * {@link Debug#sandbox(CharSequence, DebugConfig, Object...)}. Leaving the scope is achieved |
196 * via {@link #close()}. | |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
197 */ |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
198 public interface Scope extends AutoCloseable { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
199 void close(); |
5009
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
200 } |
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
201 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
202 /** |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
203 * Creates and enters a new debug scope which will be a child of the current debug scope. |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
204 * <p> |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
205 * It is recommended to use the try-with-resource statement for managing entering and leaving |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
206 * debug scopes. For example: |
14779 | 207 * |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
208 * <pre> |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
209 * try (Scope s = Debug.scope("InliningGraph", inlineeGraph)) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
210 * ... |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
211 * } catch (Throwable e) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
212 * throw Debug.handle(e); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
213 * } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
214 * </pre> |
14779 | 215 * |
14620
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
216 * The {@code name} argument is subject to the following type based conversion before having |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
217 * {@link Object#toString()} called on it: |
14779 | 218 * |
14620
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
219 * <pre> |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
220 * Type | Conversion |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
221 * ------------------+----------------- |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
222 * java.lang.Class | arg.getSimpleName() |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
223 * | |
a0baf4eeb018
removed allocation for name of debug scope
Doug Simon <doug.simon@oracle.com>
parents:
14616
diff
changeset
|
224 * </pre> |
14779 | 225 * |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
226 * @param name the name of the new scope |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
227 * @param contextObjects an array of object to be appended to the {@linkplain #context() |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
228 * current} debug context |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
229 * @throws Throwable used to enforce a catch block. |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
230 * @return the scope entered by this method which will be exited when its {@link Scope#close()} |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
231 * method is called |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
232 */ |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
233 public static Scope scope(Object name, Object[] contextObjects) throws Throwable { |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
234 if (ENABLED) { |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
235 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, contextObjects); |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
236 } else { |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
237 return null; |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
238 } |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
239 } |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
240 |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
241 /** |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
242 * Similar to {@link #scope(Object, Object[])} but without context objects. Therefore the catch |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
243 * block can be omitted. |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
244 * |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
245 * @see #scope(Object, Object[]) |
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
246 */ |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
247 public static Scope scope(Object name) { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
248 if (ENABLED) { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
249 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null); |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
250 } else { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
251 return null; |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
252 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
253 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
254 |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
255 /** |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
256 * @see #scope(Object, Object[]) |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
257 * @param context an object to be appended to the {@linkplain #context() current} debug context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
258 */ |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
259 public static Scope scope(Object name, Object context) throws Throwable { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
260 if (ENABLED) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
261 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
262 } else { |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
263 return null; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
264 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
265 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
266 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
267 /** |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
268 * @see #scope(Object, Object[]) |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
269 * @param context1 first object to be appended to the {@linkplain #context() current} debug |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
270 * context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
271 * @param context2 second object to be appended to the {@linkplain #context() current} debug |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
272 * context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
273 */ |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
274 public static Scope scope(Object name, Object context1, Object context2) throws Throwable { |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
275 if (ENABLED) { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
276 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2); |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
277 } else { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
278 return null; |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
279 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
280 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
281 |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
282 /** |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
283 * @see #scope(Object, Object[]) |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
284 * @param context1 first object to be appended to the {@linkplain #context() current} debug |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
285 * context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
286 * @param context2 second object to be appended to the {@linkplain #context() current} debug |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
287 * context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
288 * @param context3 third object to be appended to the {@linkplain #context() current} debug |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
289 * context |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
290 */ |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
291 public static Scope scope(Object name, Object context1, Object context2, Object context3) throws Throwable { |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
292 if (ENABLED) { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
293 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2, context3); |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
294 } else { |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
295 return null; |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
296 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
297 } |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
298 |
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
299 /** |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
300 * Creates and enters a new debug scope which will be disjoint from the current debug scope. |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
301 * <p> |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
302 * It is recommended to use the try-with-resource statement for managing entering and leaving |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
303 * debug scopes. For example: |
14779 | 304 * |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
305 * <pre> |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
306 * try (Scope s = Debug.sandbox("CompilingStub", null, stubGraph)) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
307 * ... |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
308 * } catch (Throwable e) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
309 * throw Debug.handle(e); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
310 * } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
311 * </pre> |
14779 | 312 * |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
313 * @param name the name of the new scope |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
314 * @param config the debug configuration to use for the new scope |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
315 * @param context objects to be appended to the {@linkplain #context() current} debug context |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
316 * @return the scope entered by this method which will be exited when its {@link Scope#close()} |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
317 * method is called |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
318 */ |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
319 public static Scope sandbox(CharSequence name, DebugConfig config, Object... context) throws Throwable { |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
320 if (ENABLED) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
321 DebugConfig sandboxConfig = config == null ? silentConfig() : config; |
13547
8ea968b6dba9
fix handling of sandboxed debug scopes (don't destroy parent flags)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13326
diff
changeset
|
322 return DebugScope.getInstance().scope(name, sandboxConfig, context); |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
323 } else { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
324 return null; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
325 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
326 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
327 |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
328 public static Scope forceLog() throws Throwable { |
15851
94a2df2f8e58
preserve context in Debug.forceLog
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15665
diff
changeset
|
329 ArrayList<Object> context = new ArrayList<>(); |
94a2df2f8e58
preserve context in Debug.forceLog
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15665
diff
changeset
|
330 for (Object obj : context()) { |
94a2df2f8e58
preserve context in Debug.forceLog
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15665
diff
changeset
|
331 context.add(obj); |
94a2df2f8e58
preserve context in Debug.forceLog
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15665
diff
changeset
|
332 } |
17069 | 333 return Debug.sandbox("forceLog", new DelegatingDebugConfig().override(Level.LOG, Integer.MAX_VALUE).enable(LOG_METHOD), context.toArray()); |
14109
85969b1aba78
Use a forceLog scope for LinearScan.reportFailure. Remove @SuppressWarnings on DebugScope.scope
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13551
diff
changeset
|
334 } |
85969b1aba78
Use a forceLog scope for LinearScan.reportFailure. Remove @SuppressWarnings on DebugScope.scope
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13551
diff
changeset
|
335 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
336 /** |
15116
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
337 * Opens a scope in which exception {@linkplain DebugConfig#interceptException(Throwable) |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
338 * interception} is disabled. It is recommended to use the try-with-resource statement for |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
339 * managing entering and leaving such scopes: |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
340 * |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
341 * <pre> |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
342 * try (DebugConfigScope s = Debug.disableIntercept()) { |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
343 * ... |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
344 * } |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
345 * </pre> |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
346 * |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
347 * This is particularly useful to suppress extraneous output in JUnit tests that are expected to |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
348 * throw an exception. |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
349 */ |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
350 public static DebugConfigScope disableIntercept() { |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
351 return Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT)); |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
352 } |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
353 |
0d296283e87d
HSAIL: suppressed output in unit tests
Doug Simon <doug.simon@oracle.com>
parents:
15115
diff
changeset
|
354 /** |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
355 * Handles an exception in the context of the debug scope just exited. The just exited scope |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
356 * must have the current scope as its parent which will be the case if the try-with-resource |
14624
f3510d0dcf67
removed use of varargs from Debug.scope() API
Doug Simon <doug.simon@oracle.com>
parents:
14620
diff
changeset
|
357 * pattern recommended by {@link #scope(Object)} and |
14906 | 358 * {@link #sandbox(CharSequence, DebugConfig, Object...)} is used |
14779 | 359 * |
17212
1ac6b4879443
Enforce catch-blocks for Debug.Scopes with context objects.
Josef Eisl <josef.eisl@jku.at>
parents:
17173
diff
changeset
|
360 * @see #scope(Object, Object[]) |
14906 | 361 * @see #sandbox(CharSequence, DebugConfig, Object...) |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
362 */ |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
363 public static RuntimeException handle(Throwable exception) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
364 if (ENABLED) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
365 return DebugScope.getInstance().handle(exception); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
366 } else { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
367 if (exception instanceof Error) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
368 throw (Error) exception; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
369 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
370 if (exception instanceof RuntimeException) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
371 throw (RuntimeException) exception; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
372 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
373 throw new RuntimeException(exception); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
374 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
375 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
376 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
377 public static void log(String msg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
378 log(DEFAULT_LOG_LEVEL, msg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
379 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
380 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13189
diff
changeset
|
381 /** |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
382 * Prints a message to the current debug scope's logging stream if logging is enabled. |
14779 | 383 * |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
384 * @param msg the message to log |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
385 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
386 public static void log(int logLevel, String msg) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
387 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
388 DebugScope.getInstance().log(logLevel, msg); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
389 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
390 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
391 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
392 public static void log(String format, Object arg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
393 log(DEFAULT_LOG_LEVEL, format, arg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
394 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
395 |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
396 /** |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
397 * Prints a message to the current debug scope's logging stream if logging is enabled. |
14779 | 398 * |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
399 * @param format a format string |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
400 * @param arg the argument referenced by the format specifiers in {@code format} |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
401 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
402 public static void log(int logLevel, String format, Object arg) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
403 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
404 DebugScope.getInstance().log(logLevel, format, arg); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
405 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
406 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
407 |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
408 public static void log(String format, int arg) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
409 log(DEFAULT_LOG_LEVEL, format, arg); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
410 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
411 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
412 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
413 * Prints a message to the current debug scope's logging stream if logging is enabled. |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
414 * |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
415 * @param format a format string |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
416 * @param arg the argument referenced by the format specifiers in {@code format} |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
417 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
418 public static void log(int logLevel, String format, int arg) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
419 if (ENABLED) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
420 DebugScope.getInstance().log(logLevel, format, arg); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
421 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
422 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
423 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
424 public static void log(String format, Object arg1, Object arg2) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
425 log(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
426 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
427 |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
428 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
429 * @see #log(int, String, Object) |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
430 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
431 public static void log(int logLevel, String format, Object arg1, Object arg2) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
432 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
433 DebugScope.getInstance().log(logLevel, format, arg1, arg2); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
434 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
435 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
436 |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
437 public static void log(String format, int arg1, Object arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
438 log(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
439 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
440 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
441 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
442 * @see #log(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
443 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
444 public static void log(int logLevel, String format, int arg1, Object arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
445 if (ENABLED) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
446 DebugScope.getInstance().log(logLevel, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
447 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
448 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
449 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
450 public static void log(String format, Object arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
451 log(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
452 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
453 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
454 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
455 * @see #log(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
456 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
457 public static void log(int logLevel, String format, Object arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
458 if (ENABLED) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
459 DebugScope.getInstance().log(logLevel, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
460 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
461 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
462 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
463 public static void log(String format, int arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
464 log(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
465 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
466 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
467 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
468 * @see #log(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
469 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
470 public static void log(int logLevel, String format, int arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
471 if (ENABLED) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
472 DebugScope.getInstance().log(logLevel, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
473 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
474 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
475 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
476 public static void log(String format, Object arg1, Object arg2, Object arg3) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
477 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
478 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
479 |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
480 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
481 * @see #log(int, String, Object) |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
482 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
483 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
484 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
485 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
486 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
487 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
488 |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
489 public static void log(String format, int arg1, int arg2, int arg3) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
490 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
491 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
492 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
493 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
494 * @see #log(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
495 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
496 public static void log(int logLevel, String format, int arg1, int arg2, int arg3) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
497 if (ENABLED) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
498 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
499 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
500 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
501 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
502 public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
503 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
504 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
505 |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
506 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
507 * @see #log(int, String, Object) |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
508 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
509 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) { |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
510 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
511 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
512 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
513 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
514 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
515 public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
516 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
517 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
518 |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
519 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
520 * @see #log(int, String, Object) |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
521 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
522 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
523 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
524 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
525 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
526 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
527 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
528 public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
529 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
530 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
531 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
532 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
533 * @see #log(int, String, Object) |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
534 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
535 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) { |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
536 if (ENABLED) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
537 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6); |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
538 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
539 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
540 |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
541 public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
542 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
543 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
544 |
19262
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
545 public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) { |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
546 log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
547 } |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
548 |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
549 /** |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
550 * @see #log(int, String, Object) |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
551 */ |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
552 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
553 if (ENABLED) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
554 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
555 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
556 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
557 |
19262
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
558 public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) { |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
559 if (ENABLED) { |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
560 DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
561 } |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
562 } |
8632751713af
Add 8 arguments Debug.log mehtods
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18935
diff
changeset
|
563 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
564 public static void logv(String format, Object... args) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
565 logv(DEFAULT_LOG_LEVEL, format, args); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
566 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
567 |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
568 /** |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
569 * Prints a message to the current debug scope's logging stream. This method must only be called |
14634
2496f9f49f6b
improved javadoc for Debug.logv() to explain why it should be avoided
Doug Simon <doug.simon@oracle.com>
parents:
14625
diff
changeset
|
570 * if debugging is {@linkplain Debug#isEnabled() enabled} as it incurs allocation at the call |
2496f9f49f6b
improved javadoc for Debug.logv() to explain why it should be avoided
Doug Simon <doug.simon@oracle.com>
parents:
14625
diff
changeset
|
571 * site. If possible, call one of the other {@code log()} methods in this class that take a |
2496f9f49f6b
improved javadoc for Debug.logv() to explain why it should be avoided
Doug Simon <doug.simon@oracle.com>
parents:
14625
diff
changeset
|
572 * fixed number of parameters. |
14779 | 573 * |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
574 * @param format a format string |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
575 * @param args the arguments referenced by the format specifiers in {@code format} |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
576 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
577 public static void logv(int logLevel, String format, Object... args) { |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
578 if (!ENABLED) { |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
579 throw new InternalError("Use of Debug.logv() must be guarded by a test of Debug.isEnabled()"); |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
580 } |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
581 DebugScope.getInstance().log(logLevel, format, args); |
14625
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
582 } |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
583 |
3ab42370f636
removed use of varargs from Debug.log() API
Doug Simon <doug.simon@oracle.com>
parents:
14624
diff
changeset
|
584 /** |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
585 * This override exists to catch cases when {@link #log(String, Object)} is called with one |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
586 * argument bound to a varargs method parameter. It will bind to this method instead of the |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
587 * single arg variant and produce a deprecation warning instead of silently wrapping the |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
588 * Object[] inside of another Object[]. |
14719
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
589 */ |
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
590 @Deprecated |
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
591 public static void log(String format, Object[] args) { |
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
592 assert false : "shouldn't use this"; |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
593 log(DEFAULT_LOG_LEVEL, format, args); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
594 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
595 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
596 /** |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
597 * This override exists to catch cases when {@link #log(int, String, Object)} is called with one |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
598 * argument bound to a varargs method parameter. It will bind to this method instead of the |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
599 * single arg variant and produce a deprecation warning instead of silently wrapping the |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
600 * Object[] inside of another Object[]. |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
601 */ |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
602 @Deprecated |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
603 public static void log(int logLevel, String format, Object[] args) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
604 assert false : "shouldn't use this"; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
605 logv(logLevel, format, args); |
14719
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
606 } |
0bdd0d157040
fix vargs -> Object -> vargs logging call paths
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14634
diff
changeset
|
607 |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
608 public static void dump(Object object, String msg) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
609 dump(DEFAULT_LOG_LEVEL, object, msg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
610 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
611 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
612 public static void dump(int dumpLevel, Object object, String msg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
613 if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
614 DebugScope.getInstance().dump(dumpLevel, object, msg); |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
615 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
616 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
617 |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
618 public static void dump(Object object, String format, Object arg) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
619 dump(DEFAULT_LOG_LEVEL, object, format, arg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
620 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
621 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
622 public static void dump(int dumpLevel, Object object, String format, Object arg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
623 if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
624 DebugScope.getInstance().dump(dumpLevel, object, format, arg); |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
625 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
626 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
627 |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
628 public static void dump(Object object, String format, Object arg1, Object arg2) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
629 dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
630 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
631 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
632 public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
633 if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
634 DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2); |
10923 | 635 } |
636 } | |
637 | |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
638 public static void dump(Object object, String format, Object arg1, Object arg2, Object arg3) { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
639 dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2, arg3); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
640 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
641 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
642 public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2, Object arg3) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
643 if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
644 DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2, arg3); |
14873
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
645 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
646 } |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
647 |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
648 /** |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
649 * This override exists to catch cases when {@link #dump(Object, String, Object)} is called with |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
650 * one argument bound to a varargs method parameter. It will bind to this method instead of the |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
651 * single arg variant and produce a deprecation warning instead of silently wrapping the |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
652 * Object[] inside of another Object[]. |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
653 */ |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
654 @Deprecated |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
655 public static void dump(Object object, String format, Object[] args) { |
00eb80d735ed
removed Debug.printf and added multi-arg versions of Debug.dump
Doug Simon <doug.simon@oracle.com>
parents:
14871
diff
changeset
|
656 assert false : "shouldn't use this"; |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
657 dump(DEFAULT_LOG_LEVEL, object, format, args); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
658 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
659 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
660 /** |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
661 * This override exists to catch cases when {@link #dump(int, Object, String, Object)} is called |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
662 * with one argument bound to a varargs method parameter. It will bind to this method instead of |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
663 * the single arg variant and produce a deprecation warning instead of silently wrapping the |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
664 * Object[] inside of another Object[]. |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
665 */ |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
666 @Deprecated |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
667 public static void dump(int dumpLevel, Object object, String format, Object[] args) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
668 assert false : "shouldn't use this"; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
669 if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
670 DebugScope.getInstance().dump(dumpLevel, object, format, args); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
671 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
672 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
673 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
674 /** |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
675 * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig() |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
676 * config} to perform verification on a given object. |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
677 * |
16193
48f86e56eb75
simplified Debug verification API
Doug Simon <doug.simon@oracle.com>
parents:
16144
diff
changeset
|
678 * @param object object to verify |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
679 * @param message description of verification context |
16193
48f86e56eb75
simplified Debug verification API
Doug Simon <doug.simon@oracle.com>
parents:
16144
diff
changeset
|
680 * |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
681 * @see DebugVerifyHandler#verify(Object, String) |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
682 */ |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
683 public static void verify(Object object, String message) { |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
684 if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) { |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
685 DebugScope.getInstance().verify(object, message); |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
686 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
687 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
688 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
689 /** |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
690 * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig() |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
691 * config} to perform verification on a given object. |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
692 * |
16193
48f86e56eb75
simplified Debug verification API
Doug Simon <doug.simon@oracle.com>
parents:
16144
diff
changeset
|
693 * @param object object to verify |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
694 * @param format a format string for the description of the verification context |
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
695 * @param arg the argument referenced by the format specifiers in {@code format} |
16193
48f86e56eb75
simplified Debug verification API
Doug Simon <doug.simon@oracle.com>
parents:
16144
diff
changeset
|
696 * |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
697 * @see DebugVerifyHandler#verify(Object, String) |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
698 */ |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
699 public static void verify(Object object, String format, Object arg) { |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
700 if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) { |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
701 DebugScope.getInstance().verify(object, format, arg); |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
702 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
703 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
704 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
705 /** |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
706 * This override exists to catch cases when {@link #verify(Object, String, Object)} is called |
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
707 * with one argument bound to a varargs method parameter. It will bind to this method instead of |
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
708 * the single arg variant and produce a deprecation warning instead of silently wrapping the |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
709 * Object[] inside of another Object[]. |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
710 */ |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
711 @Deprecated |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
712 public static void verify(Object object, String format, Object[] args) { |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
713 assert false : "shouldn't use this"; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
714 if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) { |
16297
b9236eaecf4c
simplified DebugVerifyHandler API to be closer to DebugDumpHandler
Doug Simon <doug.simon@oracle.com>
parents:
16193
diff
changeset
|
715 DebugScope.getInstance().verify(object, format, args); |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
716 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
717 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
718 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
719 /** |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
720 * Opens a new indentation level (by adding some spaces) based on the current indentation level. |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
721 * This should be used in a {@linkplain Indent try-with-resources} pattern. |
14779 | 722 * |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
723 * @return an object that reverts to the current indentation level when |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
724 * {@linkplain Indent#close() closed} or null if debugging is disabled |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
725 * @see #logAndIndent(int, String) |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
726 * @see #logAndIndent(int, String, Object) |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
727 */ |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
728 public static Indent indent() { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
729 if (ENABLED) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
730 DebugScope scope = DebugScope.getInstance(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
731 return scope.pushIndentLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
732 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
733 return null; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
734 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
735 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
736 public static Indent logAndIndent(String msg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
737 return logAndIndent(DEFAULT_LOG_LEVEL, msg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
738 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
739 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
740 /** |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
741 * A convenience function which combines {@link #log(String)} and {@link #indent()}. |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
742 * |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
743 * @param msg the message to log |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
744 * @return an object that reverts to the current indentation level when |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
745 * {@linkplain Indent#close() closed} or null if debugging is disabled |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
746 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
747 public static Indent logAndIndent(int logLevel, String msg) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
748 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
749 return logvAndIndentInternal(logLevel, msg); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
750 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
751 return null; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
752 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
753 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
754 public static Indent logAndIndent(String format, Object arg) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
755 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
756 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
757 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
758 /** |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
759 * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}. |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
760 * |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
761 * @param format a format string |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
762 * @param arg the argument referenced by the format specifiers in {@code format} |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
763 * @return an object that reverts to the current indentation level when |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
764 * {@linkplain Indent#close() closed} or null if debugging is disabled |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
765 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
766 public static Indent logAndIndent(int logLevel, String format, Object arg) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
767 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
768 return logvAndIndentInternal(logLevel, format, arg); |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
769 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
770 return null; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
771 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
772 |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
773 public static Indent logAndIndent(String format, int arg) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
774 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
775 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
776 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
777 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
778 * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}. |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
779 * |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
780 * @param format a format string |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
781 * @param arg the argument referenced by the format specifiers in {@code format} |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
782 * @return an object that reverts to the current indentation level when |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
783 * {@linkplain Indent#close() closed} or null if debugging is disabled |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
784 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
785 public static Indent logAndIndent(int logLevel, String format, int arg) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
786 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
787 return logvAndIndentInternal(logLevel, format, arg); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
788 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
789 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
790 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
791 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
792 public static Indent logAndIndent(String format, int arg1, Object arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
793 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
794 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
795 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
796 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
797 * @see #logAndIndent(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
798 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
799 public static Indent logAndIndent(int logLevel, String format, int arg1, Object arg2) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
800 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
801 return logvAndIndentInternal(logLevel, format, arg1, arg2); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
802 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
803 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
804 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
805 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
806 public static Indent logAndIndent(String format, Object arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
807 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
808 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
809 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
810 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
811 * @see #logAndIndent(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
812 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
813 public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
814 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
815 return logvAndIndentInternal(logLevel, format, arg1, arg2); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
816 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
817 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
818 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
819 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
820 public static Indent logAndIndent(String format, int arg1, int arg2) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
821 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
822 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
823 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
824 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
825 * @see #logAndIndent(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
826 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
827 public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
828 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
829 return logvAndIndentInternal(logLevel, format, arg1, arg2); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
830 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
831 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
832 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
833 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
834 public static Indent logAndIndent(String format, Object arg1, Object arg2) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
835 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
836 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
837 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
838 /** |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
839 * @see #logAndIndent(int, String, Object) |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
840 */ |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
841 public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
842 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
843 return logvAndIndentInternal(logLevel, format, arg1, arg2); |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
844 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
845 return null; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
846 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
847 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
848 public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
849 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
850 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
851 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
852 /** |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
853 * @see #logAndIndent(int, String, Object) |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
854 */ |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
855 public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
856 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
857 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
858 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
859 return null; |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
860 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
861 |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
862 public static Indent logAndIndent(String format, int arg1, int arg2, int arg3) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
863 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
864 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
865 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
866 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
867 * @see #logAndIndent(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
868 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
869 public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2, int arg3) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
870 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
871 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
872 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
873 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
874 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
875 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
876 public static Indent logAndIndent(String format, Object arg1, int arg2, int arg3) { |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
877 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3); |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
878 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
879 |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
880 /** |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
881 * @see #logAndIndent(int, String, Object) |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
882 */ |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
883 public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2, int arg3) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
884 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
885 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3); |
20977
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
886 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
887 return null; |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
888 } |
820420c8713c
Add int overrides for some log methods
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20016
diff
changeset
|
889 |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
890 public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
891 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
892 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
893 |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
894 /** |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
895 * @see #logAndIndent(int, String, Object) |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
896 */ |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
897 public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
898 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
899 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4); |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
900 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
901 return null; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
902 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
903 |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
904 public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
905 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
906 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
907 |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
908 /** |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
909 * @see #logAndIndent(int, String, Object) |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
910 */ |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
911 public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
912 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
913 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5); |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
914 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
915 return null; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
916 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
917 |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
918 public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) { |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
919 return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6); |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
920 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
921 |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
922 /** |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
923 * @see #logAndIndent(int, String, Object) |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
924 */ |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
925 public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
926 if (ENABLED && Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
927 return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6); |
18935
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
928 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
929 return null; |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
930 } |
07f2a49f0bfb
Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents:
17333
diff
changeset
|
931 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
932 /** |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
933 * A convenience function which combines {@link #logv(int, String, Object...)} and |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
934 * {@link #indent()}. |
14779 | 935 * |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
936 * @param format a format string |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
937 * @param args the arguments referenced by the format specifiers in {@code format} |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
938 * @return an object that reverts to the current indentation level when |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
939 * {@linkplain Indent#close() closed} or null if debugging is disabled |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
940 */ |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
941 public static Indent logvAndIndent(int logLevel, String format, Object... args) { |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
942 if (ENABLED) { |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
943 if (Debug.isLogEnabled(logLevel)) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
944 return logvAndIndentInternal(logLevel, format, args); |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
945 } |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
946 return null; |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
947 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
948 throw new InternalError("Use of Debug.logvAndIndent() must be guarded by a test of Debug.isEnabled()"); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
949 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
950 |
21140
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
951 private static Indent logvAndIndentInternal(int logLevel, String format, Object... args) { |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
952 assert ENABLED && Debug.isLogEnabled(logLevel) : "must have checked Debug.isLogEnabled()"; |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
953 DebugScope scope = DebugScope.getInstance(); |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
954 scope.log(logLevel, format, args); |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
955 return scope.pushIndentLogger(); |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
956 } |
7d2f6dd603b0
Make DebugScope lazier and generally reduce overhead of Debug being enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20977
diff
changeset
|
957 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
958 /** |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
959 * This override exists to catch cases when {@link #logAndIndent(String, Object)} is called with |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
960 * one argument bound to a varargs method parameter. It will bind to this method instead of the |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
961 * single arg variant and produce a deprecation warning instead of silently wrapping the |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
962 * Object[] inside of another Object[]. |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
963 */ |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
964 @Deprecated |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
965 public static void logAndIndent(String format, Object[] args) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14779
diff
changeset
|
966 assert false : "shouldn't use this"; |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
967 logAndIndent(DEFAULT_LOG_LEVEL, format, args); |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
968 } |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
969 |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
970 /** |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
971 * This override exists to catch cases when {@link #logAndIndent(int, String, Object)} is called |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
972 * with one argument bound to a varargs method parameter. It will bind to this method instead of |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
973 * the single arg variant and produce a deprecation warning instead of silently wrapping the |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
974 * Object[] inside of another Object[]. |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
975 */ |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
976 @Deprecated |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
977 public static void logAndIndent(int logLevel, String format, Object[] args) { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
978 assert false : "shouldn't use this"; |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
979 logvAndIndent(logLevel, format, args); |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
980 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
981 |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
982 public static Iterable<Object> context() { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
983 if (ENABLED) { |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
984 return DebugScope.getInstance().getCurrentContext(); |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
985 } else { |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
986 return Collections.emptyList(); |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
987 } |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
988 } |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
989 |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
990 @SuppressWarnings("unchecked") |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
991 public static <T> List<T> contextSnapshot(Class<T> clazz) { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
992 if (ENABLED) { |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
993 List<T> result = new ArrayList<>(); |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
994 for (Object o : context()) { |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
995 if (clazz.isInstance(o)) { |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
996 result.add((T) o); |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
997 } |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
998 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
999 return result; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1000 } else { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1001 return Collections.emptyList(); |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1002 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1003 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1004 |
5251
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5159
diff
changeset
|
1005 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
1006 * Searches the current debug scope, bottom up, for a context object that is an instance of a |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
1007 * given type. The first such object found is returned. |
5251
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5159
diff
changeset
|
1008 */ |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1009 @SuppressWarnings("unchecked") |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1010 public static <T> T contextLookup(Class<T> clazz) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1011 if (ENABLED) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1012 for (Object o : context()) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1013 if (clazz.isInstance(o)) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1014 return ((T) o); |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1015 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1016 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1017 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1018 return null; |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1019 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1020 |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1021 /** |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1022 * Creates a {@linkplain DebugMemUseTracker memory use tracker} that is enabled iff debugging is |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1023 * {@linkplain #isEnabled() enabled}. |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1024 * <p> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1025 * A disabled tracker has virtually no overhead. |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1026 */ |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1027 public static DebugMemUseTracker memUseTracker(CharSequence name) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1028 if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) { |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1029 return VOID_MEM_USE_TRACKER; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1030 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1031 return createMemUseTracker("%s", name, null); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1032 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1033 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1034 /** |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1035 * Creates a debug memory use tracker. Invoking this method is equivalent to: |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1036 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1037 * <pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1038 * Debug.memUseTracker(format, arg, null) |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1039 * </pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1040 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1041 * except that the string formatting only happens if metering is enabled. |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1042 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1043 * @see #metric(String, Object, Object) |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1044 */ |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1045 public static DebugMemUseTracker memUseTracker(String format, Object arg) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1046 if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) { |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1047 return VOID_MEM_USE_TRACKER; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1048 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1049 return createMemUseTracker(format, arg, null); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1050 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1051 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1052 /** |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1053 * Creates a debug memory use tracker. Invoking this method is equivalent to: |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1054 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1055 * <pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1056 * Debug.memUseTracker(String.format(format, arg1, arg2)) |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1057 * </pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1058 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1059 * except that the string formatting only happens if memory use tracking is enabled. In |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1060 * addition, each argument is subject to the following type based conversion before being passed |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1061 * as an argument to {@link String#format(String, Object...)}: |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1062 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1063 * <pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1064 * Type | Conversion |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1065 * ------------------+----------------- |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1066 * java.lang.Class | arg.getSimpleName() |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1067 * | |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1068 * </pre> |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1069 * |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1070 * @see #memUseTracker(CharSequence) |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1071 */ |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1072 public static DebugMemUseTracker memUseTracker(String format, Object arg1, Object arg2) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1073 if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) { |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1074 return VOID_MEM_USE_TRACKER; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1075 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1076 return createMemUseTracker(format, arg1, arg2); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1077 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1078 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1079 private static DebugMemUseTracker createMemUseTracker(String format, Object arg1, Object arg2) { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1080 String name = formatDebugName(format, arg1, arg2); |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1081 return new MemUseTrackerImpl(name, !isUnconditionalMemUseTrackingEnabled); |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1082 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1083 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1084 /** |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1085 * Creates a {@linkplain DebugMetric metric} that is enabled iff debugging is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1086 * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1087 * {@value #ENABLE_METRIC_PROPERTY_NAME_PREFIX} to {@code name} is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1088 * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1089 * returned metric is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1090 * conditional. |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1091 * <p> |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1092 * A disabled metric has virtually no overhead. |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1093 */ |
14586
d2fe05d5cc96
added support for lazy computation of names for use with Debug
Doug Simon <doug.simon@oracle.com>
parents:
14582
diff
changeset
|
1094 public static DebugMetric metric(CharSequence name) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1095 if (!areUnconditionalMetricsEnabled() && !ENABLED) { |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
1096 return VOID_METRIC; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1097 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1098 return createMetric("%s", name, null); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1099 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1100 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1101 public static String applyFormattingFlagsAndWidth(String s, int flags, int width) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1102 if (flags == 0 && width < 0) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1103 return s; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1104 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1105 StringBuilder sb = new StringBuilder(s); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1106 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1107 // apply width and justification |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1108 int len = sb.length(); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1109 if (len < width) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1110 for (int i = 0; i < width - len; i++) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1111 if ((flags & LEFT_JUSTIFY) == LEFT_JUSTIFY) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1112 sb.append(' '); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1113 } else { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1114 sb.insert(0, ' '); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1115 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1116 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1117 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1118 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1119 String res = sb.toString(); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1120 if ((flags & UPPERCASE) == UPPERCASE) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1121 res = res.toUpperCase(); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1122 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1123 return res; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1124 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1125 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1126 /** |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1127 * Creates a debug metric. Invoking this method is equivalent to: |
14779 | 1128 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1129 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1130 * Debug.metric(format, arg, null) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1131 * </pre> |
14779 | 1132 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1133 * except that the string formatting only happens if metering is enabled. |
14779 | 1134 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1135 * @see #metric(String, Object, Object) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1136 */ |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1137 public static DebugMetric metric(String format, Object arg) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1138 if (!areUnconditionalMetricsEnabled() && !ENABLED) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1139 return VOID_METRIC; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1140 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1141 return createMetric(format, arg, null); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1142 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1143 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1144 /** |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1145 * Creates a debug metric. Invoking this method is equivalent to: |
14779 | 1146 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1147 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1148 * Debug.metric(String.format(format, arg1, arg2)) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1149 * </pre> |
14779 | 1150 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1151 * except that the string formatting only happens if metering is enabled. In addition, each |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1152 * argument is subject to the following type based conversion before being passed as an argument |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1153 * to {@link String#format(String, Object...)}: |
14779 | 1154 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1155 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1156 * Type | Conversion |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1157 * ------------------+----------------- |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1158 * java.lang.Class | arg.getSimpleName() |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1159 * | |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1160 * </pre> |
14779 | 1161 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1162 * @see #metric(CharSequence) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1163 */ |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1164 public static DebugMetric metric(String format, Object arg1, Object arg2) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1165 if (!areUnconditionalMetricsEnabled() && !ENABLED) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1166 return VOID_METRIC; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1167 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1168 return createMetric(format, arg1, arg2); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1169 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1170 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1171 private static DebugMetric createMetric(String format, Object arg1, Object arg2) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1172 String name = formatDebugName(format, arg1, arg2); |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1173 boolean conditional = enabledMetrics == null || !findMatch(enabledMetrics, enabledMetricsSubstrings, name); |
16924
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1174 if (!ENABLED && conditional) { |
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1175 return VOID_METRIC; |
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1176 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1177 return new MetricImpl(name, conditional); |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1178 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1179 |
13158
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1180 /** |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1181 * Changes the debug configuration for the current thread. |
14779 | 1182 * |
13158
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1183 * @param config new configuration to use for the current thread |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1184 * @return an object that when {@linkplain DebugConfigScope#close() closed} will restore the |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1185 * debug configuration for the current thread to what it was before this method was |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1186 * called |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1187 */ |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1188 public static DebugConfigScope setConfig(DebugConfig config) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
1189 if (ENABLED) { |
13158
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1190 return new DebugConfigScope(config); |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1191 } else { |
53b1edcf628f
added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
13142
diff
changeset
|
1192 return null; |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
1193 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
1194 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
1195 |
11551
63b4694d3627
split DebugHistogram printing out into separate service
Doug Simon <doug.simon@oracle.com>
parents:
11382
diff
changeset
|
1196 /** |
63b4694d3627
split DebugHistogram printing out into separate service
Doug Simon <doug.simon@oracle.com>
parents:
11382
diff
changeset
|
1197 * Creates an object for counting value frequencies. |
63b4694d3627
split DebugHistogram printing out into separate service
Doug Simon <doug.simon@oracle.com>
parents:
11382
diff
changeset
|
1198 */ |
9103
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
1199 public static DebugHistogram createHistogram(String name) { |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
1200 return new DebugHistogramImpl(name); |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
1201 } |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
1202 |
13189
f444a67ecbae
Debug: use silent debug config for sandbox
Bernhard Urban <bernhard.urban@jku.at>
parents:
13163
diff
changeset
|
1203 public static DebugConfig silentConfig() { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1204 return fixedConfig(0, 0, false, false, false, false, Collections.<DebugDumpHandler> emptyList(), Collections.<DebugVerifyHandler> emptyList(), null); |
13189
f444a67ecbae
Debug: use silent debug config for sandbox
Bernhard Urban <bernhard.urban@jku.at>
parents:
13163
diff
changeset
|
1205 } |
f444a67ecbae
Debug: use silent debug config for sandbox
Bernhard Urban <bernhard.urban@jku.at>
parents:
13163
diff
changeset
|
1206 |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1207 public static DebugConfig fixedConfig(final int logLevel, final int dumpLevel, final boolean isMeterEnabled, final boolean isMemUseTrackingEnabled, final boolean isTimerEnabled, |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1208 final boolean isVerifyEnabled, final Collection<DebugDumpHandler> dumpHandlers, final Collection<DebugVerifyHandler> verifyHandlers, final PrintStream output) { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1209 return new DebugConfig() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1210 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1211 @Override |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1212 public int getLogLevel() { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1213 return logLevel; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1214 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1215 |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1216 public boolean isLogEnabledForMethod() { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1217 return logLevel > 0; |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1218 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1219 |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1220 @Override |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1221 public boolean isMeterEnabled() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1222 return isMeterEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1223 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1224 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1225 @Override |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1226 public boolean isMemUseTrackingEnabled() { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1227 return isMemUseTrackingEnabled; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1228 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1229 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1230 @Override |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1231 public int getDumpLevel() { |
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1232 return dumpLevel; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1233 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1234 |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1235 public boolean isDumpEnabledForMethod() { |
16463
f1d839174e71
Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents:
16405
diff
changeset
|
1236 return dumpLevel > 0; |
13326
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1237 } |
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13197
diff
changeset
|
1238 |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1239 @Override |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1240 public boolean isVerifyEnabled() { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1241 return isVerifyEnabled; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1242 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1243 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1244 public boolean isVerifyEnabledForMethod() { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1245 return isVerifyEnabled; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1246 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1247 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1248 @Override |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
1249 public boolean isTimeEnabled() { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1250 return isTimerEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1251 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1252 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1253 @Override |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1254 public RuntimeException interceptException(Throwable e) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1255 return null; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1256 } |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
1257 |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
1258 @Override |
6584
a3eb814ea564
added more javadoc to DebugConfig interface
Doug Simon <doug.simon@oracle.com>
parents:
5620
diff
changeset
|
1259 public Collection<DebugDumpHandler> dumpHandlers() { |
4428
0bb7ab1add7e
enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents:
4406
diff
changeset
|
1260 return dumpHandlers; |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
1261 } |
5302
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
1262 |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
1263 @Override |
16144
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1264 public Collection<DebugVerifyHandler> verifyHandlers() { |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1265 return verifyHandlers; |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1266 } |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1267 |
af9f3a5f091b
extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents:
15851
diff
changeset
|
1268 @Override |
5302
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
1269 public PrintStream output() { |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
1270 return output; |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
1271 } |
5620
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1272 |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1273 @Override |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1274 public void addToContext(Object o) { |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1275 } |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1276 |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1277 @Override |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1278 public void removeFromContext(Object o) { |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
1279 } |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1280 }; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1281 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
1282 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
1283 private static final DebugMetric VOID_METRIC = new DebugMetric() { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1284 |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1285 public void increment() { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1286 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1287 |
7557
db90c8b5a861
changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
1288 public void add(long value) { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1289 } |
11562
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1290 |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1291 public void setConditional(boolean flag) { |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1292 throw new InternalError("Cannot make void metric conditional"); |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1293 } |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1294 |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1295 public boolean isConditional() { |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1296 return false; |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1297 } |
12778
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1298 |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1299 public long getCurrentValue() { |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1300 return 0L; |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1301 } |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
1302 }; |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
1303 |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1304 private static final DebugMemUseTracker VOID_MEM_USE_TRACKER = new DebugMemUseTracker() { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1305 |
19693
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19262
diff
changeset
|
1306 public DebugCloseable start() { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19262
diff
changeset
|
1307 return DebugCloseable.VOID_CLOSEABLE; |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1308 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1309 |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1310 public long getCurrentValue() { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1311 return 0; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1312 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1313 }; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1314 |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1315 public static final String ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME = "jvmci.debug.unscopedTimers"; |
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1316 public static final String ENABLE_UNSCOPED_METRICS_PROPERTY_NAME = "jvmci.debug.unscopedMetrics"; |
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1317 public static final String ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME = "jvmci.debug.unscopedMemUseTrackers"; |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1318 |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1319 /** |
14586
d2fe05d5cc96
added support for lazy computation of names for use with Debug
Doug Simon <doug.simon@oracle.com>
parents:
14582
diff
changeset
|
1320 * @see #timer(CharSequence) |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1321 */ |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1322 public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "jvmci.debug.timer."; |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1323 |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1324 /** |
14586
d2fe05d5cc96
added support for lazy computation of names for use with Debug
Doug Simon <doug.simon@oracle.com>
parents:
14582
diff
changeset
|
1325 * @see #metric(CharSequence) |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1326 */ |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1327 public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "jvmci.debug.metric."; |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1328 |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1329 /** |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1330 * Set of unconditionally enabled metrics. Possible values and their meanings: |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1331 * <ul> |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1332 * <li>{@code null}: no unconditionally enabled metrics</li> |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1333 * <li>{@code isEmpty()}: all metrics are unconditionally enabled</li> |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1334 * <li>{@code !isEmpty()}: use {@link #findMatch(Set, Set, String)} on this set and |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1335 * {@link #enabledMetricsSubstrings} to determine which metrics are unconditionally enabled</li> |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1336 * </ul> |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1337 */ |
14582
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1338 private static final Set<String> enabledMetrics; |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1339 |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1340 /** |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1341 * Set of unconditionally enabled timers. Same interpretation of values as for |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1342 * {@link #enabledMetrics}. |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1343 */ |
14582
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1344 private static final Set<String> enabledTimers; |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1345 |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1346 private static final Set<String> enabledMetricsSubstrings = new HashSet<>(); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1347 private static final Set<String> enabledTimersSubstrings = new HashSet<>(); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1348 |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1349 /** |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1350 * Specifies if all mem use trackers are unconditionally enabled. |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1351 */ |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1352 private static final boolean isUnconditionalMemUseTrackingEnabled; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1353 |
14582
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1354 static { |
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1355 Set<String> metrics = new HashSet<>(); |
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1356 Set<String> timers = new HashSet<>(); |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1357 parseMetricAndTimerSystemProperties(metrics, timers, enabledMetricsSubstrings, enabledTimersSubstrings); |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1358 metrics = metrics.isEmpty() && enabledMetricsSubstrings.isEmpty() ? null : metrics; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1359 timers = timers.isEmpty() && enabledTimersSubstrings.isEmpty() ? null : timers; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1360 if (metrics == null && Boolean.getBoolean(ENABLE_UNSCOPED_METRICS_PROPERTY_NAME)) { |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1361 metrics = Collections.emptySet(); |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1362 } |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1363 if (timers == null && Boolean.getBoolean(ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME)) { |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1364 timers = Collections.emptySet(); |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1365 } |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1366 enabledMetrics = metrics; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1367 enabledTimers = timers; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1368 isUnconditionalMemUseTrackingEnabled = Boolean.getBoolean(ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME); |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1369 } |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1370 |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1371 private static boolean findMatch(Set<String> haystack, Set<String> haystackSubstrings, String needle) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1372 if (haystack.isEmpty()) { |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1373 // Empty haystack means match all |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1374 return true; |
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1375 } |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1376 if (haystack.contains(needle)) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1377 return true; |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1378 } |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1379 if (!haystackSubstrings.isEmpty()) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1380 for (String h : haystackSubstrings) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1381 if (needle.startsWith(h)) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1382 return true; |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1383 } |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1384 } |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1385 } |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1386 return false; |
14582
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1387 } |
5fc6b8b54d82
reduced overhead of Debug.metric() and Debug.timer() when no metrics or timers are enabled
Doug Simon <doug.simon@oracle.com>
parents:
14109
diff
changeset
|
1388 |
16900
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1389 public static boolean areUnconditionalTimersEnabled() { |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1390 return enabledTimers != null; |
16900
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1391 } |
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1392 |
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1393 public static boolean areUnconditionalMetricsEnabled() { |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1394 return enabledMetrics != null; |
16900
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1395 } |
34b000f69af3
made debug value printing work if individual timers or metrics are enabled without -G:Time or -G:Meter being specified
Doug Simon <doug.simon@oracle.com>
parents:
16680
diff
changeset
|
1396 |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1397 protected static void parseMetricAndTimerSystemProperties(Set<String> metrics, Set<String> timers, Set<String> metricsSubstrings, Set<String> timersSubstrings) { |
16680
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1398 do { |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1399 try { |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1400 for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) { |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1401 String name = e.getKey().toString(); |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1402 if (name.startsWith(ENABLE_METRIC_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) { |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1403 if (name.endsWith("*")) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1404 metricsSubstrings.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length(), name.length() - 1)); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1405 } else { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1406 metrics.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length())); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1407 } |
16680
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1408 } |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1409 if (name.startsWith(ENABLE_TIMER_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) { |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1410 if (name.endsWith("*")) { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1411 timersSubstrings.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length(), name.length() - 1)); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1412 } else { |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1413 timers.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length())); |
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1414 } |
16680
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1415 } |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1416 } |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1417 return; |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1418 } catch (ConcurrentModificationException e) { |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1419 // Iterating over the system properties may race with another thread that is |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1420 // updating the system properties. Simply try again in this case. |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1421 } |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1422 } while (true); |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1423 } |
c53c0c153d73
gracefully handle ConcurrentModificationException while iterating over system properties during initialization of the Debug class
Doug Simon <doug.simon@oracle.com>
parents:
16463
diff
changeset
|
1424 |
12776
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1425 /** |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1426 * Creates a {@linkplain DebugTimer timer} that is enabled iff debugging is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1427 * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1428 * {@value #ENABLE_TIMER_PROPERTY_NAME_PREFIX} to {@code name} is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1429 * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1430 * returned timer is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1431 * conditional. |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1432 * <p> |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1433 * A disabled timer has virtually no overhead. |
a7990d87c26e
added support for unconditionally enabling a DebugTimer or DebugMetric, regardless of whether general Debug capabilities are enabled
Doug Simon <doug.simon@oracle.com>
parents:
11612
diff
changeset
|
1434 */ |
14586
d2fe05d5cc96
added support for lazy computation of names for use with Debug
Doug Simon <doug.simon@oracle.com>
parents:
14582
diff
changeset
|
1435 public static DebugTimer timer(CharSequence name) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1436 if (!areUnconditionalTimersEnabled() && !ENABLED) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1437 return VOID_TIMER; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1438 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1439 return createTimer("%s", name, null); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1440 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1441 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1442 /** |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1443 * Creates a debug timer. Invoking this method is equivalent to: |
14779 | 1444 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1445 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1446 * Debug.timer(format, arg, null) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1447 * </pre> |
14779 | 1448 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1449 * except that the string formatting only happens if timing is enabled. |
14779 | 1450 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1451 * @see #timer(String, Object, Object) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1452 */ |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1453 public static DebugTimer timer(String format, Object arg) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1454 if (!areUnconditionalTimersEnabled() && !ENABLED) { |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
1455 return VOID_TIMER; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1456 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1457 return createTimer(format, arg, null); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1458 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1459 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1460 /** |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1461 * Creates a debug timer. Invoking this method is equivalent to: |
14779 | 1462 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1463 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1464 * Debug.timer(String.format(format, arg1, arg2)) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1465 * </pre> |
14779 | 1466 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1467 * except that the string formatting only happens if timing is enabled. In addition, each |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1468 * argument is subject to the following type based conversion before being passed as an argument |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1469 * to {@link String#format(String, Object...)}: |
14779 | 1470 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1471 * <pre> |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1472 * Type | Conversion |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1473 * ------------------+----------------- |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1474 * java.lang.Class | arg.getSimpleName() |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1475 * | |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1476 * </pre> |
14779 | 1477 * |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1478 * @see #timer(CharSequence) |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1479 */ |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1480 public static DebugTimer timer(String format, Object arg1, Object arg2) { |
20016
e7e868a42b3f
avoid creation of scopes if -G:Time, -G:Meter and -G:TrackMemUse all have null or empty values and no other debug scope based options are given (e.g., -G:Log, -G:Dump, etc)
Doug Simon <doug.simon@oracle.com>
parents:
19693
diff
changeset
|
1481 if (!areUnconditionalTimersEnabled() && !ENABLED) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1482 return VOID_TIMER; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1483 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1484 return createTimer(format, arg1, arg2); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1485 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1486 |
17333
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1487 /** |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1488 * There are paths where construction of formatted class names are common and the code below is |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1489 * surprisingly expensive, so compute it once and cache it. |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1490 */ |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1491 private static final ClassValue<String> formattedClassName = new ClassValue<String>() { |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1492 @Override |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1493 protected String computeValue(Class<?> c) { |
15581
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1494 final String simpleName = c.getSimpleName(); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1495 Class<?> enclosingClass = c.getEnclosingClass(); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1496 if (enclosingClass != null) { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1497 String prefix = ""; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1498 while (enclosingClass != null) { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1499 prefix = enclosingClass.getSimpleName() + "_" + prefix; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1500 enclosingClass = enclosingClass.getEnclosingClass(); |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1501 } |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1502 return prefix + simpleName; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1503 } else { |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1504 return simpleName; |
0dc0926cf0d8
added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents:
15140
diff
changeset
|
1505 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1506 } |
17333
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1507 }; |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1508 |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1509 public static Object convertFormatArg(Object arg) { |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1510 if (arg instanceof Class) { |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1511 return formattedClassName.get((Class<?>) arg); |
fa821ca2611a
Cache converted classfile name in debug mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
17212
diff
changeset
|
1512 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1513 return arg; |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1514 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1515 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1516 private static String formatDebugName(String format, Object arg1, Object arg2) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1517 return String.format(format, convertFormatArg(arg1), convertFormatArg(arg2)); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1518 } |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1519 |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1520 private static DebugTimer createTimer(String format, Object arg1, Object arg2) { |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1521 String name = formatDebugName(format, arg1, arg2); |
17173
6c299422ba23
added support for substring matching when specifying unconditional timers and meters (e.g., -Dgraal.debug.timer.NodeClass*)
Doug Simon <doug.simon@oracle.com>
parents:
17069
diff
changeset
|
1522 boolean conditional = enabledTimers == null || !findMatch(enabledTimers, enabledTimersSubstrings, name); |
16924
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1523 if (!ENABLED && conditional) { |
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1524 return VOID_TIMER; |
29aa6f015c16
used void timer/metric implementation for conditional timers/metrics if neither -G:Time nor -G:Meter is specified
Doug Simon <doug.simon@oracle.com>
parents:
16900
diff
changeset
|
1525 } |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14586
diff
changeset
|
1526 return new TimerImpl(name, conditional); |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1527 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1528 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
1529 private static final DebugTimer VOID_TIMER = new DebugTimer() { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1530 |
19693
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19262
diff
changeset
|
1531 public DebugCloseable start() { |
fa75218e3942
Fix nested Timer and MemUse tracking logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19262
diff
changeset
|
1532 return DebugCloseable.VOID_CLOSEABLE; |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
1533 } |
11562
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1534 |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1535 public void setConditional(boolean flag) { |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1536 throw new InternalError("Cannot make void timer conditional"); |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1537 } |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1538 |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1539 public boolean isConditional() { |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1540 return false; |
6b6c6e5d0fc2
added support for DebugMetric and DebugTimer objects to be unconditionally enabled (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents:
11551
diff
changeset
|
1541 } |
12778
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1542 |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1543 public long getCurrentValue() { |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1544 return 0L; |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1545 } |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1546 |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1547 public TimeUnit getTimeUnit() { |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1548 return null; |
c125485642e2
added getCurrentValue() to both DebugTimer and DebugValue; added getTimeUnit() to DebugTimer
Doug Simon <doug.simon@oracle.com>
parents:
12776
diff
changeset
|
1549 } |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
1550 }; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1551 } |