dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ./README.profiling engine/ilrun.c engine/c...


From: Marc Haisenko
Subject: [dotgnu-pnet-commits] pnet ./README.profiling engine/ilrun.c engine/c...
Date: Fri, 23 Dec 2005 15:11:11 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Branch:         
Changes by:     Marc Haisenko <address@hidden>  05/12/23 15:11:11

Modified files:
        .              : README.profiling 
        engine         : ilrun.c cvm_call.c 

Log message:
        - changed behaviour of the enhanced profiler (see README.profiling): if 
the
        enhanced profiler is used then don't count the method calls when 
profiling
        is not enabled (with -E or DotGNU.Misc.Profiling.StartProfiling ())
        - fix in time measurement (in cvm_call.c:VMCASE(COP_RETURN), credits go 
to
        Tim Nichols <address@hidden> for this fix... he actually sent it to me
        two months ago *blush*)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/README.profiling.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/ilrun.c.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/cvm_call.c.diff?tr1=1.91&tr2=1.92&r1=text&r2=text

Patches:
Index: pnet/README.profiling
diff -u pnet/README.profiling:1.2 pnet/README.profiling:1.3
--- pnet/README.profiling:1.2   Thu Oct 27 08:07:06 2005
+++ pnet/README.profiling       Fri Dec 23 15:11:11 2005
@@ -10,6 +10,20 @@
 exits.
 
 
+DIFFERENCES BETWEEN THE NORMAL AND ENHANCED PROFILER
+===============================================================================
+
+The normal profiler is enabled with -M and simply counts the number of times a
+method is called and prints those numbers on exit.
+
+For the enhanced profiler to work -M is not enough: -M activates the profiling
+support BUT IT DOES NOT ENABLE IT ! You have to either activate it with the -E
+commandline switch or with the DotGNU.Misc.Profiling class (see below).
+
+The enhanced profiler not only counts the number of times a method is called
+but also how much time was spent in the method (total and average).
+
+
 HOW TO ENABLE THE ENHANCED PROFILER (COMPILE-TIME)
 ===============================================================================
 
@@ -65,9 +79,15 @@
 WHY DIDN'T THE PROFILER MEASURE ANY TIMES ?
 ===============================================================================
 
-If all entries show "0" in the total time and average time columns you've most
-likely forgotten to either use the "-E" option to "ilrun" or didn't use the
-DotGNU.Misc.Profiling class.
+If you get the error message:
+
+ilrun: method profiles are not available (forgot -E or enabling profiling at
+runtime ?)
+
+you have either not used the -E commandline switch to activate the enhanced
+profiler or haven't activated it via the Profiling class, depending on how you
+wanted to profile. Maybe you've included calls to Profiling.StartProfiling ()
+but in that particular run your code didn't reach it ?
 
 
 HOW TO USE THE DotGNU.Misc.Profiling CLASS
@@ -87,7 +107,7 @@
 
  * void StopProfiling (): tell the profiler to stop collecting data.
 
-Note that when using the DotGNU.Misc.Profiling class, you'll get weird times
-for the DotGNU.Misc.Profiling.StartProfiling method. This is normal and can be
-ignored.
+Note that when using the DotGNU.Misc.Profiling class, you'll sometimes get
+weird times for the DotGNU.Misc.Profiling.StartProfiling method. This is normal
+and can be ignored.
 
Index: pnet/engine/cvm_call.c
diff -u pnet/engine/cvm_call.c:1.91 pnet/engine/cvm_call.c:1.92
--- pnet/engine/cvm_call.c:1.91 Mon Nov 21 14:31:16 2005
+++ pnet/engine/cvm_call.c      Fri Dec 23 15:11:11 2005
@@ -65,7 +65,7 @@
  *
  * These macros get called whenever a function gets called and when it is left,
  * respectivly. They record the time a function needed to execute INCLUDING
- * CHILD FUNCTIONS. It's very dump and simple but better than no time profiling
+ * CHILD FUNCTIONS. It's very dumb and simple but better than no time profiling
  * at all ;-)
  */
 #define DO_PROFILE_START() \
@@ -1243,9 +1243,10 @@
 
        CHECK_MANAGED_BARRIER();
        
-       DO_PROFILE_STOP();
-
        callFrame = &(thread->frameStack[--(thread->numFrames)]);
+
+       DO_PROFILE_STOP();
+       
        methodToCall = callFrame->method;
        pc = callFrame->pc;
        thread->exceptHeight = callFrame->exceptHeight;
@@ -2071,7 +2072,18 @@
  */
 VMCASE(COP_PREFIX_PROFILE_COUNT):
 {
-       ILInterlockedIncrement(&method->count);
+#ifdef ENHANCED_PROFILER
+       /* If the enhanced profiler is selected then don't count when
+        * profiling is disabled
+        * (e.g. via DotGNU.Misc.Profiling.StopProfiling())
+        */
+       if ((thread->profilingEnabled) && ((ILCoderGetFlags 
(thread->process->coder) & IL_CODER_FLAG_METHOD_PROFILE) != 0))
+       {
+#endif
+               ILInterlockedIncrement(&method->count);
+#ifdef ENHANCED_PROFILER
+       }
+#endif
        MODIFY_PC_AND_STACK(CVMP_LEN_NONE,0);
 }
 VMBREAK(COP_PREFIX_PROFILE_COUNT);
Index: pnet/engine/ilrun.c
diff -u pnet/engine/ilrun.c:1.51 pnet/engine/ilrun.c:1.52
--- pnet/engine/ilrun.c:1.51    Thu May  5 10:16:16 2005
+++ pnet/engine/ilrun.c Fri Dec 23 15:11:11 2005
@@ -565,8 +565,15 @@
        {
                if(!_ILDumpMethodProfile(stdout, process))
                {
-                       fprintf(stderr, "%s: method profiles are not 
available\n",
-                                       progname);
+                       fprintf(stderr, "%s: method profiles are not 
available%s\n",
+                                       progname,
+#ifdef ENHANCED_PROFILER
+                                       profilingEnabled ? "" : " (forgot -E or 
enabling profiling at runtime ?)"
+#else
+                                       ""
+#endif
+
+                                       );
                }
        }
        if(dumpVarProfile)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]