[svn:parrot] r40406 - branches/pluggable_runcore/src/runcore
cotto at svn.parrot.org
cotto at svn.parrot.org
Wed Aug 5 10:19:04 UTC 2009
Author: cotto
Date: Wed Aug 5 10:19:02 2009
New Revision: 40406
URL: https://trac.parrot.org/parrot/changeset/40406
Log:
[prof] make profiling runcore behave better with nested runloops
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 09:36:23 2009 (r40405)
+++ branches/pluggable_runcore/src/runcore/cores.c Wed Aug 5 10:19:02 2009 (r40406)
@@ -519,11 +519,20 @@
Parrot_Context_info info;
struct timespec preop, postop;
- long long op_time;
+ HUGEINTVAL op_time;
char unknown_sub[] = "(unknown sub)";
char unknown_file[] = "(unknown file)";
+ static INTVAL first_init = 1;
+ FILE *prof_fd = fopen("parrot.pprof", "a");
- FILE *prof_fd = fopen("parrot.pprof", "w");
+ /* avoid clobbering the file from an inner runloop */
+ if (first_init) {
+ prof_fd = fopen("parrot.pprof", "w");
+ first_init = 0;
+ }
+ else {
+ prof_fd = fopen("parrot.pprof", "a");
+ }
if (!prof_fd) {
fprintf(stderr, "unable to open parrot_prof.out for writing");
@@ -553,8 +562,8 @@
DO_OP(pc, interp);
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &postop);
- op_time = (postop.tv_sec * 1000000000 + postop.tv_nsec) -
- (preop.tv_sec * 1000000000 + preop.tv_nsec);
+ op_time = (postop.tv_sec * 1000*1000*1000 + postop.tv_nsec) -
+ (preop.tv_sec * 1000*1000*1000 + preop.tv_nsec);
Parrot_Context_get_info(interp, CONTEXT(interp), &info);
file_postop = info.file->strstart;
More information about the parrot-commits
mailing list