Author: benm
Date: 2005-03-28 16:37:12 -0500 (Mon, 28 Mar 2005)
New Revision: 42318

Modified:
   trunk/heap-prof/src/runtime-profiler/ChangeLog
   trunk/heap-prof/src/runtime-profiler/gc-profiler.c
   trunk/heap-prof/src/viewer/common/ChangeLog
   trunk/heap-prof/src/viewer/common/ProfileReader.cs
   trunk/heap-prof/src/viewer/common/TypeGraphPlotter.cs
   trunk/heap-prof/src/viewer/gui-gtk/ChangeLog
   trunk/heap-prof/src/viewer/gui-gtk/TypeGraphViewer.cs
Log:
In src/viewer/gui-gtk:
2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>

        * TypeGraphViewer.cs: Fix up the hit testing now that we have
        axes. Also, use the new color labeling thingy.

In src/viewer/common:
2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>

        * ProfileReader.cs: Read summarized data.

        * TypeGraphPlotter.cs: Rather than rely on reading the profile in
        one gulp, use the summarized data.

In src/runtime-profiler:
2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>

        * gc-profiler.c: Write out summarized type allocation data.



Modified: trunk/heap-prof/src/runtime-profiler/ChangeLog
===================================================================
--- trunk/heap-prof/src/runtime-profiler/ChangeLog      2005-03-28 21:10:26 UTC 
(rev 42317)
+++ trunk/heap-prof/src/runtime-profiler/ChangeLog      2005-03-28 21:37:12 UTC 
(rev 42318)
@@ -1,3 +1,7 @@
+2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * gc-profiler.c: Write out summarized type allocation data.
+
 2005-01-24  Ben Maurer  <[EMAIL PROTECTED]>
 
        * gc-profiler.c: Update after lupus's runtime changes.

Modified: trunk/heap-prof/src/runtime-profiler/gc-profiler.c
===================================================================
--- trunk/heap-prof/src/runtime-profiler/gc-profiler.c  2005-03-28 21:10:26 UTC 
(rev 42317)
+++ trunk/heap-prof/src/runtime-profiler/gc-profiler.c  2005-03-28 21:37:12 UTC 
(rev 42318)
@@ -66,6 +66,9 @@
        int type_live_data_size;
        int* type_live_data;
        
+       int type_total_allocs_size;
+       guint64* type_total_allocs;
+       
        int total_live_bytes;
        
        GPtrArray* timeline;
@@ -90,7 +93,7 @@
        0xaa, 0x93, 0xc8, 0x76, 0xf4, 0x6a, 0x95, 0x11
 };
 
-static const guint32 heap_prof_version = 4;
+static const guint32 heap_prof_version = 6;
 
 #define BT_SIZE 5
 
@@ -214,8 +217,10 @@
                
                g_hash_table_insert (p->klass_to_table_idx, klass, 
idx_plus_one);
                
-               if (idx_plus_one > p->type_live_data_size)
+               if (idx_plus_one > p->type_live_data_size) {
                        resize_array (p->type_live_data, 
p->type_live_data_size, MAX (p->type_live_data_size << 1, idx_plus_one));
+                       resize_array (p->type_total_allocs, 
p->type_total_allocs_size, MAX (p->type_total_allocs_size << 1, idx_plus_one));
+               }
        }
        
        return leu32 (idx_plus_one - 1);
@@ -286,6 +291,8 @@
                p->total_live_bytes += size;
                p->type_live_data [tidx] += size;
                p->context_live_objects [cidx] ++;
+               
+               p->type_total_allocs [tidx] ++;
        } else {
                p->total_live_bytes -= size;
                p->type_live_data [tidx] -= size;
@@ -541,6 +548,20 @@
 }
 
 static void
