Hi Rasmus,

Rasmus Pedersen wrote:
> I would like to use the values of the variables in a method to figure
> out how many times a basic block is executed. So the question is: How
> (not if) can I find out how often a loop is executed using BCEL? Would
> it help to use final variables or something that could be read in BCEL
> at compile time???

I'm not sure if I get your problem right. I understand you want to count
the numbers of executions of a basic block during a program execution
regardless how many threads in parallel are working and regardless how
many times the method is executed. Just to sum it up, right?

I solved a similar problem by holding the supervision variables in a new
class, one instance for each method. The bytecode modification needed in
the supervised class is just a callback to the supervision object. You
can see example code for weaving in the bytecode here:

http://cvs.sourceforge.net/viewcvs.py/coverlipse/coverlipse-tool/src/de/uka/ipd/coverage/recording/ByteCodeModifyer.java?rev=1.9&view=markup


The class that holds the runtime information is this one:

http://cvs.sourceforge.net/viewcvs.py/coverlipse/coverlipse-tool/src/de/uka/ipd/coverage/recording/RegisteredMethod.java?rev=1.9&view=markup

To be able to get the statistics at the end of the execution you might
want to use Runtime.addShutdownHook().

Greetings,
Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to