[svn:parrot] r40583 - in branches/pluggable_runcore: include/parrot src src/gc src/interp

cotto at svn.parrot.org cotto at svn.parrot.org
Sun Aug 16 06:31:47 UTC 2009


Author: cotto
Date: Sun Aug 16 06:31:46 2009
New Revision: 40583
URL: https://trac.parrot.org/parrot/changeset/40583

Log:
[profiling] remove some structs (and assoc code) used by the old and busted profiling runcore

Modified:
   branches/pluggable_runcore/include/parrot/interpreter.h
   branches/pluggable_runcore/src/embed.c
   branches/pluggable_runcore/src/exceptions.c
   branches/pluggable_runcore/src/gc/alloc_resources.c
   branches/pluggable_runcore/src/gc/gc_ms.c
   branches/pluggable_runcore/src/gc/gc_private.h
   branches/pluggable_runcore/src/gc/incremental_ms.c
   branches/pluggable_runcore/src/gc/mark_sweep.c
   branches/pluggable_runcore/src/interp/inter_create.c

Modified: branches/pluggable_runcore/include/parrot/interpreter.h
==============================================================================
--- branches/pluggable_runcore/include/parrot/interpreter.h	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/include/parrot/interpreter.h	Sun Aug 16 06:31:46 2009	(r40583)
@@ -146,33 +146,6 @@
     Warnings_classes classes;
 } *Warnings;
 
-/* ProfData have these extra items in front followed by
- * one entry per op at (op + extra) */
-
-typedef enum {
-     PARROT_PROF_GC_p1,        /* pass 1 mark root set */
-     PARROT_PROF_GC_p2,        /* pass 2 mark next_for_GC */
-     PARROT_PROF_GC_cp,        /* collect PMCs */
-     PARROT_PROF_GC_cb,        /* collect buffers */
-     PARROT_PROF_GC,
-     PARROT_PROF_EXCEPTION,
-     PARROT_PROF_EXTRA
-} profile_extra_enum;
-
-/* data[op_count] is time spent for exception handling */
-typedef struct ProfData {
-    int op;
-    UINTVAL numcalls;
-    FLOATVAL time;
-} ProfData;
-
-typedef struct _RunProfile {
-    FLOATVAL starttime;
-    FLOATVAL gc_time;
-    opcode_t cur_op;
-    ProfData *data;
-} RunProfile;
-
 /* Forward declaration for imc_info_t -- the actual struct is
  * defined in imcc/imc.h */
 struct _imc_info_t;
@@ -344,9 +317,6 @@
     struct runcore_t **cores;                 /* array of known runcores */
     UINTVAL            num_cores;             /* number of known runcores */
 
-    /* TODO profile per code segment or global */
-    RunProfile *profile;                      /* profile counters */
-
     INTVAL resume_flag;
     size_t resume_offset;
 

Modified: branches/pluggable_runcore/src/embed.c
==============================================================================
--- branches/pluggable_runcore/src/embed.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/embed.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -42,10 +42,6 @@
 static void print_debug(PARROT_INTERP, SHIM(int status), SHIM(void *p))
         __attribute__nonnull__(1);
 
-static int prof_sort_f(ARGIN(const void *a), ARGIN(const void *b))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 PARROT_CANNOT_RETURN_NULL
 static PMC* set_current_sub(PARROT_INTERP)
         __attribute__nonnull__(1);