+write_total_allocs_table (MonoProfiler* p)
+{
+       guint32 size = p->klass_table->len;
+       int i;
+       guint32 encs = leu32 (size);
+       prof_write (p, &encs, sizeof (encs));
+       
+       for (i = 0; i < size; i ++)
+               p->type_total_allocs [i] = leu64 (p->type_total_allocs [i]);
+       
+       prof_write (p, p->type_total_allocs, size * sizeof 
(*p->type_total_allocs));
+}
+
+static void
 write_metadata_file (MonoProfiler* p)
 {
        write_meta_header (p);
@@ -550,6 +571,7 @@
        write_data_table (p, p->bt_table, sizeof (IdxBacktrace));
        write_data_table (p, p->ctx_table, sizeof (IdxAllocationCtx));
        write_data_table (p, p->timeline, sizeof (HeapProfTimelineRec));
+       write_total_allocs_table (p);
 }
 
 

Modified: trunk/heap-prof/src/viewer/common/ChangeLog
===================================================================
--- trunk/heap-prof/src/viewer/common/ChangeLog 2005-03-28 21:10:26 UTC (rev 
42317)
+++ trunk/heap-prof/src/viewer/common/ChangeLog 2005-03-28 21:37:12 UTC (rev 
42318)
@@ -1,3 +1,10 @@
+2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * ProfileReader.cs: Read summarized data.
+
+       * TypeGraphPlotter.cs: Rather than rely on reading the profile in
+       one gulp, use the summarized data.
+
 2005-02-19  Ben Maurer  <[EMAIL PROTECTED]>
 
        * TypeGraphPlotter.cs:

Modified: trunk/heap-prof/src/viewer/common/ProfileReader.cs
===================================================================
--- trunk/heap-prof/src/viewer/common/ProfileReader.cs  2005-03-28 21:10:26 UTC 
(rev 42317)
+++ trunk/heap-prof/src/viewer/common/ProfileReader.cs  2005-03-28 21:37:12 UTC 
(rev 42318)
@@ -172,10 +172,12 @@
        int [][] backtraceTable;
        Context [] contextTable;
        Timeline [] timeline;
+       long [] type_total_allocs;
        
        public int TypeTableSize { get { return typeTable.Length; } }
        public int ContextTableSize { get { return contextTable.Length; } }
        public Timeline [] Timeline { get { return timeline; } }
+       public long [] TypeTotalAllocs { get { return type_total_allocs; } }
        
        public string GetTypeName (int idx)
        {
@@ -231,6 +233,7 @@
                        backtraceTable = ReadBacktraceTable (br);
                        contextTable = ReadContextTable (br);
                        timeline = ReadTimeline (br);
+                       type_total_allocs = ReadTypeTotalAllocationsTable (br);
                }
        }
        
@@ -244,6 +247,18 @@
                }
        }
        
+       long [] ReadTypeTotalAllocationsTable (BinaryReader br)
+       {
+               int sz = br.ReadInt32 ();
+               
+               long [] ret = new long [sz];
+               
+               for (int i = 0; i < sz; i ++)
+                       ret [i] = br.ReadInt64 ();
+               
+               return ret;
+       }
+       
 
        string [] ReadStringTable (BinaryReader br)
        {
@@ -322,7 +337,7 @@
                0xaa, 0x93, 0xc8, 0x76, 0xf4, 0x6a, 0x95, 0x11
        };
        
