From 348248edb15c4370a7fca451cda2da070ad4fe46 Mon Sep 17 00:00:00 2001 From: Massimiliano Mantione Date: Fri, 10 Oct 2008 14:20:42 +0000 Subject: Add "jit time support" to the call stack. svn path=/trunk/mono-tools/; revision=115433 --- Mono.Profiler/profiler-decoder-library/ChangeLog | 4 ++ .../profiler-decoder-library/EventProcessor.cs | 3 ++ .../profiler-decoder-library/ObjectModel.cs | 43 +++++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-) (limited to 'Mono.Profiler/profiler-decoder-library') diff --git a/Mono.Profiler/profiler-decoder-library/ChangeLog b/Mono.Profiler/profiler-decoder-library/ChangeLog index 74e35833..6ff74049 100644 --- a/Mono.Profiler/profiler-decoder-library/ChangeLog +++ b/Mono.Profiler/profiler-decoder-library/ChangeLog @@ -1,3 +1,7 @@ +2008-09-17 Massimiliano Mantione + * ObjectModel.cs: Add "jit time support" to the call stack. + * EventProcessor.cs: Likewise. + 2008-08-21 Massimiliano Mantione * BaseTypes.cs: Added support for correct accounting of allocations which happened at JIT time. diff --git a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs index c3eb08ed..65c76b52 100644 --- a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs +++ b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs @@ -211,6 +211,7 @@ namespace Mono.Profiler { if (caller == null) { if ((stack != null) && (stack.StackTop != null)) { caller = stack.StackTop.Method; + jitTime = stack.StackTop.IsBeingJitted; } } c.InstanceCreated (size, caller, jitTime); @@ -228,10 +229,12 @@ namespace Mono.Profiler { public override void MethodJitStart (LoadedMethod m, ulong counter) { m.StartJit = counter; + stack.MethodJitStart (m, counter); } public override void MethodJitEnd (LoadedMethod m, ulong counter, bool success) { m.JitClicks += (counter - m.StartJit); + stack.MethodJitEnd (m, counter); } public override void MethodFreed (LoadedMethod m, ulong counter) {} diff --git a/Mono.Profiler/profiler-decoder-library/ObjectModel.cs b/Mono.Profiler/profiler-decoder-library/ObjectModel.cs index 737b5763..23a3d2b2 100644 --- a/Mono.Profiler/profiler-decoder-library/ObjectModel.cs +++ b/Mono.Profiler/profiler-decoder-library/ObjectModel.cs @@ -178,6 +178,15 @@ namespace Mono.Profiler { startCounter = value; } } + bool isBeingJitted; + public bool IsBeingJitted { + get { + return isBeingJitted; + } + internal set { + isBeingJitted = value; + } + } StackFrame caller; public StackFrame Caller { get { @@ -198,25 +207,27 @@ namespace Mono.Profiler { level = (caller != null) ? (caller.Level + 1) : 1; } - internal StackFrame (LoadedMethod method, ulong startCounter, StackFrame caller) { + internal StackFrame (LoadedMethod method, ulong startCounter, bool isBeingJitted, StackFrame caller) { this.method = method; this.startCounter = startCounter; + this.isBeingJitted = isBeingJitted; this.caller = caller; SetLevel (); } static StackFrame freeFrames = null; - internal static StackFrame FrameFactory (LoadedMethod method, ulong startCounter, StackFrame caller) { + internal static StackFrame FrameFactory (LoadedMethod method, ulong startCounter, bool isBeingJitted, StackFrame caller) { if (freeFrames != null) { StackFrame result = freeFrames; freeFrames = result.Caller; result.Method = method; result.startCounter = startCounter; + result.isBeingJitted = isBeingJitted; result.Caller = caller; result.SetLevel (); return result; } else { - return new StackFrame (method, startCounter, caller); + return new StackFrame (method, startCounter, isBeingJitted, caller); } } internal static void FreeFrame (StackFrame frame) { @@ -245,28 +256,42 @@ namespace Mono.Profiler { } } - internal void MethodEnter (LoadedMethod method, ulong counter) { - stackTop = StackFrame.FrameFactory (method, counter, stackTop); - } - internal void MethodExit (LoadedMethod method, ulong counter) { + void PopMethod (LoadedMethod method, ulong counter, bool isBeingJitted) { while (stackTop != null) { LoadedMethod topMethod = stackTop.Method; + bool topMethodIsBeingJitted = stackTop.IsBeingJitted; StackFrame callerFrame = stackTop.Caller; LoadedMethod callerMethod = (callerFrame != null)? callerFrame.Method : null; - topMethod.MethodCalled (counter - stackTop.StartCounter, callerMethod); + if (! topMethodIsBeingJitted) { + topMethod.MethodCalled (counter - stackTop.StartCounter, callerMethod); + } StackFrame.FreeFrame (stackTop); stackTop = callerFrame; - if (topMethod == method) { + if ((topMethod == method) && (topMethodIsBeingJitted == isBeingJitted)) { return; } } } + + internal void MethodEnter (LoadedMethod method, ulong counter) { + stackTop = StackFrame.FrameFactory (method, counter, false, stackTop); + } + internal void MethodExit (LoadedMethod method, ulong counter) { + PopMethod (method, counter, false); + } internal void TopMethodExit (ulong counter) { MethodExit (stackTop.Method, counter); } + internal void MethodJitStart (LoadedMethod method, ulong counter) { + stackTop = StackFrame.FrameFactory (method, counter, true, stackTop); + } + internal void MethodJitEnd (LoadedMethod method, ulong counter) { + PopMethod (method, counter, true); + } + internal CallStack (ulong threadId) { this.threadId = threadId; stackTop = null; -- cgit v1.2.3