@@ -61,9 +57,6 @@
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_print_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_prof_sort_f __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(a) \
-    || PARROT_ASSERT_ARG(b)
 #define ASSERT_ARGS_set_current_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_setup_argv __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -691,33 +684,6 @@
 
 /*
 
-=item C<static int prof_sort_f(const void *a, const void *b)>
-
-Sort function for profile data, by time.
-
-=cut
-
-*/
-
-static int
-prof_sort_f(ARGIN(const void *a), ARGIN(const void *b))
-{
-    ASSERT_ARGS(prof_sort_f)
-    const FLOATVAL timea = ((const ProfData *)a)->time;
-    const FLOATVAL timeb = ((const ProfData *)b)->time;
-
-    if (timea < timeb)
-        return 1;
-
-    if (timea > timeb)
-        return -1;
-
-    return 0;
-}
-
-
-/*
-
 =item C<static const char * op_name(PARROT_INTERP, int k)>
 
 Returns the name of the opcode.
@@ -732,24 +698,7 @@
 op_name(PARROT_INTERP, int k)
 {
     ASSERT_ARGS(op_name)
-    switch (k) {
-        case PARROT_PROF_GC_p1:
-            return "GC_mark_root";
-        case PARROT_PROF_GC_p2:
-            return "GC_mark_next";
-        case PARROT_PROF_GC_cp:
-            return "GC_collect_PMC";
-        case PARROT_PROF_GC_cb:
-            return "GC_collect_buffers";
-        case PARROT_PROF_GC:
-            return "GC";
-        case PARROT_PROF_EXCEPTION:
-            return "EXCEPTION";
-        default:
-            break;
-    }
-
-    return interp->op_info_table[k - PARROT_PROF_EXTRA].full_name;
+    return interp->op_info_table[k].full_name;
 }
 
 

Modified: branches/pluggable_runcore/src/exceptions.c
==============================================================================
--- branches/pluggable_runcore/src/exceptions.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/exceptions.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -356,7 +356,6 @@
     ASSERT_ARGS(Parrot_ex_throw_from_c)
 
     Parrot_runloop    *return_point = interp->current_runloop;
-    RunProfile * const profile      = interp->profile;
     opcode_t *address;
     PMC        * const handler      =
                              Parrot_cx_find_handler_local(interp, exception);
@@ -364,17 +363,6 @@
     if (PMC_IS_NULL(handler))
         die_from_exception(interp, exception);
 
-    /* If profiling, remember end time of lastop and generate entry for
-     * exception. */
-    if (profile && Interp_flags_TEST(interp, PARROT_PROFILE_FLAG)) {
-        const FLOATVAL now = Parrot_floatval_time();
-
-        profile->data[profile->cur_op].time += now - profile->starttime;
-        profile->cur_op                      = PARROT_PROF_EXCEPTION;
-        profile->starttime                   = now;
-        profile->data[PARROT_PROF_EXCEPTION].numcalls++;
-    }
-
     if (Interp_debug_TEST(interp, PARROT_BACKTRACE_DEBUG_FLAG)) {
         STRING * const exit_code = CONST_STRING(interp, "exit_code");
         STRING * const msg       = VTABLE_get_string(interp, exception);

Modified: branches/pluggable_runcore/src/gc/alloc_resources.c
==============================================================================
--- branches/pluggable_runcore/src/gc/alloc_resources.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/gc/alloc_resources.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -330,9 +330,6 @@
 
     ++arena_base->gc_sweep_block_level;
 
-    if (interp->profile)
-        Parrot_gc_profile_start(interp);
-
     /* We're collecting */
     arena_base->mem_allocs_since_last_collect    = 0;
     arena_base->header_allocs_since_last_collect = 0;
@@ -531,9 +528,6 @@
     pool->guaranteed_reclaimable = 0;
     pool->possibly_reclaimable   = 0;
 
-    if (interp->profile)
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC);
-
     --arena_base->gc_sweep_block_level;
 }
 

Modified: branches/pluggable_runcore/src/gc/gc_ms.c
==============================================================================
--- branches/pluggable_runcore/src/gc/gc_ms.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/gc/gc_ms.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -215,15 +215,11 @@
         header_pools_iterate_callback(interp, POOL_BUFFER | POOL_PMC,
             (void*)&total_free, gc_ms_sweep_cb);
 
-        if (interp->profile)
-            Parrot_gc_profile_end(interp, PARROT_PROF_GC_cb);
     }
     else {
         ++arena_base->gc_lazy_mark_runs;
 
         Parrot_gc_clear_live_bits(interp, arena_base->pmc_pool);
-        if (interp->profile)
-            Parrot_gc_profile_end(interp, PARROT_PROF_GC_p2);
     }
 
     pt_gc_stop_mark(interp);
@@ -313,9 +309,6 @@
 
     Parrot_gc_sweep_pool(interp, pool);
 
-    if (interp->profile && (flag & POOL_PMC))
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC_cp);
-
     *total_free += pool->num_free_objects;
 
     return 0;

Modified: branches/pluggable_runcore/src/gc/gc_private.h
==============================================================================
--- branches/pluggable_runcore/src/gc/gc_private.h	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/gc/gc_private.h	Sun Aug 16 06:31:46 2009	(r40583)
@@ -411,12 +411,6 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(* pool);
 
-void Parrot_gc_profile_end(PARROT_INTERP, int what)
-        __attribute__nonnull__(1);
-
-void Parrot_gc_profile_start(PARROT_INTERP)
-        __attribute__nonnull__(1);
-
 void Parrot_gc_run_init(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -466,10 +460,6 @@
      __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(pool)
-#define ASSERT_ARGS_Parrot_gc_profile_end __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_Parrot_gc_profile_start __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_gc_run_init __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_gc_sweep_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \

Modified: branches/pluggable_runcore/src/gc/incremental_ms.c
==============================================================================
--- branches/pluggable_runcore/src/gc/incremental_ms.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/gc/incremental_ms.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -773,9 +773,6 @@
 
     Parrot_gc_sweep_pool(interp, pool);
 
-    if (interp->profile && (flag & POOL_PMC))
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC_cp);
-
     *n_obj += pool->total_objects - pool->num_free_objects;
 
     return 0;
@@ -824,9 +821,6 @@
             (void*)&n_objects, sweep_cb);
     UNUSED(ignored);
 
