comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/Profile.java @ 22534:1133c68332ef

Compute the isProfilingEnabled information everytime to accomodate possible change in the Truffle runtime
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Fri, 08 Jan 2016 11:51:54 +0100
parents d80a5ff56f51
children
comparison
equal deleted inserted replaced
22533:1f7fe9f4207a 22534:1133c68332ef
89 * </p> 89 * </p>
90 * 90 *
91 * @see Assumption 91 * @see Assumption
92 */ 92 */
93 public abstract class Profile extends NodeCloneable { 93 public abstract class Profile extends NodeCloneable {
94 private static final boolean ENABLED; 94 static boolean isProfilingEnabled() {
95 static {
96 boolean enabled; 95 boolean enabled;
97 try { 96 try {
98 enabled = Truffle.getRuntime().isProfilingEnabled(); 97 enabled = Truffle.getRuntime().isProfilingEnabled();
99 } catch (NoSuchMethodError ex) { 98 } catch (NoSuchMethodError ex) {
100 // running on old version of Graal 99 // running on old version of Graal
101 enabled = true; 100 enabled = true;
102 } 101 }
103 ENABLED = enabled; 102 return enabled;
104 }
105
106 static boolean isProfilingEnabled() {
107 return ENABLED;
108 } 103 }
109 104
110 Profile() { 105 Profile() {
111 /* We don't to allow custom profiles. We want to evolve this API further first. Sorry. */ 106 /* We don't to allow custom profiles. We want to evolve this API further first. Sorry. */
112 } 107 }