Thanks for the tip, I'll implement it as soon as I get it working on all cases ;)
Any idea why the method doesn't get called? Until I found out, I'm currently cloning the method, clearing the current one and adding my profiling stuff there but that really sounds like a hack to me :( Thanks On Jul 13, 6:35 pm, Jb Evain <[email protected]> wrote: > On Tue, Jul 12, 2011 at 12:31 PM, Indiefreaks.com > > <[email protected]> wrote: > > .method family hidebysig virtual instance void Draw(class > > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime > > gameTime) cil managed > > { > > .maxstack 8 > > L_0000: ldsfld class > > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > > Indiefreaks.Commander.CommanderApplication::__profilerAttribute132 > > L_0005: ldarg.0 > > L_0006: call class [mscorlib]System.Reflection.MethodBase > > [mscorlib]System.Reflection.MethodBase::GetCurrentMethod() > > L_000b: castclass [mscorlib]System.Reflection.MethodInfo > > Gotta love being lectured about performance of method calls (sigh) > just to see this. > > For information, you can do: > > ldtoken drawMethodDefinition > call MethodBase::GetMethodFromHandle(System.RuntimeMethodHandle) > > Bang! > > On my machine, calling GetCurrentMethod a million times takes 2.6s. > Doing the GetMethodFromHandle trick a million times takes 0.5s. > > Here, I just saved you enough time to call a few methods. > > Jb -- -- mono-cecil