-       const int Version = 4;
+       const int Version = 6;
        
        public static void ReadHeader (BinaryReader br, bool is_dump)
        {

Modified: trunk/heap-prof/src/viewer/common/TypeGraphPlotter.cs
===================================================================
--- trunk/heap-prof/src/viewer/common/TypeGraphPlotter.cs       2005-03-28 
21:10:26 UTC (rev 42317)
+++ trunk/heap-prof/src/viewer/common/TypeGraphPlotter.cs       2005-03-28 
21:37:12 UTC (rev 42318)
@@ -131,7 +131,7 @@
        static Brush [] brushes;
        
        const int N_COLORS = 26;
-       const int MOD = 5;
+       const int MOD = 7;
 
        static RandomBrush () {
                
@@ -206,12 +206,19 @@
        public Brush [] TypeBrushes;
        public string [] Names;
        
-       public TypeList (TypeTabulator d)
+       public TypeList (Profile p)
        {
                int num = 0;
                
-               foreach (bool b in d.IsSizeLongEnough)
-                       if (b)
+               long total_size = 0;
+               
+               foreach (long l in p.Metadata.TypeTotalAllocs)
+                       total_size += l;
+               
+               long threshold = total_size / 1000;
+               
+               foreach (long l in p.Metadata.TypeTotalAllocs)
+                       if (l > threshold)
                                num ++;
                        
                Sizes = new long [num];
@@ -220,9 +227,9 @@
                TypeBrushes = new Brush [num];
                        
                num = 0;
-               for (int i = 0; i < d.TotalTypeSizes.Length; i ++) {
-                       if (d.IsSizeLongEnough [i]) {
-                               Sizes [num] = d.TotalTypeSizes [i];
+               for (int i = 0; i < p.Metadata.TypeTotalAllocs.Length; i ++) {
+                       if (p.Metadata.TypeTotalAllocs [i] > threshold) {
+                               Sizes [num] = p.Metadata.TypeTotalAllocs [i];
                                TypeIndexes [num] = i;
                                num ++;
                        }
@@ -234,7 +241,7 @@
                
                for (int i = 0; i < Sizes.Length; i ++) {
                        TypeBrushes [i] = rb.Next ();
-                       Names [i] = d.GetTypeName (TypeIndexes [i]);
+                       Names [i] = p.GetTypeName (TypeIndexes [i]);
                }
        }
 }

Modified: trunk/heap-prof/src/viewer/gui-gtk/ChangeLog
===================================================================
--- trunk/heap-prof/src/viewer/gui-gtk/ChangeLog        2005-03-28 21:10:26 UTC 
(rev 42317)
+++ trunk/heap-prof/src/viewer/gui-gtk/ChangeLog        2005-03-28 21:37:12 UTC 
(rev 42318)
@@ -1,3 +1,8 @@
+2005-03-28  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * TypeGraphViewer.cs: Fix up the hit testing now that we have
+       axes. Also, use the new color labeling thingy.
+
 2005-03-24  Ben Maurer  <[EMAIL PROTECTED]>
 
        * TypeGraphViewer.cs: And now the y axis :-).

Modified: trunk/heap-prof/src/viewer/gui-gtk/TypeGraphViewer.cs
===================================================================
--- trunk/heap-prof/src/viewer/gui-gtk/TypeGraphViewer.cs       2005-03-28 
21:10:26 UTC (rev 42317)
+++ trunk/heap-prof/src/viewer/gui-gtk/TypeGraphViewer.cs       2005-03-28 
21:37:12 UTC (rev 42318)
@@ -33,13 +33,9 @@
                scroller.OnScrolled += delegate { t = null; d.UpdateCache (); 
d.QueueDraw (); };
                
                box.PackStart (scroller, false, false, 0);
+               
+               tl = new TypeList (p);
 
-               // FIXME: HACKISH
-               TypeTabulator xxx = new TypeTabulator (p);
-               xxx.Read ();
-               xxx.Process ();
-               tl = new TypeList (xxx);
-
                d = new TypeGrpah (tl, this);
                
                ScrolledWindow sw = new ScrolledWindow ();
@@ -350,8 +346,11 @@
                
                Console.WriteLine ("Button press at ({0}, {1})", e.X, e.Y);
                
+               if (!graph_area.Contains ((int) e.X, (int) e.Y))
+                       return false;
+               
                foreach (TimePoint tp in plot.data) {
-                       if (tp.X >= e.X) {
+                       if (tp.X >= (e.X - graph_area.X)) {
                                Console.WriteLine ("Found {0}", tp.Time);
                                
                                parent.Parent.Add (new BacktraceViewerComponent 
(tp.Data, parent.Profile));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to