Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Mantione <massi@mono-cvs.ximian.com>2008-10-12 14:19:05 +0400
committerMassimiliano Mantione <massi@mono-cvs.ximian.com>2008-10-12 14:19:05 +0400
commitdd9a7d00f02bbc2198a9b37724cfbb8c77b00a42 (patch)
treede3b27a8db515c1f85e49f29acf385d6a90a0c33 /Mono.Profiler
parentfee833d8fa2536ae3e9742558dfa459056ccd675 (diff)
Added support for object ids in allocation events.
svn path=/trunk/mono-tools/; revision=115556
Diffstat (limited to 'Mono.Profiler')
-rw-r--r--Mono.Profiler/profiler-decoder-library/BaseTypes.cs29
-rw-r--r--Mono.Profiler/profiler-decoder-library/ChangeLog7
-rw-r--r--Mono.Profiler/profiler-decoder-library/Decoder.cs18
-rw-r--r--Mono.Profiler/profiler-decoder-library/EventProcessor.cs2
4 files changed, 45 insertions, 11 deletions
diff --git a/Mono.Profiler/profiler-decoder-library/BaseTypes.cs b/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
index 78a24d10..9da15374 100644
--- a/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
+++ b/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
@@ -144,7 +144,7 @@ namespace Mono.Profiler {
void ClassStartUnload (LC c, ulong counter);
void ClassEndUnload (LC c, ulong counter);
- void Allocation (LC c, uint size, LM caller, bool jitTime, ulong counter);
+ void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter);
void Exception (LC c, ulong counter);
void MethodEnter (LM m, ulong counter);
@@ -658,6 +658,7 @@ namespace Mono.Profiler {
END = 0,
ALLOCATIONS_CARRY_CALLER = 1,
ALLOCATIONS_HAVE_STACK = 2,
+ ALLOCATIONS_CARRY_ID = 3,
LAST
}
@@ -682,14 +683,25 @@ namespace Mono.Profiler {
allocationsHaveStackTrace = true;
}
+ bool allocationsCarryId;
+ public bool AllocationsCarryId {
+ get {
+ return allocationsCarryId;
+ }
+ }
+ public void AllocationsCarryIdReceived () {
+ allocationsCarryId = true;
+ }
+
public DirectivesHandler () {
allocationsCarryCallerMethod = false;
allocationsHaveStackTrace = false;
+ allocationsCarryId = false;
}
}
public class BaseProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> : IProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> where LC : ILoadedClass where LM : ILoadedMethod<LC> where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID<MR,UFR> where MR : IExecutableMemoryRegion<UFR> where EH : ILoadedElementHandler<LC,LM,UFR,UFI,MR,HO,HS> where HO: IHeapObject<HO,LC> where HS: IHeapSnapshot<HO,LC> {
- DirectivesHandler directives = new DirectivesHandler ();
+ DirectivesHandler directives;
public DirectivesHandler Directives {
get {
return directives;
@@ -705,6 +717,11 @@ namespace Mono.Profiler {
public BaseProfilerEventHandler (EH loadedElements) {
this.loadedElements = loadedElements;
+ this.directives = new DirectivesHandler ();
+ }
+ protected BaseProfilerEventHandler (IProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> baseHandler) {
+ this.loadedElements = baseHandler.LoadedElements;
+ this.directives = baseHandler.Directives;
}
public virtual void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime) {}
@@ -727,7 +744,7 @@ namespace Mono.Profiler {
public virtual void ClassStartUnload (LC c, ulong counter) {}
public virtual void ClassEndUnload (LC c, ulong counter) {}
- public virtual void Allocation (LC c, uint size, LM caller, bool jitTime, ulong counter) {}
+ public virtual void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter) {}
public virtual void Exception (LC c, ulong counter) {}
public virtual void MethodEnter (LM m, ulong counter) {}
@@ -785,7 +802,7 @@ namespace Mono.Profiler {
byte[] data;
TextWriter output;
- public DebugProfilerEventHandler (EH loadedElements, TextWriter output) : base (loadedElements) {
+ public DebugProfilerEventHandler (IProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> baseHandler, TextWriter output) : base (baseHandler) {
this.output = output;
this.data = null;
this.currentOffset = 0;
@@ -841,8 +858,8 @@ namespace Mono.Profiler {
output.WriteLine ("ClassEndUnload");
}
- public override void Allocation (LC c, uint size, LM caller, bool jitTime, ulong counter) {
- output.WriteLine ("Allocation");
+ public override void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter) {
+ output.WriteLine ("Allocation [classId {0}({1}), size {2}, callerId {3}), jitTime {4}, counter {5}]", c.ID, c.Name, size, caller != null ? caller.ID : 0, jitTime, counter);
}
public override void Exception (LC c, ulong counter) {
output.WriteLine ("Exception");
diff --git a/Mono.Profiler/profiler-decoder-library/ChangeLog b/Mono.Profiler/profiler-decoder-library/ChangeLog
index 9b89ce7b..744fca17 100644
--- a/Mono.Profiler/profiler-decoder-library/ChangeLog
+++ b/Mono.Profiler/profiler-decoder-library/ChangeLog
@@ -1,9 +1,14 @@
+2008-10-12 Massimiliano Mantione <massi@ximian.com>
+ * BaseTypes.cs: Added support for object ids in allocation events.
+ * Decoder.cs: Likewise.
+ * EventProcessor.cs: Likewise.
+
2008-10-10 Massimiliano Mantione <massi@ximian.com>
* BaseTypes.cs:
- Added support for handling the stack trace of each allocation event.
- Added a DebugProfilerEventHandler which helps detecting decoder bugs.
* ObjectModel.cs: Likewise.
- * ObjectModel.cs: Likewise.
+ * EventProcessor.cs: Likewise.
* Decoder.cs: Likewise.
2008-09-17 Massimiliano Mantione <massi@ximian.com>
diff --git a/Mono.Profiler/profiler-decoder-library/Decoder.cs b/Mono.Profiler/profiler-decoder-library/Decoder.cs
index 1f5a4b3c..915d7f68 100644
--- a/Mono.Profiler/profiler-decoder-library/Decoder.cs
+++ b/Mono.Profiler/profiler-decoder-library/Decoder.cs
@@ -463,8 +463,12 @@ namespace Mono.Profiler {
if (handler.Directives.AllocationsCarryCallerMethod) {
callerId = ReadUint (ref offsetInBlock);
}
+ ulong objectId = 0;
+ if (handler.Directives.AllocationsCarryId) {
+ objectId = ReadUlong (ref offsetInBlock);
+ }
//LogLine ("BLOCK EVENTS (PACKED:CLASS_ALLOCATION): classId {0}, classSize {1}, callerId {2}", classId, classSize, callerId);
- handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), false, 0);
+ handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), false, objectId, 0);
handler.DataProcessed (offsetInBlock);
break;
}
@@ -695,8 +699,12 @@ namespace Mono.Profiler {
if (handler.Directives.AllocationsCarryCallerMethod) {
callerId = ReadUint (ref offsetInBlock);
}
+ ulong objectId = 0;
+ if (handler.Directives.AllocationsCarryId) {
+ objectId = ReadUlong (ref offsetInBlock);
+ }
//LogLine ("BLOCK EVENTS (OTHER:JIT_TIME_ALLOCATION): classId {0}, classSize {1}, callerId {2}", classId, classSize, callerId);
- handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), true, 0);
+ handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), true, objectId, 0);
handler.DataProcessed (offsetInBlock);
break;
}
@@ -958,6 +966,10 @@ namespace Mono.Profiler {
//LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_HAVE_STACK");
handler.Directives.AllocationsHaveStackTraceReceived ();
break;
+ case DirectiveCodes.ALLOCATIONS_CARRY_ID:
+ //LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_CARRY_ID");
+ handler.Directives.AllocationsCarryIdReceived ();
+ break;
default:
throw new DecodingException (this, offsetInBlock, String.Format ("unknown directive {0}", directive));
}
@@ -1001,7 +1013,7 @@ namespace Mono.Profiler {
handleExceptions = false;
try {
DebugProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> debugHandler =
- new DebugProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> (handler.LoadedElements, debugLog);
+ new DebugProfilerEventHandler<LC,LM,UFR,UFI,MR,EH,HO,HS> (handler, debugLog);
debugLog.WriteLine ("Current block of type {0} (file offset {1}, length {2})", Code, FileOffset, Length);
Decode (debugHandler);
diff --git a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
index cf7e580b..454b7778 100644
--- a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
+++ b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
@@ -207,7 +207,7 @@ namespace Mono.Profiler {
public override void ClassStartUnload (LoadedClass c, ulong counter) {}
public override void ClassEndUnload (LoadedClass c, ulong counter) {}
- public override void Allocation (LoadedClass c, uint size, LoadedMethod caller, bool jitTime, ulong counter) {
+ public override void Allocation (LoadedClass c, uint size, LoadedMethod caller, bool jitTime, ulong objectId, ulong counter) {
StackTrace trace;
if (Directives.AllocationsHaveStackTrace) {