예제 #1
0
        private void ReadSummary_Gcs(BinaryReader reader)
        {
            reader.BaseStream.Seek(gc_index_offset, SeekOrigin.Begin);
            for (int i = 0; i < gcs.Length; ++i)
            {
                Gc gc;
                gc = new Gc(this);

                gc.Generation        = reader.ReadInt32();
                gc.TimeT             = reader.ReadInt64();
                gc.Timestamp         = Util.ConvertTimeT(gc.TimeT);
                gc.PreGcLiveBytes    = reader.ReadInt64();
                gc.PreGcLiveObjects  = reader.ReadInt32();
                gc.PostGcLiveBytes   = reader.ReadInt64();
                gc.PostGcLiveObjects = reader.ReadInt32();

                gcs [i]    = gc;
                gc_pos [i] = reader.ReadInt64();
            }
        }
예제 #2
0
        private void ReadLogFileChunk_Gc(BinaryReader reader)
        {
            Gc gc;

            gc = new Gc(this);

            gc.Generation       = reader.ReadInt32();
            gc.TimeT            = reader.ReadInt64();
            gc.Timestamp        = Util.ConvertTimeT(gc.TimeT);
            gc.PreGcLiveBytes   = reader.ReadInt64();
            gc.PreGcLiveObjects = reader.ReadInt32();

            int n;

            n = reader.ReadInt32();

            RawGcData [] raw;
            raw = new RawGcData [n];
            for (int i = 0; i < n; ++i)
            {
                raw [i].BacktraceCode = reader.ReadUInt32();
                raw [i].ObjectStats.Read(reader);
            }
            combsort_raw_gc_data(raw);

            gc.PostGcLiveBytes   = reader.ReadInt64();
            gc.PostGcLiveObjects = reader.ReadInt32();

            gcs [i_gc]         = gc;
            raw_gc_data [i_gc] = raw;
            ++i_gc;

            if (gc.Generation >= 0)
            {
                Spew("GC {0}: collected {1} bytes, {2} to {3}",
                     gc.Generation,
                     gc.FreedBytes,
                     gc.PreGcLiveBytes,
                     gc.PostGcLiveBytes);
            }
        }
예제 #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);
            }
        }
예제 #4
0
		private void ReadSummary_Gcs (BinaryReader reader)
		{
			reader.BaseStream.Seek (gc_index_offset, SeekOrigin.Begin);
			for (int i = 0; i < gcs.Length; ++i) {
				Gc gc;
				gc = new Gc (this);

				gc.Generation = reader.ReadInt32 ();
				gc.TimeT = reader.ReadInt64 ();
				gc.Timestamp = Util.ConvertTimeT (gc.TimeT);
				gc.PreGcLiveBytes = reader.ReadInt64 ();
				gc.PreGcLiveObjects = reader.ReadInt32 ();
				gc.PostGcLiveBytes = reader.ReadInt64 ();
				gc.PostGcLiveObjects = reader.ReadInt32 ();

				gcs [i] = gc;
				gc_pos [i] = reader.ReadInt64 ();
			}
		}
예제 #5
0
		private void ReadLogFileChunk_Gc (BinaryReader reader)
		{
			Gc gc;
			gc = new Gc (this);

			gc.Generation = reader.ReadInt32 ();
			gc.TimeT = reader.ReadInt64 ();
			gc.Timestamp = Util.ConvertTimeT (gc.TimeT);
			gc.PreGcLiveBytes = reader.ReadInt64 ();
			gc.PreGcLiveObjects = reader.ReadInt32 ();

			int n;
			n = reader.ReadInt32 ();

			RawGcData [] raw;
			raw = new RawGcData [n];
			for (int i = 0; i < n; ++i) {
				raw [i].BacktraceCode = reader.ReadUInt32 ();
				raw [i].ObjectStats.Read (reader);
			}
			combsort_raw_gc_data (raw);

			gc.PostGcLiveBytes = reader.ReadInt64 ();
			gc.PostGcLiveObjects = reader.ReadInt32 ();

			gcs [i_gc] = gc;
			raw_gc_data [i_gc] = raw;
			++i_gc;

			if (gc.Generation >= 0)
				Spew ("GC {0}: collected {1} bytes, {2} to {3}",
				      gc.Generation,
				      gc.FreedBytes,
				      gc.PreGcLiveBytes,
				      gc.PostGcLiveBytes);
		}