[svn:parrot] r40423 - branches/pluggable_runcore/src/runcore

cotto at svn.parrot.org cotto at svn.parrot.org
Thu Aug 6 02:11:34 UTC 2009


Author: cotto
Date: Thu Aug  6 02:11:32 2009
New Revision: 40423
URL: https://trac.parrot.org/parrot/changeset/40423

Log:
[prof] write info for the previous instruction rather than the next

Modified:
   branches/pluggable_runcore/src/runcore/cores.c

Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c	Wed Aug  5 12:57:03 2009	(r40422)
+++ branches/pluggable_runcore/src/runcore/cores.c	Thu Aug  6 02:11:32 2009	(r40423)
@@ -518,12 +518,13 @@
     ASSERT_ARGS(runops_profile_core)
 
     Parrot_Context_info info;
-    struct timespec preop, postop;
-    HUGEINTVAL op_time;
-    char unknown_sub[]  = "(unknown sub)";
-    char unknown_file[] = "(unknown file)";
-    static INTVAL first_init = 1;
-    FILE *prof_fd;
+    struct timespec     preop, postop;
+    opcode_t           *old_pc;
+    FILE               *prof_fd;
+    HUGEINTVAL          op_time;
+    char                unknown_sub[]  = "(unknown sub)";
+    char                unknown_file[] = "(unknown file)";
+    static INTVAL       first_init = 1;
 
     /* avoid clobbering the file from an inner runloop */
     if (first_init) {
@@ -558,6 +559,7 @@
         sub_preop  = info.subname->strstart;
 
         CONTEXT(interp)->current_pc = pc;
+        old_pc = pc;
         clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &preop);
         DO_OP(pc, interp);
         clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &postop);
@@ -574,14 +576,14 @@
         if (!sub_preop)   sub_preop   = unknown_sub;
         if (!sub_postop)  sub_postop  = unknown_sub;
 
-        if (pc) {
+        if (old_pc) {
             if (strcmp(file_preop, file_postop))
                 fprintf(prof_fd, "F:%s\n", file_postop);
             if (strcmp(sub_preop, sub_postop))
                 fprintf(prof_fd, "S:%s\n", sub_postop);
             fprintf(prof_fd, "%d:%lli:%d:%s\n",
                     info.line, op_time, (int)CONTEXT(interp)->recursion_depth,
-                    (interp->op_info_table)[*pc].name);
+                    (interp->op_info_table)[*old_pc].name);
         }
     }
 


More information about the parrot-commits mailing list