Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java @ 22219:1c0f490984d5
Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 16 Sep 2015 15:36:22 -0700 |
parents | dc83cc1f94f2 3aad794eec0e |
children | 20380d1d41f2 |
comparison
equal
deleted
inserted
replaced
22160:0599e2df6a9f | 22219:1c0f490984d5 |
---|---|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 * or visit www.oracle.com if you need additional information or have any | 22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. | 23 * questions. |
24 */ | 24 */ |
25 package com.oracle.truffle.tools; | 25 package com.oracle.truffle.tools; |
26 | |
27 import java.io.PrintStream; | |
28 import java.util.ArrayList; | |
29 import java.util.Comparator; | |
30 import java.util.HashMap; | |
31 import java.util.List; | |
32 import java.util.Map; | |
33 import java.util.Map.Entry; | |
34 import java.util.TreeSet; | |
26 | 35 |
27 import com.oracle.truffle.api.instrument.Instrument; | 36 import com.oracle.truffle.api.instrument.Instrument; |
28 import com.oracle.truffle.api.instrument.InstrumentationTool; | 37 import com.oracle.truffle.api.instrument.InstrumentationTool; |
29 import com.oracle.truffle.api.instrument.Probe; | 38 import com.oracle.truffle.api.instrument.Probe; |
30 import com.oracle.truffle.api.instrument.ProbeListener; | 39 import com.oracle.truffle.api.instrument.ProbeListener; |
35 import com.oracle.truffle.api.instrument.impl.DefaultSimpleInstrumentListener; | 44 import com.oracle.truffle.api.instrument.impl.DefaultSimpleInstrumentListener; |
36 import com.oracle.truffle.api.nodes.Node; | 45 import com.oracle.truffle.api.nodes.Node; |
37 import com.oracle.truffle.api.source.LineLocation; | 46 import com.oracle.truffle.api.source.LineLocation; |
38 import com.oracle.truffle.api.source.Source; | 47 import com.oracle.truffle.api.source.Source; |
39 import com.oracle.truffle.api.source.SourceSection; | 48 import com.oracle.truffle.api.source.SourceSection; |
40 import java.io.PrintStream; | |
41 import java.util.ArrayList; | |
42 import java.util.Comparator; | |
43 import java.util.HashMap; | |
44 import java.util.List; | |
45 import java.util.Map; | |
46 import java.util.Map.Entry; | |
47 import java.util.TreeSet; | |
48 | 49 |
49 /** | 50 /** |
50 * An {@link InstrumentationTool} that counts interpreter <em>execution calls</em> to AST nodes that | 51 * An {@link InstrumentationTool} that counts interpreter <em>execution calls</em> to AST nodes that |
51 * hold a specified {@linkplain SyntaxTag syntax tag}, tabulated by source and line number | 52 * hold a specified {@linkplain SyntaxTag syntax tag}, tabulated by source and line number |
52 * associated with each node. Syntax tags are presumed to be applied external to the tool. If no tag | 53 * associated with each node. Syntax tags are presumed to be applied external to the tool. If no tag |
113 this.countingTag = tag; | 114 this.countingTag = tag; |
114 } | 115 } |
115 | 116 |
116 @Override | 117 @Override |
117 protected boolean internalInstall() { | 118 protected boolean internalInstall() { |
118 Probe.addProbeListener(probeListener); | 119 getInstrumenter().addProbeListener(probeListener); |
119 return true; | 120 return true; |
120 } | 121 } |
121 | 122 |
122 @Override | 123 @Override |
123 protected void internalReset() { | 124 protected void internalReset() { |
124 coverageMap.clear(); | 125 coverageMap.clear(); |
125 } | 126 } |
126 | 127 |
127 @Override | 128 @Override |
128 protected void internalDispose() { | 129 protected void internalDispose() { |
129 Probe.removeProbeListener(probeListener); | 130 getInstrumenter().removeProbeListener(probeListener); |
130 for (Instrument instrument : instruments) { | 131 for (Instrument instrument : instruments) { |
131 instrument.dispose(); | 132 instrument.dispose(); |
132 } | 133 } |
133 } | 134 } |
134 | 135 |