Mercurial > hg > truffle
annotate graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java @ 11551:63b4694d3627
split DebugHistogram printing out into separate service
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 09 Sep 2013 13:57:53 +0200 |
parents | d7d12ef788ba |
children | 6b6c6e5d0fc2 |
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 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.debug; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
25 import com.oracle.graal.debug.internal.*; |
5302
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
26 |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
27 import java.io.*; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
28 import java.util.*; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
29 import java.util.concurrent.*; |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
30 |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
31 public class Debug { |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
33 private static boolean ENABLED = false; |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
34 |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
35 public static void enable() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
36 ENABLED = true; |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
37 } |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
39 public static void disable() { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
40 ENABLED = false; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
41 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
42 |
4369
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
43 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
|
44 return ENABLED; |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
45 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4363
diff
changeset
|
46 |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
47 public static boolean isDumpEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
48 return ENABLED && DebugScope.getInstance().isDumpEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
49 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
50 |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
51 public static boolean isMeterEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
52 return ENABLED && DebugScope.getInstance().isMeterEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
53 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
54 |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
55 public static boolean isTimeEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
56 return ENABLED && DebugScope.getInstance().isTimeEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
57 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
58 |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
59 public static boolean isLogEnabled() { |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
60 return ENABLED && DebugScope.getInstance().isLogEnabled(); |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
61 } |
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
62 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
63 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
64 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
|
65 return runnable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
66 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
67 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
68 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
69 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
|
70 return callable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
71 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
72 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
73 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
74 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
|
75 return runnable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
76 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
77 |
5159
24c77ad284dc
fixed Eclipse compiler warnings about unused parameters
Doug Simon <doug.simon@oracle.com>
parents:
5137
diff
changeset
|
78 @SuppressWarnings("unused") |
5137
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
79 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
|
80 return callable; |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
81 } |
09f66048738e
Added new decorate methods to the Debug class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5061
diff
changeset
|
82 |
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
|
83 public static void sandbox(String name, DebugConfig config, Runnable runnable) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
84 if (ENABLED) { |
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
|
85 DebugScope.getInstance().scope(name, runnable, null, true, config, new Object[0]); |
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
|
86 } else { |
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
|
87 runnable.run(); |
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
|
88 } |
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
|
89 } |
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
|
90 |
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
|
91 /** |
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
|
92 * Creates a new debug scope that is unrelated to the current scope and runs a given task in the |
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
|
93 * new scope. |
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
|
94 * |
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
|
95 * @param name new scope name |
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
|
96 * @param context the context objects of the new scope |
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
|
97 * @param config the debug configuration to use for the new scope |
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
|
98 * @param runnable the task to run in the new scope |
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
|
99 */ |
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
|
100 public static void sandbox(String name, Object[] context, DebugConfig config, Runnable runnable) { |
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
|
101 if (ENABLED) { |
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
|
102 DebugScope.getInstance().scope(name, runnable, null, true, config, context); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
103 } else { |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
104 runnable.run(); |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
105 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
106 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
107 |
10611
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
108 /** |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
109 * Creates a new debug scope that is unrelated to the current scope and runs a given task in the |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
110 * new scope. |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
111 * |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
112 * @param name new scope name |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
113 * @param context the context objects of the new scope |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
114 * @param config the debug configuration to use for the new scope |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
115 * @param callable the task to run in the new scope |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
116 */ |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
117 public static <T> T sandbox(String name, Object[] context, DebugConfig config, Callable<T> callable) { |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
118 if (ENABLED) { |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
119 return DebugScope.getInstance().scope(name, null, callable, true, config, context); |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
120 } else { |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
121 return DebugScope.call(callable); |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
122 } |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
123 } |
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9199
diff
changeset
|
124 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
125 public static void scope(String name, Runnable runnable) { |
5009
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
126 scope(name, new Object[0], runnable); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
127 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
128 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
129 public static <T> T scope(String name, Callable<T> callable) { |
5009
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
130 return scope(name, new Object[0], callable); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
131 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
132 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
133 public static void scope(String name, Object context, Runnable runnable) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
134 scope(name, new Object[]{context}, runnable); |
5009
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
135 } |
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
136 |
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
137 public static void scope(String name, Object[] context, Runnable runnable) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
138 if (ENABLED) { |
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
|
139 DebugScope.getInstance().scope(name, runnable, null, false, null, context); |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 } else { |
4346
ee5fbfca6612
more work on debug project; removed CiStatistics
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4345
diff
changeset
|
141 runnable.run(); |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
145 public static String currentScope() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
146 if (ENABLED) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
147 return DebugScope.getInstance().getQualifiedName(); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
148 } else { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
149 return ""; |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
150 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
151 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
152 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
153 public static <T> T scope(String name, Object context, Callable<T> callable) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
154 return scope(name, new Object[]{context}, callable); |
5009
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
155 } |
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
156 |
e3cc0d407bc6
Allow Debug context with multiple objects
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4579
diff
changeset
|
157 public static <T> T scope(String name, Object[] context, Callable<T> callable) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
158 if (ENABLED) { |
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
|
159 return DebugScope.getInstance().scope(name, null, callable, false, null, context); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
160 } else { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
161 return DebugScope.call(callable); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
162 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
163 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
164 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
165 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
166 * Prints an indented message to the current DebugLevel's logging stream if logging is enabled. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
167 * |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
168 * @param msg The format string of the log message |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
169 * @param args The arguments referenced by the log message string |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
170 * @see Indent#log |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
171 */ |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
172 public static void log(String msg, Object... args) { |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
173 if (ENABLED) { |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
174 DebugScope.getInstance().log(msg, args); |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
175 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
176 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
177 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
178 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
179 * The same as {@link #log}, but without line termination and without indentation. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
180 */ |
10923 | 181 public static void printf(String msg, Object... args) { |
182 if (ENABLED && DebugScope.getInstance().isLogEnabled()) { | |
183 DebugScope.getInstance().printf(msg, args); | |
184 } | |
185 } | |
186 | |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
187 public static void dump(Object object, String msg, Object... args) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
188 if (ENABLED && DebugScope.getInstance().isDumpEnabled()) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
189 DebugScope.getInstance().dump(object, msg, args); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
190 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
191 } |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
192 |
11382
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
193 private static final class NoLogger implements Indent { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
194 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
195 @Override |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
196 public void log(String msg, Object... args) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
197 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
198 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
199 @Override |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
200 public void setEnabled(boolean enabled) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
201 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
202 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
203 @Override |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
204 public Indent indent() { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
205 return this; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
206 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
207 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
208 @Override |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
209 public Indent logIndent(String msg, Object... args) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
210 return this; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
211 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
212 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
213 @Override |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
214 public Indent outdent() { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
215 return this; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
216 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
217 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
218 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
219 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
220 private static final NoLogger noLoggerInstance = new NoLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
221 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
222 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
223 * Creates a new indentation level (by adding some spaces) based on the last used Indent of the |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
224 * current DebugScope. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
225 * |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
226 * @return The new indentation level |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
227 * @see Indent#indent |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
228 */ |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
229 public static Indent indent() { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
230 if (ENABLED) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
231 DebugScope scope = DebugScope.getInstance(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
232 return scope.pushIndentLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
233 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
234 return noLoggerInstance; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
235 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
236 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
237 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
238 * Creates a new indentation level based on the last used Indent of the current DebugScope and |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
239 * turns on/off logging. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
240 * |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
241 * @param enabled If true, logging is enabled, otherwise disabled |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
242 * @return The new indentation level |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
243 */ |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
244 public static Indent indent(boolean enabled) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
245 if (ENABLED) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
246 Indent logger = DebugScope.getInstance().pushIndentLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
247 logger.setEnabled(enabled); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
248 return logger; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
249 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
250 return noLoggerInstance; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
251 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
252 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
253 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
254 * A convenience function which combines {@link #log} and {@link #indent()}. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
255 * |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
256 * @param msg The format string of the log message |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
257 * @param args The arguments referenced by the log message string |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
258 * @return The new indentation level |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
259 * @see Indent#logIndent |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
260 */ |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
261 public static Indent logIndent(String msg, Object... args) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
262 if (ENABLED) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
263 DebugScope scope = DebugScope.getInstance(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
264 scope.log(msg, args); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
265 return scope.pushIndentLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
266 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
267 return noLoggerInstance; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
268 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
269 |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
270 /** |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
271 * A convenience function which combines {@link #log} and {@link #indent(boolean)}. |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
272 * |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
273 * @param enabled If true, logging is enabled, otherwise disabled |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
274 * @param msg The format string of the log message |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
275 * @param args The arguments referenced by the log message string |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
276 * @return The new indentation level |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
277 */ |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
278 public static Indent logIndent(boolean enabled, String msg, Object... args) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
279 if (ENABLED) { |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
280 DebugScope scope = DebugScope.getInstance(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
281 boolean saveLogEnabled = scope.isLogEnabled(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
282 scope.setLogEnabled(enabled); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
283 scope.log(msg, args); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
284 scope.setLogEnabled(saveLogEnabled); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
285 Indent indent = scope.pushIndentLogger(); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
286 indent.setEnabled(enabled); |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
287 return indent; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
288 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
289 return noLoggerInstance; |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
290 } |
d7d12ef788ba
add logging with indentation in graal.Debug
Erik Eckstein <erik.eckstein@oracle.com>
parents:
10923
diff
changeset
|
291 |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
292 public static Iterable<Object> context() { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
293 if (ENABLED) { |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
294 return DebugScope.getInstance().getCurrentContext(); |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
295 } else { |
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4349
diff
changeset
|
296 return Collections.emptyList(); |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
297 } |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
298 } |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
300 @SuppressWarnings("unchecked") |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
301 public static <T> List<T> contextSnapshot(Class<T> clazz) { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
302 if (ENABLED) { |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
303 List<T> result = new ArrayList<>(); |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
304 for (Object o : context()) { |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
305 if (clazz.isInstance(o)) { |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
306 result.add((T) o); |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
307 } |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
308 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
309 return result; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
310 } else { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
311 return Collections.emptyList(); |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
312 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
313 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
314 |
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
|
315 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
316 * 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
|
317 * 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
|
318 */ |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
319 @SuppressWarnings("unchecked") |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
320 public static <T> T contextLookup(Class<T> clazz) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
321 if (ENABLED) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
322 for (Object o : context()) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
323 if (clazz.isInstance(o)) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
324 return ((T) o); |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
325 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
326 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
327 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
328 return null; |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
329 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
330 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
331 public static DebugMetric metric(String name) { |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4394
diff
changeset
|
332 if (ENABLED) { |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
333 return new MetricImpl(name); |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
334 } else { |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
335 return VOID_METRIC; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
336 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
337 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
338 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
339 public static void setConfig(DebugConfig config) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
340 if (ENABLED) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
341 DebugScope.getInstance().setConfig(config); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
342 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
343 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4356
diff
changeset
|
344 |
11551
63b4694d3627
split DebugHistogram printing out into separate service
Doug Simon <doug.simon@oracle.com>
parents:
11382
diff
changeset
|
345 /** |
63b4694d3627
split DebugHistogram printing out into separate service
Doug Simon <doug.simon@oracle.com>
parents:
11382
diff
changeset
|
346 * 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
|
347 */ |
9103
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
348 public static DebugHistogram createHistogram(String name) { |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
349 return new DebugHistogramImpl(name); |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
350 } |
e7541d478e38
Added DebugHistory utility and corresponding unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7557
diff
changeset
|
351 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
352 public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6584
diff
changeset
|
353 final Collection<DebugDumpHandler> dumpHandlers, final PrintStream output) { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
354 return new DebugConfig() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
355 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
356 @Override |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
357 public boolean isLogEnabled() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
358 return isLogEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
359 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
360 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
361 @Override |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
362 public boolean isMeterEnabled() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
363 return isMeterEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
364 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
365 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
366 @Override |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
367 public boolean isDumpEnabled() { |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
368 return isDumpEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
369 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
370 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
371 @Override |
4394
cf609017d3d4
Fixed warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4369
diff
changeset
|
372 public boolean isTimeEnabled() { |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
373 return isTimerEnabled; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
374 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
375 |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
376 @Override |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
377 public RuntimeException interceptException(Throwable e) { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
378 return null; |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
379 } |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
380 |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
381 @Override |
6584
a3eb814ea564
added more javadoc to DebugConfig interface
Doug Simon <doug.simon@oracle.com>
parents:
5620
diff
changeset
|
382 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
|
383 return dumpHandlers; |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4361
diff
changeset
|
384 } |
5302
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
385 |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
386 @Override |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
387 public PrintStream output() { |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
388 return output; |
55bf72fafc41
(preliminary) logging to file (-G:LogFile=asdf.txt)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5251
diff
changeset
|
389 } |
5620
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
390 |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
391 @Override |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
392 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
|
393 } |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
394 |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
395 @Override |
2a44192a8b24
added support for extending the filtering context of a DebugConfig
Doug Simon <doug.simon@oracle.com>
parents:
5302
diff
changeset
|
396 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
|
397 } |
4361
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
398 }; |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
399 } |
18b52fec79f1
Completed exception interception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4357
diff
changeset
|
400 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
401 private static final DebugMetric VOID_METRIC = new DebugMetric() { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
402 |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
403 public void increment() { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
404 } |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
405 |
7557
db90c8b5a861
changed DebugMetric.add() to take a long parameter instead of an int
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
406 public void add(long value) { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
407 } |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
408 }; |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
409 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
410 public static DebugTimer timer(String name) { |
4406
961895157a38
Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4394
diff
changeset
|
411 if (ENABLED) { |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
412 return new TimerImpl(name); |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
413 } else { |
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
414 return VOID_TIMER; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 } |
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 |
4356
249752adcb8d
Rename Timer DebugTimer and Metric DebugMetric.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
418 private static final DebugTimer VOID_TIMER = new DebugTimer() { |
4477
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
419 |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
420 public TimerCloseable start() { |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
421 return TimerImpl.VOID_CLOSEABLE; |
27c5466afd55
Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
422 } |
4349
7e974a026889
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4348
diff
changeset
|
423 }; |
4343
f03c71a0aeb8
Added draft debug classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 } |