Example #1
0
        public void Load(HeapBuddyProfilingSnapshot snapshot)
        {
            this.snapshot = snapshot;

            foreach (Type type in snapshot.Outfile.Types)
            {
                store.AppendValues("md-class", type.Name, type.LastObjectStats.AllocatedCount.ToString(),
                                   ProfilingService.PrettySize(type.LastObjectStats.AllocatedTotalBytes),
                                   String.Format("{0:0.0}", type.LastObjectStats.AllocatedAverageBytes),
                                   String.Format("{0:0.0}", type.LastObjectStats.AllocatedAverageAge),
                                   type.BacktraceCount.ToString(), type);
            }
        }
Example #2
0
        public void Load(HeapBuddyProfilingSnapshot snapshot)
        {
            this.snapshot = snapshot;

            foreach (Backtrace bt in snapshot.Outfile.Backtraces)
            {
                TreeIter iter = store.AppendValues("md-class", bt.Type.Name, bt.LastObjectStats.AllocatedCount.ToString(),
                                                   ProfilingService.PrettySize(bt.LastObjectStats.AllocatedTotalBytes),
                                                   String.Format("{0:0.0}", bt.LastObjectStats.AllocatedAverageBytes),
                                                   String.Format("{0:0.0}", bt.LastObjectStats.AllocatedAverageAge), bt);

                foreach (Frame frame in bt.Frames)
                {
                    if (!frame.MethodName.StartsWith("(wrapper"))
                    {
                        store.AppendValues(iter, "md-method", frame.MethodName, String.Empty, String.Empty,
                                           String.Empty, String.Empty, frame);
                    }
                }
            }
        }
Example #3
0
        public void Load(HeapBuddyProfilingSnapshot snapshot)
        {
            this.snapshot = snapshot;
            OutfileReader reader = snapshot.Outfile;

            Resize[] resizes = reader.Resizes;
            Gc[]     gcs     = reader.Gcs;

            int  i_resize  = 0;
            int  i_gc      = 0;
            long heap_size = 0;

            while (i_resize < resizes.Length || i_gc < gcs.Length)
            {
                Resize r = null;
                if (i_resize < resizes.Length)
                {
                    r = resizes [i_resize];
                }

                Gc gc = null;
                if (i_gc < gcs.Length)
                {
                    gc = gcs [i_gc];
                }

                string timestamp, tag, message;

                if (r != null && (gc == null || r.Generation <= gc.Generation))
                {
                    timestamp = string.Format("{0:HH:mm:ss}", r.Timestamp);

                    if (r.PreviousSize == 0)
                    {
                        tag     = GettextCatalog.GetString("Init");
                        message = String.Format(GettextCatalog.GetString("Initialized heap to {0}"),
                                                ProfilingService.PrettySize(r.NewSize));
                    }
                    else
                    {
                        tag     = GettextCatalog.GetString("Resize");
                        message = String.Format(GettextCatalog.GetString("Grew heap from {0} to {1}") +
                                                Environment.NewLine +
                                                GettextCatalog.GetString("{2} in {3} live objects") +
                                                Environment.NewLine +
                                                GettextCatalog.GetString("Heap went from {4:0.0}% to {5:0.0}% capacity"),
                                                ProfilingService.PrettySize(r.PreviousSize),
                                                ProfilingService.PrettySize(r.NewSize),
                                                ProfilingService.PrettySize(r.TotalLiveBytes),
                                                r.TotalLiveObjects,
                                                r.PreResizeCapacity, r.PostResizeCapacity);
                    }

                    heap_size = r.NewSize;
                    ++i_resize;
                }
                else
                {
                    timestamp = String.Format("{0:HH:mm:ss}", gc.Timestamp);
                    if (gc.Generation >= 0)
                    {
                        tag     = GettextCatalog.GetString("GC ") + gc.Generation;
                        message = String.Format(GettextCatalog.GetString("Collected {0} of {1} objects ({2:0.0}%)") +
                                                Environment.NewLine +
                                                GettextCatalog.GetString("Collected {3} of {4} ({5:0.0}%)") +
                                                Environment.NewLine +
                                                GettextCatalog.GetString("Heap went from {6:0.0}% to {7:0.0}% capacity"),
                                                gc.FreedObjects,
                                                gc.PreGcLiveObjects,
                                                gc.FreedObjectsPercentage,
                                                ProfilingService.PrettySize(gc.FreedBytes),
                                                ProfilingService.PrettySize(gc.PreGcLiveBytes),
                                                gc.FreedBytesPercentage,
                                                100.0 * gc.PreGcLiveBytes / heap_size,
                                                100.0 * gc.PostGcLiveBytes / heap_size);
                    }
                    else
                    {
                        tag     = GettextCatalog.GetString("Exit");
                        message = String.Format(GettextCatalog.GetString("{0} live objects using {1}"),
                                                gc.PreGcLiveObjects,
                                                ProfilingService.PrettySize(gc.PreGcLiveBytes));
                    }
                    ++i_gc;
                }

                store.AppendValues(timestamp, tag, message);
            }
        }