-    if (interp->profile)
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC_cb);
-
     g_ims->state           = GC_IMS_COLLECT;
     g_ims->n_objects       = n_objects;
     g_ims->n_extended_PMCs = arena_base->num_extended_PMCs;
@@ -906,9 +900,6 @@
     Gc_ims_private *g_ims;
     int             ret;
 
-    if (!check_only && interp->profile)
-        Parrot_gc_profile_start(interp);
-
     g_ims = (Gc_ims_private *)arena_base->gc_private;
 
     ret   = header_pools_iterate_callback(interp, POOL_BUFFER,
@@ -920,9 +911,6 @@
     if (check_only)
         return 0;
 
-    if (interp->profile)
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC);
-
     g_ims->state = GC_IMS_FINISHED;
 #endif
     return 0;

Modified: branches/pluggable_runcore/src/gc/mark_sweep.c
==============================================================================
--- branches/pluggable_runcore/src/gc/mark_sweep.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/gc/mark_sweep.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -189,9 +189,6 @@
         return 0;
     }
 
-    if (interp->profile)
-        Parrot_gc_profile_start(interp);
-
     /* We have to start somewhere; the interpreter globals is a good place */
     if (!arena_base->gc_mark_start) {
         arena_base->gc_mark_start
@@ -258,9 +255,6 @@
     &&  arena_base->num_early_PMCs_seen >= arena_base->num_early_gc_PMCs)
         return 0;
 
-    if (interp->profile)
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC_p1);
-
     return 1;
 }
 
@@ -544,9 +538,6 @@
      * If there is a count of shared PMCs and we have already seen
      * all these, we could skip that.
      */
-    if (interp->profile)
-        Parrot_gc_profile_start(interp);
-
     pt_gc_mark_root_finished(interp);
 
     do {
@@ -586,9 +577,6 @@
     arena_base->gc_mark_start = current;
     arena_base->gc_trace_ptr  = NULL;
 
-    if (interp->profile)
-        Parrot_gc_profile_end(interp, PARROT_PROF_GC_p2);
-
     return 1;
 }
 
@@ -669,58 +657,6 @@
     interp->arena_base->header_allocs_since_last_collect++;
 }
 
-/*
-
-=item C<void Parrot_gc_profile_start(PARROT_INTERP)>
-
-Records the start time of a GC mark run when profiling is enabled.
-
-=cut
-
-*/
-
-void
-Parrot_gc_profile_start(PARROT_INTERP)
-{
-    ASSERT_ARGS(Parrot_gc_profile_start)
-    if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG))
-        interp->profile->gc_time = Parrot_floatval_time();
-}
-
-/*
-
-=item C<void Parrot_gc_profile_end(PARROT_INTERP, int what)>
-
-Records the end time of the GC mark run part C<what> run when profiling is
-enabled. Also record start time of next part.
-
-=cut
-
-*/
-
-void
-Parrot_gc_profile_end(PARROT_INTERP, int what)
-{
-    ASSERT_ARGS(Parrot_gc_profile_end)
-    if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG)) {
-        RunProfile * const profile = interp->profile;
-        const FLOATVAL     now     = Parrot_floatval_time();
-
-        profile->data[what].numcalls++;
-        profile->data[what].time += now - profile->gc_time;
-
-        /*
-         * we've recorded the time of a GC piece from
-         * gc_time until now, so add this to the start of the
-         * currently executing opcode, which hasn't run this
-         * interval.
-         */
-        profile->starttime += now - profile->gc_time;
-
-        /* prepare start for next step */
-        profile->gc_time    = now;
-    }
-}
 
 #ifndef GC_IS_MALLOC
 #  define PMC_HEADERS_PER_ALLOC    10240 / sizeof (PMC)

Modified: branches/pluggable_runcore/src/interp/inter_create.c
==============================================================================
--- branches/pluggable_runcore/src/interp/inter_create.c	Sun Aug 16 06:30:09 2009	(r40582)
+++ branches/pluggable_runcore/src/interp/inter_create.c	Sun Aug 16 06:31:46 2009	(r40583)
@@ -226,7 +226,6 @@
     interp->evc_func_table  = NULL;
     interp->save_func_table = NULL;
     interp->code            = NULL;
-    interp->profile         = NULL;
 
     /* create the root set registry */
     interp->gc_registry     = pmc_new(interp, enum_class_AddrRegistry);
@@ -416,13 +415,6 @@
     if (interp->initial_pf)
         PackFile_destroy(interp, interp->initial_pf);
 
-    if (interp->profile) {
-        mem_sys_free(interp->profile->data);
-        interp->profile->data = NULL;
-        mem_sys_free(interp->profile);
-        interp->profile = NULL;
-    }
-
     destroy_context(interp);
     destroy_runloop_jump_points(interp);
 


More information about the parrot-commits mailing list