cvsuser     04/11/04 04:52:27

  Modified:    include/parrot dod.h interpreter.h
               src      dod.c gc_ims.c resources.c
  Log:
  better DOD timings with incremental GC
  
  Revision  Changes    Path
  1.23      +4 -1      parrot/include/parrot/dod.h
  
  Index: dod.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/dod.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- dod.h     18 Oct 2004 01:35:25 -0000      1.22
  +++ dod.h     4 Nov 2004 12:52:25 -0000       1.23
  @@ -1,7 +1,7 @@
   /* dod.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: dod.h,v 1.22 2004/10/18 01:35:25 brentdax Exp $
  + *     $Id: dod.h,v 1.23 2004/11/04 12:52:25 leo Exp $
    *  Overview:
    *     Handles dead object destruction of the various headers
    *  Data Structure and Algorithms:
  @@ -76,6 +76,9 @@
   void Parrot_dod_ms_run_init(Interp *interpreter);
   void Parrot_dod_clear_live_bits(Interp*);
   
  +void Parrot_dod_profile_start(Parrot_Interp interpreter);
  +void Parrot_dod_profile_end(Parrot_Interp interpreter, int what);
  +
   /* GC subsystem init functions */
   void Parrot_gc_ms_init(Interp* interpreter);
   void Parrot_gc_ims_init(Interp* interpreter);
  
  
  
  1.161     +1 -2      parrot/include/parrot/interpreter.h
  
  Index: interpreter.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- interpreter.h     2 Nov 2004 10:23:46 -0000       1.160
  +++ interpreter.h     4 Nov 2004 12:52:25 -0000       1.161
  @@ -1,7 +1,7 @@
   /* interpreter.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: interpreter.h,v 1.160 2004/11/02 10:23:46 leo Exp $
  + *     $Id: interpreter.h,v 1.161 2004/11/04 12:52:25 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -122,7 +122,6 @@
   typedef struct _RunProfile {
       FLOATVAL starttime;
       FLOATVAL dod_time;
  -    FLOATVAL gc_time;
       opcode_t cur_op;
       ProfData *data;
   } RunProfile;
  
  
  
  1.141     +25 -20    parrot/src/dod.c
  
  Index: dod.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/dod.c,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- dod.c     2 Nov 2004 17:52:19 -0000       1.140
  +++ dod.c     4 Nov 2004 12:52:26 -0000       1.141
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: dod.c,v 1.140 2004/11/02 17:52:19 leo Exp $
  +$Id: dod.c,v 1.141 2004/11/04 12:52:26 leo Exp $
   
   =head1 NAME
   
  @@ -40,10 +40,7 @@
   #endif
   
   static size_t find_common_mask(size_t val1, size_t val2);
  -static void profile_dod_end(Parrot_Interp, int what);
   static void trace_active_buffers(Interp *interpreter);
  -static void profile_dod_start(Parrot_Interp interpreter);
  -static void profile_dod_end(Parrot_Interp interpreter, int what);
   
   /*
   
  @@ -273,7 +270,7 @@
           return 0;
       }
       if (interpreter->profile)
  -        profile_dod_start(interpreter);
  +        Parrot_dod_profile_start(interpreter);
       /* We have to start somewhere, the interpreter globals is a good place */
       if (!arena_base->dod_mark_start) {
           arena_base->dod_mark_start = arena_base->dod_mark_ptr =
  @@ -358,7 +355,7 @@
       /* And the buffers */
       trace_active_buffers(interpreter);
       if (interpreter->profile)
  -        profile_dod_end(interpreter, PARROT_PROF_DOD_p1);
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_p1);
       return 1;
   }
   
  @@ -404,7 +401,7 @@
        * all these, we could skip that
        */
       if (interpreter->profile)
  -        profile_dod_start(interpreter);
  +        Parrot_dod_profile_start(interpreter);
       pt_DOD_mark_root_finished(interpreter);
   
       for (; ; current = next) {
  @@ -466,7 +463,7 @@
       arena_base->dod_mark_start = current;
       arena_base->dod_trace_ptr = NULL;
       if (interpreter->profile)
  -        profile_dod_end(interpreter, PARROT_PROF_DOD_p2);
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_p2);
       return 1;
   }
   
  @@ -1050,8 +1047,8 @@
   
   /*
   
  -=item C<static void
  -profile_dod_start(Parrot_Interp interpreter)>
  +=item C<void
  +Parrot_dod_profile_start(Parrot_Interp interpreter)>
   
   Records the start time of a DOD run when profiling is enabled.
   
  @@ -1059,8 +1056,8 @@
   
   */
   
  -static void
  -profile_dod_start(Parrot_Interp interpreter)
  +void
  +Parrot_dod_profile_start(Parrot_Interp interpreter)
   {
       if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
           interpreter->profile->dod_time = Parrot_floatval_time();
  @@ -1069,17 +1066,18 @@
   
   /*
   
  -=item C<static void
  -profile_dod_end(Parrot_Interp interpreter)>
  +=item C<void
  +Parrot_dod_profile_end(Parrot_Interp interpreter, int what)>
   
  -Records the end time of a DOD run when porfiling is enabled.
  +Records the end time of the DOD part C<what> run when profiling is enabled.
  +Also record start time of next part.
   
   =cut
   
   */
   
  -static void
  -profile_dod_end(Parrot_Interp interpreter, int what)
  +void
  +Parrot_dod_profile_end(Parrot_Interp interpreter, int what)
   {
       if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
           RunProfile *profile = interpreter->profile;
  @@ -1087,7 +1085,14 @@
   
           profile->data[what].numcalls++;
           profile->data[what].time += now - profile->dod_time;
  +        /*
  +         * we've recorded the time of a DOD/GC piece from
  +         * dod_time til now, so add this to the start of the
  +         * currently executing opcode, which hasn't run this
  +         * internval.
  +         */
           profile->starttime += now - profile->dod_time;
  +        /* prepare start for next step */
           profile->dod_time = now;
       }
   }
  @@ -1175,7 +1180,7 @@
           Parrot_dod_sweep(interpreter, header_pool);
           total_free += header_pool->num_free_objects;
           if (interpreter->profile)
  -            profile_dod_end(interpreter, PARROT_PROF_DOD_cp);
  +            Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_cp);
   
           /* And unused buffers on the free list */
           for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
  @@ -1192,7 +1197,7 @@
               }
           }
           if (interpreter->profile)
  -            profile_dod_end(interpreter, PARROT_PROF_DOD_cb);
  +            Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_cb);
       }
       else {
           /*
  @@ -1206,7 +1211,7 @@
           Parrot_dod_clear_live_bits(interpreter);
   #endif
           if (interpreter->profile)
  -            profile_dod_end(interpreter, PARROT_PROF_DOD_p2);
  +            Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_p2);
       }
       pt_DOD_stop_mark(interpreter);
       /* Note it */
  
  
  
  1.13      +10 -2     parrot/src/gc_ims.c
  
  Index: gc_ims.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/gc_ims.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- gc_ims.c  4 Nov 2004 08:03:36 -0000       1.12
  +++ gc_ims.c  4 Nov 2004 12:52:26 -0000       1.13
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
  -$Id: gc_ims.c,v 1.12 2004/11/04 08:03:36 leo Exp $
  +$Id: gc_ims.c,v 1.13 2004/11/04 12:52:26 leo Exp $
   
   =head1 NAME
   
  @@ -387,7 +387,7 @@
       GC_IMS_COLLECT,     /* collect buffer memory */
       GC_IMS_FINISHED,    /* update statistics */
       GC_IMS_CONSUMING,   /* when we have plenty of free objects */
  -    GC_IMS_DEAD         /* gc is alreadz shutdown */         
  +    GC_IMS_DEAD         /* gc is alreadz shutdown */
   
   } gc_ims_state_enum;
   
  @@ -665,6 +665,8 @@
        * TODO profile timings for sweep
        */
       Parrot_dod_sweep(interpreter, header_pool);
  +    if (interpreter->profile)
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_cp);
       n_objects = header_pool->total_objects - header_pool->num_free_objects;
   
       /* and non-empty sized buffer pools */
  @@ -682,6 +684,8 @@
                   header_pool->num_free_objects;
           }
       }
  +    if (interpreter->profile)
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_DOD_cb);
       g_ims->state = GC_IMS_COLLECT;
       g_ims->n_objects = n_objects;
       g_ims->n_extended_PMCs = arena_base->num_extended_PMCs;
  @@ -716,6 +720,8 @@
       Gc_ims_private *g_ims;
       int j;
   
  +    if (!check_only && interpreter->profile)
  +        Parrot_dod_profile_start(interpreter);
       g_ims = arena_base->gc_private;
       for (j = 0; j < (INTVAL)arena_base->num_sized; j++) {
           header_pool = arena_base->sized_header_pools[j];
  @@ -751,6 +757,8 @@
       }
       if (check_only)
           return 0;
  +    if (interpreter->profile)
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_GC);
       g_ims->state = GC_IMS_FINISHED;
       return 0;
   }
  
  
  
  1.131     +3 -47     parrot/src/resources.c
  
  Index: resources.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/resources.c,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- resources.c       8 Sep 2004 00:33:58 -0000       1.130
  +++ resources.c       4 Nov 2004 12:52:26 -0000       1.131
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: resources.c,v 1.130 2004/09/08 00:33:58 dan Exp $
  +$Id: resources.c,v 1.131 2004/11/04 12:52:26 leo Exp $
   
   =head1 NAME
   
  @@ -175,50 +175,6 @@
       return (void *)return_val;
   }
   
  -/*
  -
  -=item C<static PARROT_INLINE void
  -profile_gc_start(Parrot_Interp interpreter)>
  -
  -Called within C<compact_pool()> to record the start time of a GC run if
  -profiling is enabled.
  -
  -=cut
  -
  -*/
  -
  -static PARROT_INLINE void
  -profile_gc_start(Parrot_Interp interpreter)
  -{
  -    if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
  -        interpreter->profile->gc_time = Parrot_floatval_time();
  -    }
  -}
  -
  -/*
  -
  -=item C<static PARROT_INLINE void
  -profile_gc_end(Parrot_Interp interpreter)>
  -
  -Called within C<compact_pool()> to record the end time of a GC run if
  -profiling is enabled.
  -
  -=cut
  -
  -*/
  -
  -static PARROT_INLINE void
  -profile_gc_end(Parrot_Interp interpreter)
  -{
  -    if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
  -        RunProfile *profile = interpreter->profile;
  -        FLOATVAL now = Parrot_floatval_time();
  -
  -        profile->data[PARROT_PROF_GC].numcalls++;
  -        profile->data[PARROT_PROF_GC].time += now - profile->gc_time;
  -        profile->starttime += now - profile->gc_time;
  -    }
  -}
   
   /*
   
  @@ -256,7 +212,7 @@
       }
       ++arena_base->GC_block_level;
       if (interpreter->profile)
  -        profile_gc_start(interpreter);
  +        Parrot_dod_profile_start(interpreter);
   
       /* We're collecting */
       arena_base->mem_allocs_since_last_collect = 0;
  @@ -405,7 +361,7 @@
       pool->guaranteed_reclaimable = 0;
       pool->possibly_reclaimable = 0;
       if (interpreter->profile)
  -        profile_gc_end(interpreter);
  +        Parrot_dod_profile_end(interpreter, PARROT_PROF_GC);
       --arena_base->GC_block_level;
   }
   
  
  
  

Reply via email to