[kaffe] profiling in sparc

Dalibor Topic robilad at yahoo.com
Tue Jul 16 07:48:07 PDT 2002


--- Srinivas Reddy <srinivas_reddy_b at yahoo.com> wrote:
> Hi,
> 	I'm Srinivas. I have been going thro the kaffe code
> for about two months now.I have a problem, for which
> i
> need help.
> 	As you all know, kaffe profiler works on linux
> platform. But I guess i need to port it to
> sparc-solaris.
> 	Actually, I want to have a count on the number of
> times a method, or a variable in a class is being
> read
> from, and written to. Say, if i have two classes A
> and
> B, each having methods C and D, and variables E and
> F,
> then I want to print the statistics as follows:
> 
>  Class A
>     Method C       'frequency'
>     Method D       'frequency'
>     Variable E     'frequency'
>     Variable F     'frequency'
> 
>  Class B
>     Method C       'frequency'
>     Method D       'frequency'
>     Variable E     'frequency'
>     Variable F     'frequency'
> 

Well, you can't really write to a method ;)

For methods: kaffe -verbosecall and then sort and
write a perl script to get the numbers.

For fields: the easiest way (I think, I haven't done
it myself) would be to write your own classloader that
modifies classes when they are loaded to add static
and private fields to each loaded class like 

private static long variable_f_frequency;
 
to count accesses to fields, instrumenting each
invocation of getfield, putfield etc. to increase the
counter.

You can do that using bytecode engineering toolkits
like jakarta BCEL, or jode (both run with kaffe), or
some other bytecode toolkit, there seem to be many.

You could instrument method invocation bytecodes in a
a similar fashion.

That way, your "profiling" code would actually work
with other VMs, too, and without having to patch kaffe
(except for the class loader code to invoke your class
loader).

best regards,

dalibor topic

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




More information about the kaffe mailing list