[Mono-dev] Mono profiler question

Miguel de Icaza miguel at novell.com
Fri Jun 1 13:51:28 EDT 2007


Hello,

> I want to write a Mono profiler that would call C# callback when
> methods satisfying certain criteria are entered or left. In
> particular, I want to check whether a certain custom attribute is
> defined in the assembly that defines the method.

If you have the MonoMethod handle (I assume you do):

	MonoClass *k = mono_method_get_class (method);

Then you can get the image:

	MonoImage *image = mono_class_get_image (k);

And then you can use:

    MonoType *t = mono_reflection_type_from_name ("TypeName", image);

Miguel

> struct _MonoProfiler {
> MonoClass *check_for_this_attribute;
> }
> 
> void
> mono_profiler_startup
> {
> prof->check_for_this_attribute = <MonoClass for class X in namespace
> Y.Z, assembly W>
> }
> 
> Eh, how do I get that MonoClass?
> 



More information about the Mono-devel-list mailing list