use of com.oracle.truffle.api.instrumentation.test.examples.StatementProfilerExample.Counter in project graal by oracle.
the class StatementProfilerExampleTest method testLoopHundreds.
@Test
public void testLoopHundreds() throws IOException {
Source source = lines(// 1
"LOOP(100", // 2
",STATEMENT(", // 3
"STATEMENT),", /**/
"STATEMENT)");
// 4
Map<SourceSection, Counter> counters = profiler.getCounters();
for (int i = 0; i < 10; i++) {
if (i == 0) {
Assert.assertTrue(counters.isEmpty());
} else {
assertLine(counters, 2, i * 100);
assertLine(counters, 3, i * 100);
assertLine(counters, 4, i * 100);
}
run(source);
}
}
use of com.oracle.truffle.api.instrumentation.test.examples.StatementProfilerExample.Counter in project graal by oracle.
the class StatementProfilerExampleTest method testStatements.
@Test
public void testStatements() throws IOException {
Source source = lines(// 1
"ROOT(", // 2
"STATEMENT(EXPRESSION", // 3
", STATEMENT),", // 4
"STATEMENT)");
Map<SourceSection, Counter> counters = profiler.getCounters();
for (int i = 0; i < 1000; i++) {
if (i == 0) {
Assert.assertTrue(counters.isEmpty());
} else {
assertLine(counters, 2, i);
assertLine(counters, 3, i);
assertLine(counters, 4, i);
}
run(source);
}
}
use of com.oracle.truffle.api.instrumentation.test.examples.StatementProfilerExample.Counter in project graal by oracle.
the class StatementProfilerExampleTest method testLoopZero.
@Test
public void testLoopZero() throws IOException {
Source source = lines(// 1
"LOOP(0", // 2
",STATEMENT(", // 3
"STATEMENT),", /**/
"STATEMENT)");
// 4
Map<SourceSection, Counter> counters = profiler.getCounters();
for (int i = 0; i < 10; i++) {
run(source);
// never actually executed
Assert.assertTrue(counters.isEmpty());
}
}
Aggregations