[svn:parrot] r41020 - in branches/pluggable_runcore: include/parrot src/runcore
cotto at svn.parrot.org
cotto at svn.parrot.org
Sat Sep 5 23:03:20 UTC 2009
Author: cotto
Date: Sat Sep 5 23:03:14 2009
New Revision: 41020
URL: https://trac.parrot.org/parrot/changeset/41020
Log:
[profiling] make all runloops visible by means of a silly hack that gives them all a fake parent context
Modified:
branches/pluggable_runcore/include/parrot/runcore_api.h
branches/pluggable_runcore/src/runcore/cores.c
Modified: branches/pluggable_runcore/include/parrot/runcore_api.h
==============================================================================
--- branches/pluggable_runcore/include/parrot/runcore_api.h Sat Sep 5 22:05:21 2009 (r41019)
+++ branches/pluggable_runcore/include/parrot/runcore_api.h Sat Sep 5 23:03:14 2009 (r41020)
@@ -40,7 +40,7 @@
typedef enum Parrot_profiling_flags {
PROFILING_EXIT_CHECK_FLAG = 1 << 0,
- PROFILING_FIRST_OP_FLAG = 1 << 1,
+ PROFILING_FIRST_LOOP_FLAG = 1 << 1,
PROFILING_HAVE_PRINTED_CLI_FLAG = 1 << 2
} Parrot_profiling_flags;
@@ -58,6 +58,7 @@
UHUGEINTVAL op_finish;
UHUGEINTVAL runcore_finish;
INTVAL profiling_flags;
+ INTVAL runloop_count;
FILE *profile_fd;
STRING *profile_filename;
PMC *prev_sub;
@@ -92,12 +93,12 @@
#define Profiling_exit_check_CLEAR(o) \
Profiling_flag_CLEAR(o, PROFILING_EXIT_CHECK_FLAG)
-#define Profiling_first_op_TEST(o) \
- Profiling_flag_TEST(o, PROFILING_FIRST_OP_FLAG)
-#define Profiling_first_op_SET(o) \
- Profiling_flag_SET(o, PROFILING_FIRST_OP_FLAG)
-#define Profiling_first_op_CLEAR(o) \
- Profiling_flag_CLEAR(o, PROFILING_FIRST_OP_FLAG)
+#define Profiling_first_loop_TEST(o) \
+ Profiling_flag_TEST(o, PROFILING_FIRST_LOOP_FLAG)
+#define Profiling_first_loop_SET(o) \
+ Profiling_flag_SET(o, PROFILING_FIRST_LOOP_FLAG)
+#define Profiling_first_loop_CLEAR(o) \
+ Profiling_flag_CLEAR(o, PROFILING_FIRST_LOOP_FLAG)
#define Profiling_have_printed_cli_TEST(o) \
Profiling_flag_TEST(o, PROFILING_HAVE_PRINTED_CLI_FLAG)
Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c Sat Sep 5 22:05:21 2009 (r41019)
+++ branches/pluggable_runcore/src/runcore/cores.c Sat Sep 5 23:03:14 2009 (r41020)
@@ -1077,9 +1077,11 @@
runcore->prev_ctx = 0;
runcore->profiling_flags = 0;
+ runcore->runloop_count = 0;
runcore->level = 0;
runcore->time_size = 32;
runcore->time = mem_allocate_n_typed(runcore->time_size, UHUGEINTVAL);
+ Profiling_first_loop_SET(runcore);
if (!runcore->profile_fd) {
fprintf(stderr, "unable to open %s for writing", profile_filename);
@@ -1088,7 +1090,6 @@
}
mem_sys_free(profile_filename);
- Profiling_first_op_SET(runcore);
return runops_profiling_core(interp, runcore, pc);
}
@@ -1160,11 +1161,15 @@
}
- if (Profiling_first_op_TEST(runcore)) {
+ if (Profiling_first_loop_TEST(runcore)) {
/* The CLI line won't reflect any options passed to the parrot binary. */
fprintf(runcore->profile_fd, "VERSION:1\n");
- Profiling_first_op_CLEAR(runcore);
+ /* silly hack to make all separate runloops appear to come from a single source */
+ fprintf(runcore->profile_fd, "CS:{ns:main}{file:no_file}{sub:0x1}{ctx:0x1}\n");
+ fprintf(runcore->profile_fd, "OP:{line:%d}{time:0}{op:noop}\n", (int) runcore->runloop_count);
+ runcore->runloop_count++;
+ Profiling_first_loop_CLEAR(runcore);
}
while (pc) {
@@ -1249,6 +1254,10 @@
/* make it easy to tell separate runloops apart */
if (runcore->level == 0) {
fprintf(runcore->profile_fd, "END_OF_RUNLOOP\n");
+ /* silly hack to make all separate runloops appear to come from a single source */
+ fprintf(runcore->profile_fd, "CS:{ns:main}{file:no_file}{sub:0x1}{ctx:0x1}\n");
+ fprintf(runcore->profile_fd, "OP:{line:%d}{time:0}{op:noop}\n", (int) runcore->runloop_count);
+ runcore->runloop_count++;
}
Profiling_exit_check_SET(runcore);
More information about the parrot-commits
mailing list