comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java @ 20893:263ab98b3bf0

Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Fri, 10 Apr 2015 21:14:14 -0700
parents 73b1844b5b14
children
comparison
equal deleted inserted replaced
20892:73b1844b5b14 20893:263ab98b3bf0
178 // Check instrumentation with the simplest kind of counters. 178 // Check instrumentation with the simplest kind of counters.
179 // They should all be removed when the check is finished. 179 // They should all be removed when the check is finished.
180 checkCounters(probe, callTarget, rootNode, new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter()); 180 checkCounters(probe, callTarget, rootNode, new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter());
181 181
182 // Now try with the more complex flavor of listener 182 // Now try with the more complex flavor of listener
183 checkCounters(probe, callTarget, rootNode, new TestASTInstrumentCounter(), new TestASTInstrumentCounter(), new TestASTInstrumentCounter()); 183 checkCounters(probe, callTarget, rootNode, new TestStandardInstrumentCounter(), new TestStandardInstrumentCounter(), new TestStandardInstrumentCounter());
184 } 184 }
185 185
186 private static void checkCounters(Probe probe, CallTarget callTarget, RootNode rootNode, TestCounter counterA, TestCounter counterB, TestCounter counterC) { 186 private static void checkCounters(Probe probe, CallTarget callTarget, RootNode rootNode, TestCounter counterA, TestCounter counterB, TestCounter counterC) {
187 187
188 // Attach a counting instrument to the probe 188 // Attach a counting instrument to the probe
403 } 403 }
404 404
405 /** 405 /**
406 * A counter for the number of times execution enters and leaves a probed AST node. 406 * A counter for the number of times execution enters and leaves a probed AST node.
407 */ 407 */
408 private class TestASTInstrumentCounter implements TestCounter { 408 private class TestStandardInstrumentCounter implements TestCounter {
409 409
410 public int enterCount = 0; 410 public int enterCount = 0;
411 public int leaveCount = 0; 411 public int leaveCount = 0;
412 public final Instrument instrument; 412 public final Instrument instrument;
413 413
414 public TestASTInstrumentCounter() { 414 public TestStandardInstrumentCounter() {
415 this.instrument = Instrument.create(new ASTInstrumentListener() { 415 this.instrument = Instrument.create(new StandardInstrumentListener() {
416 416
417 public void enter(Probe probe, Node node, VirtualFrame vFrame) { 417 public void enter(Probe probe, Node node, VirtualFrame vFrame) {
418 enterCount++; 418 enterCount++;
419 } 419 }
420 420
496 } 496 }
497 497
498 /** 498 /**
499 * Counts the number of "enter" events at probed nodes using the AST listener. 499 * Counts the number of "enter" events at probed nodes using the AST listener.
500 */ 500 */
501 static final class TestASTInstrumentListener extends DefaultASTInstrumentListener { 501 static final class TestASTInstrumentListener extends DefaultStandardInstrumentListener {
502 502
503 public int counter = 0; 503 public int counter = 0;
504 504
505 @Override 505 @Override
506 public void enter(Probe probe, Node node, VirtualFrame vFrame) { 506 public void enter(Probe probe, Node node, VirtualFrame vFrame) {