use of org.graalvm.compiler.debug.TimerKey in project graal by oracle.
the class TimerKeyTest method test2.
/**
* Asserts that a timer replied recursively without any other interleaving timers has the same
* flat and accumulated times.
*/
@Test
public void test2() {
EconomicMap<OptionKey<?>, Object> map = EconomicMap.create();
map.put(DebugOptions.Time, "");
OptionValues options = new OptionValues(map);
DebugContext debug = DebugContext.create(options, NO_DESCRIPTION, NO_GLOBAL_METRIC_VALUES, DEFAULT_LOG_STREAM, NO_CONFIG_CUSTOMIZERS);
TimerKey timerC = DebugContext.timer("TimerC");
try (DebugCloseable c1 = timerC.start(debug)) {
spin(50);
try (DebugCloseable c2 = timerC.start(debug)) {
spin(50);
try (DebugCloseable c3 = timerC.start(debug)) {
spin(50);
try (DebugCloseable c4 = timerC.start(debug)) {
spin(50);
try (DebugCloseable c5 = timerC.start(debug)) {
spin(50);
}
}
}
}
}
if (timerC.getFlat() != null) {
assertEquals(timerC.getFlat().getCurrentValue(debug), timerC.getCurrentValue(debug));
}
}
Aggregations