Mercurial > hg > truffle
comparison graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java @ 4346:ee5fbfca6612
more work on debug project; removed CiStatistics
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 11 Jan 2012 15:02:48 +0100 |
parents | 176d60b77d31 |
children | d49c90e641cb |
comparison
equal
deleted
inserted
replaced
4345:176d60b77d31 | 4346:ee5fbfca6612 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.max.graal.debug; | 23 package com.oracle.max.graal.debug; |
24 | 24 |
25 import java.io.*; | |
26 | |
27 | 25 |
28 public class Debug { | 26 public class Debug { |
29 public static boolean ENABLED = false; | 27 public static boolean ENABLED = false; |
30 | 28 |
31 public static void log(String msg, Object... args) { | 29 public static void log(String msg, Object... args) { |
32 if (ENABLED) { | 30 if (ENABLED) { |
33 DebugContext.getInstance().log(msg, args); | 31 DebugContext.getInstance().log(msg, args); |
34 } | 32 } |
35 } | 33 } |
36 | 34 |
37 public static Scope openScope(String name, Object... context) { | 35 public static void scope(String name, Runnable runnable, Object... context) { |
38 if (ENABLED) { | 36 if (ENABLED) { |
39 return new Scope(name, context); | 37 DebugContext.getInstance().scope(name, runnable, context); |
40 } else { | 38 } else { |
41 return VOID_SCOPE; | 39 runnable.run(); |
42 } | 40 } |
43 } | 41 } |
44 | 42 |
45 private static final Scope VOID_SCOPE = new Scope(null); | 43 private static final Scope VOID_SCOPE = new Scope(null); |
44 | |
46 | 45 |
47 public static final class Scope implements AutoCloseable { | 46 public static final class Scope implements AutoCloseable { |
48 private String name; | 47 private String name; |
49 private Object[] context; | 48 private Object[] context; |
50 | 49 |