|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Analysis.Counters.CounterFactory
public final class CounterFactory
CounterFactory
is a state-less instrumentation package,
with the goal of making it as easy as possible to add counters
and timers to executable code. It comes in several parts: we have
a set of routines to splice in counter/time calls into Quad forms,
and we have a post-processing HCodeFactory
available
from the codeFactory()
method that will create the
appropriate epilog code to report the counter values at
program's end.
Counters are disabled by default. All counters can be enabled by
setting the property harpoon.counters.enabled.all
to
"true"
and particular counters can be enabled by
setting the property harpoon.counters.enabled.{counter-name}
to "true"
. Particular counters can be disabled by
setting the property harpoon.counters.disabled.{counter-name}
to "true"
and all counters can be disabled by setting
the property harpoon.counters.disabled.all
to
"true"
.
Counters can also be grouped into classes by naming them with
dot-separated strings. For example, counters named 'foo.bar'
and 'foo.baz' are both enabled by setting
harpoon.counters.enabled.foo
to "true"
;
the counters' actual name on output will be "foo_bar" and "foo_baz".
Method Summary | |
---|---|
static HCodeFactory |
codeFactory(HCodeFactory parent,
Linker linker,
HMethod main)
HCodeFactory that will add calls to the counter-printing
epilog at the end of the given main method and before calls to
Runtime.exit() . |
static boolean |
inCounters(Edge e)
|
static boolean |
isEnabled(String counter_name)
Returns the enabled/disabled status of the given counter_name . |
static Edge |
spliceIncrement(QuadFactory qf,
Edge e,
String counter_name)
Increment the named counter by 1 on the given edge. |
static Edge |
spliceIncrement(QuadFactory qf,
Edge e,
String counter_name,
long value)
Increment the named counter by value on the given edge. |
static Edge |
spliceIncrement(QuadFactory qf,
Edge e,
String counter_name,
Temp Tvalue,
boolean isLong)
Increment the named counter by the amount in the Temp
Tvalue on the given edge. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isEnabled(String counter_name)
counter_name
. This can be used so that
counter-support code may be added only when the counter
it supports is actually enabled.
public static boolean inCounters(Edge e)
public static HCodeFactory codeFactory(HCodeFactory parent, Linker linker, HMethod main)
HCodeFactory
that will add calls to the counter-printing
epilog at the end of the given main method and before calls to
Runtime.exit()
.
public static Edge spliceIncrement(QuadFactory qf, Edge e, String counter_name)
public static Edge spliceIncrement(QuadFactory qf, Edge e, String counter_name, long value)
value
on the given edge.
public static Edge spliceIncrement(QuadFactory qf, Edge e, String counter_name, Temp Tvalue, boolean isLong)
Temp
Tvalue
on the given edge. If isLong
is true
, then Tvalue
should have type
long
; else it should have type int
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |