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-08-20 12:56:46 +0400
committerMassimiliano Mantione <massi@mono-cvs.ximian.com>2008-08-20 12:56:46 +0400
commit52bd37177af30ff8222efd07b63da217af850496 (patch)
treedb17dde5e561e5b33302cc1844f8b5a643d4f710 /Mono.Profiler/profiler-decoder-library
parent7f4e614907b7b88ed90c8008cd6e1d885d6777c1 (diff)
Added support for directives in the log file.
svn path=/trunk/mono-tools/; revision=111087
Diffstat (limited to 'Mono.Profiler/profiler-decoder-library')
-rw-r--r--Mono.Profiler/profiler-decoder-library/BaseTypes.cs35
-rw-r--r--Mono.Profiler/profiler-decoder-library/ChangeLog5
-rw-r--r--Mono.Profiler/profiler-decoder-library/Decoder.cs39
-rw-r--r--Mono.Profiler/profiler-decoder-library/EventProcessor.cs11
4 files changed, 77 insertions, 13 deletions
diff --git a/Mono.Profiler/profiler-decoder-library/BaseTypes.cs b/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
index 5e7ef698..d183447d 100644
--- a/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
+++ b/Mono.Profiler/profiler-decoder-library/BaseTypes.cs
@@ -100,6 +100,8 @@ namespace Mono.Profiler {
HS[] HeapSnapshots {get;}
}
public interface 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 {get;}
+
EH LoadedElements {get;}
void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime);
@@ -122,7 +124,7 @@ namespace Mono.Profiler {
void ClassStartUnload (LC c, ulong counter);
void ClassEndUnload (LC c, ulong counter);
- void Allocation (LC c, uint size);
+ void Allocation (LC c, uint size, LM caller, ulong counter);
void Exception (LC c, ulong counter);
void MethodEnter (LM m, ulong counter);
@@ -627,7 +629,36 @@ namespace Mono.Profiler {
}
}
+ public enum DirectiveCodes {
+ END = 0,
+ ALLOCATIONS_CARRY_CALLER = 1,
+ LAST
+ }
+
+ public class DirectivesHandler {
+ bool allocationsCarryCallerMethod;
+ public bool AllocationsCarryCallerMethod {
+ get {
+ return allocationsCarryCallerMethod;
+ }
+ }
+ public void AllocationsCarryCallerMethodReceived () {
+ allocationsCarryCallerMethod = true;
+ }
+
+ public DirectivesHandler () {
+ allocationsCarryCallerMethod = 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 ();
+ public DirectivesHandler Directives {
+ get {
+ return directives;
+ }
+ }
+
EH loadedElements;
public EH LoadedElements {
get {
@@ -659,7 +690,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) {}
+ public virtual void Allocation (LC c, uint size, LM caller, ulong counter) {}
public virtual void Exception (LC c, ulong counter) {}
public virtual void MethodEnter (LM m, ulong counter) {}
diff --git a/Mono.Profiler/profiler-decoder-library/ChangeLog b/Mono.Profiler/profiler-decoder-library/ChangeLog
index aa588dc9..826cde72 100644
--- a/Mono.Profiler/profiler-decoder-library/ChangeLog
+++ b/Mono.Profiler/profiler-decoder-library/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-20 Massimiliano Mantione <massi@ximian.com>
+ * BaseTypes.cs: Added support for directives in the log file.
+ * Decoder.cs: Likewise.
+ * EventProcessor.cs: Likewise.
+
2008-08-12 Massimiliano Mantione <massi@ximian.com>
* Makefile.am: Fixed for integration into mono-tools;
diff --git a/Mono.Profiler/profiler-decoder-library/Decoder.cs b/Mono.Profiler/profiler-decoder-library/Decoder.cs
index cb852725..3ac4ca3b 100644
--- a/Mono.Profiler/profiler-decoder-library/Decoder.cs
+++ b/Mono.Profiler/profiler-decoder-library/Decoder.cs
@@ -59,7 +59,8 @@ namespace Mono.Profiler {
EVENTS = 6,
STATISTICAL = 7,
HEAP_DATA = 8,
- HEAP_SUMMARY = 9
+ HEAP_SUMMARY = 9,
+ DIRECTIVES = 10
}
public class BlockData {
@@ -442,9 +443,12 @@ namespace Mono.Profiler {
uint classSize = ReadUint (ref offsetInBlock);
classId <<= PACKED_EVENT_DATA_BITS;
classId |= (uint) packedData;
-
- //LogLine ("BLOCK EVENTS (PACKED:CLASS_ALLOCATION): classId {0}, classSize {1}", classId, classSize);
- handler.Allocation (handler.LoadedElements.GetClass (classId), classSize);
+ uint callerId = 0;
+ if (handler.Directives.AllocationsCarryCallerMethod) {
+ callerId = ReadUint (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), 0);
break;
}
case PackedEventCode.CLASS_EVENT: {
@@ -841,10 +845,35 @@ namespace Mono.Profiler {
ulong endTime = ReadUlong (ref offsetInBlock);
handler.AllocationSummaryEnd (collection, endCounter, microsecondsFromEpochToDateTime (endTime));
//LogLine ("BLOCK HEAP_SUMMARY (END): endCounter {0}, endTime {1}", endCounter, endTime);
- Console.WriteLine ("BLOCK HEAP_SUMMARY (END): endCounter {0}, endTime {1}", endCounter, endTime);
handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0);
break;
}
+ case BlockCode.DIRECTIVES : {
+ ulong startCounter = ReadUlong (ref offsetInBlock);
+ ulong startTime = ReadUlong (ref offsetInBlock);
+ handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), 0);
+
+ //LogLine ("BLOCK DIRECTIVES (START): startCounter {0}, startTime {1}", startCounter, startTime);
+ DirectiveCodes directive = (DirectiveCodes) ReadUint (ref offsetInBlock);
+ while (directive != DirectiveCodes.END) {
+ switch (directive) {
+ case DirectiveCodes.ALLOCATIONS_CARRY_CALLER:
+ //LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_CARRY_CALLER");
+ handler.Directives.AllocationsCarryCallerMethodReceived ();
+ break;
+ default:
+ throw new DecodingException (this, offsetInBlock, String.Format ("unknown directive {0}", directive));
+ }
+
+ directive = (DirectiveCodes) ReadUint (ref offsetInBlock);
+ }
+
+ ulong endCounter = ReadUlong (ref offsetInBlock);
+ ulong endTime = ReadUlong (ref offsetInBlock);
+ handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0);
+ //LogLine ("BLOCK DIRECTIVES (END): endCounter {0}, endTime {1}", endCounter, endTime);
+ break;
+ }
default: {
throw new DecodingException (this, offsetInBlock, String.Format ("unknown block code {0}", code));
}
diff --git a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
index 122fe1dd..f865c005 100644
--- a/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
+++ b/Mono.Profiler/profiler-decoder-library/EventProcessor.cs
@@ -207,12 +207,11 @@ 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;
- if ((stack != null) && (stack.StackTop != null)) {
- caller = stack.StackTop.Method;
- } else {
- caller = null;
+ public override void Allocation (LoadedClass c, uint size, LoadedMethod caller, ulong counter) {
+ if (caller == null) {
+ if ((stack != null) && (stack.StackTop != null)) {
+ caller = stack.StackTop.Method;
+ }
}
c.InstanceCreated (size, caller);
}