Package org.eclipse.steady.java.monitor
Class InstrumentationControl
- java.lang.Object
-
- org.eclipse.steady.java.monitor.InstrumentationControl
-
public class InstrumentationControl extends Object
Controls whether or not a given Java class is instrumented. To that end, it uses a couple of blacklists and whitelists read from the configuration. Moreover, it maintains statistics to report on the overall number of classes and constructs instrumented.- See Also:
DynamicTransformer,JarAnalyzer,WarAnalyzer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInstrumentationControl.InstrumentationMetrics
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountClassesInstrumentedAlready()Returns the number of classes that were already instrumented.intcountClassesInstrumentedFailure()Returns the number of classes that could not be instrumented.intcountClassesInstrumentedSuccess()Returns the number of classes that were successfully instrumented.intcountClassesTotal()Returns the total number of classes looked at.Set<JavaId>getFailedInstrumentations()Returns the classes which could not be instrumented, hence, for which no traces or other information could be collected.static InstrumentationControlgetInstance()getInstance.static InstrumentationControlgetInstance(Object _context)getInstance.longgetMetric(InstrumentationControl.InstrumentationMetrics _metric)getMetric.static Map<String,Long>getOverallStatistics()getOverallStatistics.Map<InstrumentationControl.InstrumentationMetrics,Long>getStatistics()getStatistics.booleanisBlacklistedClass(String _qname)Returns true if the class with the specified qualified name is blacklisted, false otherwise.booleanisBlacklistedJar(URL _url)Returns true if the JAR at the specified path is blacklisted, false otherwise.static voidlogOverallStatistics()logOverallStatistics.voidlogStatistics()Logs various statistics, depending on the log level.voidupdateInstrumentationStatistics(JavaId _jcid, Boolean _instr_successful)Updates the statistics depending on whether the instrumentation of the given Java class succeeded or not.
-
-
-
Method Detail
-
updateInstrumentationStatistics
public void updateInstrumentationStatistics(JavaId _jcid, Boolean _instr_successful)
Updates the statistics depending on whether the instrumentation of the given Java class succeeded or not.- Parameters:
_jcid- the class that was instrumented successfully or not_instr_successful- null if the class was already instrumented, or true/false if the instrumentation was done in this transformer
-
logStatistics
public void logStatistics()
Logs various statistics, depending on the log level. Called byUploadScheduler.run().
-
getMetric
public long getMetric(InstrumentationControl.InstrumentationMetrics _metric)
getMetric.
- Parameters:
_metric- aInstrumentationControl.InstrumentationMetricsobject.- Returns:
- a long.
-
getStatistics
public Map<InstrumentationControl.InstrumentationMetrics,Long> getStatistics()
getStatistics.
- Returns:
- a
Mapobject.
-
isBlacklistedJar
public boolean isBlacklistedJar(URL _url)
Returns true if the JAR at the specified path is blacklisted, false otherwise. A JAR is blacklisted if the file name matches any of the patterns specified with configuration parameter instr.blacklist.jars, or if it resides in a directory (or subdirectory) of any of the paths specified with instr.blacklist.dirs.- Parameters:
_url- aURLobject.- Returns:
- a boolean.
-
isBlacklistedClass
public boolean isBlacklistedClass(String _qname)
Returns true if the class with the specified qualified name is blacklisted, false otherwise. A qualified name is blacklisted if its package (or any of its parent packages) is specified as part of the configuration parameters instr.blacklist.classes.jre or instr.blacklist.classes.custom.- Parameters:
_qname- aStringobject.- Returns:
- a boolean.
-
countClassesTotal
public int countClassesTotal()
Returns the total number of classes looked at.- Returns:
- a int.
-
countClassesInstrumentedAlready
public int countClassesInstrumentedAlready()
Returns the number of classes that were already instrumented.- Returns:
- a int.
- See Also:
updateInstrumentationStatistics(JavaId, Boolean)
-
countClassesInstrumentedSuccess
public int countClassesInstrumentedSuccess()
Returns the number of classes that were successfully instrumented.- Returns:
- a int.
- See Also:
updateInstrumentationStatistics(JavaId, Boolean)
-
countClassesInstrumentedFailure
public int countClassesInstrumentedFailure()
Returns the number of classes that could not be instrumented.- Returns:
- a int.
- See Also:
updateInstrumentationStatistics(JavaId, Boolean)
-
getFailedInstrumentations
public Set<JavaId> getFailedInstrumentations()
Returns the classes which could not be instrumented, hence, for which no traces or other information could be collected.- Returns:
- a
Setobject.
-
getInstance
public static InstrumentationControl getInstance()
getInstance.
- Returns:
- a
InstrumentationControlobject.
-
getInstance
public static InstrumentationControl getInstance(Object _context)
getInstance.
- Parameters:
_context- aObjectobject.- Returns:
- a
InstrumentationControlobject.
-
getOverallStatistics
public static Map<String,Long> getOverallStatistics()
getOverallStatistics.
- Returns:
- a
Mapobject.
-
logOverallStatistics
public static void logOverallStatistics()
logOverallStatistics.
-
-