svn path=/branches/dmsnell/heap-buddy/; revision=63275
This commit is contained in:
Родитель
fe43dc8405
Коммит
24896bf706
|
@ -29,9 +29,6 @@ namespace HeapBuddy {
|
|||
public Type Type;
|
||||
|
||||
public int LastGeneration;
|
||||
|
||||
public long TimeT;
|
||||
public DateTime Timestamp;
|
||||
|
||||
public ObjectStats LastObjectStats;
|
||||
|
||||
|
|
|
@ -6,66 +6,8 @@ namespace HeapBuddy {
|
|||
|
||||
public class Memgraph {
|
||||
|
||||
public class AllocData {
|
||||
public uint bytes;
|
||||
|
||||
public AllocData () {
|
||||
bytes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Memgraph (OutfileReader reader, string data)
|
||||
{
|
||||
|
||||
DisplayRawData (reader, data);
|
||||
|
||||
}
|
||||
|
||||
public void DisplayRawData (OutfileReader reader, string data)
|
||||
{
|
||||
int count = 0;
|
||||
Table table = new Table ();
|
||||
table.AddHeaders ("Time", "Allocated Bytes");
|
||||
|
||||
Hashtable Data = new Hashtable ();
|
||||
AllocData ad;
|
||||
|
||||
foreach (Backtrace bt in reader.Backtraces) {
|
||||
count++;
|
||||
if (data != null || bt.Type.Name == data) {
|
||||
if (Data.Contains (bt.TimeT))
|
||||
ad = (AllocData)Data[bt.TimeT];
|
||||
else {
|
||||
ad = new AllocData ();
|
||||
Data[bt.TimeT] = ad;
|
||||
}
|
||||
|
||||
ad.bytes += bt.LastObjectStats.AllocatedTotalBytes;
|
||||
}
|
||||
}
|
||||
|
||||
uint maxbytes = 0;
|
||||
uint minbytes = 100000000;
|
||||
uint avgbytes = 0;
|
||||
|
||||
foreach (DictionaryEntry de in Data) {
|
||||
uint b = ((AllocData)de.Value).bytes;
|
||||
|
||||
table.AddRow (de.Key, b);
|
||||
|
||||
avgbytes += b;
|
||||
|
||||
if (b < minbytes)
|
||||
minbytes = b;
|
||||
else if (b > maxbytes)
|
||||
maxbytes = b;
|
||||
}
|
||||
|
||||
Console.WriteLine (table);
|
||||
Console.WriteLine ("{0} allocations", count);
|
||||
Console.WriteLine ("Maximum Allocation: {0}", Util.PrettySize (maxbytes));
|
||||
Console.WriteLine ("Minimum Allocation: {0}", Util.PrettySize (minbytes));
|
||||
Console.WriteLine ("Average Allocation: {0}", Util.PrettySize (avgbytes / Data.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,8 +435,6 @@ namespace HeapBuddy {
|
|||
|
||||
Backtrace backtrace;
|
||||
backtrace = new Backtrace (code, this);
|
||||
|
||||
backtrace.TimeT = reader.ReadInt64 ();
|
||||
|
||||
uint type_code;
|
||||
type_code = reader.ReadUInt32 ();
|
||||
|
@ -454,8 +452,6 @@ namespace HeapBuddy {
|
|||
|
||||
backtraces [i_backtrace] = backtrace;
|
||||
|
||||
backtrace.Timestamp = Util.ConvertTimeT (backtrace.TimeT);
|
||||
|
||||
backtrace_codes [i_backtrace] = code;
|
||||
backtrace_type_codes [i_backtrace] = type_code;
|
||||
|
||||
|
|
|
@ -206,15 +206,9 @@ outfile_writer_add_accountant (OutfileWriter *ofw,
|
|||
g_hash_table_insert (ofw->seen_items, method, method);
|
||||
++ofw->method_count;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we can spew out the accountant's context */
|
||||
time_t timestamp;
|
||||
time (×tamp);
|
||||
|
||||
}
|
||||
write_byte (ofw->out, TAG_CONTEXT);
|
||||
write_pointer (ofw->out, acct);
|
||||
write_int64 (ofw->out, (gint64)timestamp);
|
||||
write_pointer (ofw->out, acct->klass);
|
||||
write_int16 (ofw->out, frame_count);
|
||||
for (i = 0; acct->backtrace [i] != NULL; ++i) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче