[svn:parrot] r40989 - in branches/pluggable_runcore: include/parrot src/runcore
cotto at svn.parrot.org
cotto at svn.parrot.org
Sat Sep 5 06:48:18 UTC 2009
Author: cotto
Date: Sat Sep 5 06:48:16 2009
New Revision: 40989
URL: https://trac.parrot.org/parrot/changeset/40989
Log:
[profiling] make the profiling runcore smarter about when to print CS (context switch) lines
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 06:39:06 2009 (r40988)
+++ branches/pluggable_runcore/include/parrot/runcore_api.h Sat Sep 5 06:48:16 2009 (r40989)
@@ -41,8 +41,7 @@
typedef enum Parrot_profiling_flags {
PROFILING_EXIT_CHECK_FLAG = 1 << 0,
PROFILING_FIRST_OP_FLAG = 1 << 1,
- PROFILING_NEW_CONTEXT_FLAG = 1 << 2,
- PROFILING_HAVE_PRINTED_CLI_FLAG = 1 << 3
+ PROFILING_HAVE_PRINTED_CLI_FLAG = 1 << 2
} Parrot_profiling_flags;
struct profiling_runcore_t {
@@ -93,10 +92,6 @@
#define Profiling_first_op_SET(o) Profiling_flag_SET(FIRST_OP, o)
#define Profiling_first_op_CLEAR(o) Profiling_flag_CLEAR(FIRST_OP, o)
-#define Profiling_new_context_TEST(o) Profiling_flag_TEST(NEW_CONTEXT, o)
-#define Profiling_new_context_SET(o) Profiling_flag_SET(NEW_CONTEXT, o)
-#define Profiling_new_context_CLEAR(o) Profiling_flag_CLEAR(NEW_CONTEXT, o)
-
#define Profiling_have_printed_cli_TEST(o) Profiling_flag_TEST(HAVE_PRINTED_CLI, o)
#define Profiling_have_printed_cli_SET(o) Profiling_flag_SET(HAVE_PRINTED_CLI, o)
#define Profiling_have_printed_cli_CLEAR(o) Profiling_flag_CLEAR(HAVE_PRINTED_CLI, o)
Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c Sat Sep 5 06:39:06 2009 (r40988)
+++ branches/pluggable_runcore/src/runcore/cores.c Sat Sep 5 06:48:16 2009 (r40989)
@@ -1075,6 +1075,7 @@
runcore->runops = (Parrot_runcore_runops_fn_t) runops_profiling_core;
runcore->destroy = (Parrot_runcore_destroy_fn_t) destroy_profiling_core;
+ runcore->prev_ctx = 0;
runcore->profiling_flags = 0;
runcore->level = 0;
runcore->time_size = 32;
@@ -1136,16 +1137,13 @@
Parrot_Context_get_info(interp, CONTEXT(interp), &postop_info);
- /* detect if the current context has changed while entering an inner runloop */
- if (runcore->prev_ctx && runcore->prev_ctx != CONTEXT(interp))
- Profiling_new_context_SET(runcore);
- runcore->prev_ctx = CONTEXT(interp);
-
argv = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST);
if (argv && !Profiling_have_printed_cli_TEST(runcore)) {
- PMC *executable = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE);
+ /* silly way to avoid line length codingstds nit */
+ PMC *iglobals = interp->iglobals;
+ PMC *executable = VTABLE_get_pmc_keyed_int(interp, iglobals, IGLOBALS_EXECUTABLE);
STRING *command_line = Parrot_str_join(interp, CONST_STRING(interp, " "), argv);
char *exec_cstr, *command_line_cstr;
@@ -1183,6 +1181,7 @@
mem_sys_free(sub_cstr);
mem_sys_free(filename_cstr);
+ runcore->prev_ctx = CONTEXT(interp);
Profiling_first_op_CLEAR(runcore);
}
@@ -1230,11 +1229,10 @@
postop_info.line, op_time,
(interp->op_info_table)[*preop_pc].name);
- /* if current context changed during the previous op... */
- if (Profiling_new_context_TEST(runcore) || preop_sub != CONTEXT(interp)->current_sub) {
+ /* if current context changed since the last time a CS line was printed... */
+ if ((runcore->prev_ctx && runcore->prev_ctx != CONTEXT(interp))
+ || preop_sub != CONTEXT(interp)->current_sub) {
- /* if the current_sub is null, Parrot's probably done executing */
- Profiling_new_context_CLEAR(runcore);
if (CONTEXT(interp)->current_sub) {
STRING *sub_name;
char *sub_cstr, *filename_cstr, *ns_cstr;
@@ -1254,6 +1252,8 @@
mem_sys_free(filename_cstr);
mem_sys_free(ns_cstr);
}
+
+ runcore->prev_ctx = CONTEXT(interp);
}
} /* while (pc) */
More information about the parrot-commits
mailing list