public static Header Read(LogFileReader reader) { if (!reader.LoadData (32)) return null; return new Header (reader); }
public void Read(IProgressListener progress) { Stopwatch watch = new Stopwatch(); watch.Start(); try { if (!File.Exists(name)) { return; } DateTime tim = File.GetLastWriteTime(name); if (tim == timestamp) { return; } timestamp = tim; if (reader == null) { reader = new LogFileReader(name); } ReadLogFile(progress); } catch (Exception ex) { Console.WriteLine(ex); } finally { watch.Stop(); Console.WriteLine("ObjectMapFileReader.Read (): Completed in {0} s", watch.ElapsedMilliseconds / (double)1000); } }
LogBuffer(LogFileReader reader) { this.Header = Header.Read (reader); while (reader.Position < reader.Length) { buffers.Add (Buffer.Read (reader)); } }
Buffer(LogFileReader reader) { Header = BufferHeader.Read (reader); var endPos = reader.Position + Header.Length; while (reader.Position < endPos) { Events.Add (Event.Read (reader)); } }
public readonly ulong Size; // size of the object in the heap #endregion Fields #region Constructors AllocEvent(LogFileReader reader, byte extendedInfo) { TimeDiff = reader.ReadULeb128 (); Ptr = reader.ReadSLeb128 (); Obj = reader.ReadSLeb128 (); Size = reader.ReadULeb128 (); if ((extendedInfo & TYPE_ALLOC_BT) != 0) Backtrace = new Backtrace (reader); }
Header(LogFileReader reader) { Id = reader.ReadInt32 (); if (Id != LogHeaderId) throw new InvalidOperationException ("Id doesn't match."); Major = reader.ReadByte (); Minor = reader.ReadByte (); Format = reader.ReadByte (); PtrSize = reader.ReadByte (); StartupTime = reader.ReadInt64 (); TimerOverhead = reader.ReadInt32 (); Flags = reader.ReadInt32 (); Pid = reader.ReadInt32 (); Port = reader.ReadUInt16 (); SysId = reader.ReadUInt16 (); }
public static Event Read(LogFileReader reader, byte exinfo) { return new MonitiorEvent (reader, exinfo); }
public readonly long Object; // the lock object as a difference from obj_base #endregion Fields #region Constructors MonitiorEvent(LogFileReader reader, byte exinfo) { TimeDiff = reader.ReadULeb128 (); Object = reader.ReadSLeb128 (); byte ev = (byte)((exinfo >> 4) & 0x3); if (ev == MONO_PROFILER_MONITOR_CONTENTION && (exinfo & TYPE_MONITOR_BT) == TYPE_MONITOR_BT) { Backtrace = new Backtrace (reader); } }
MethodEvent(LogFileReader reader, byte exinfo) { TimeDiff = reader.ReadULeb128 (); Method = reader.ReadSLeb128 (); Type = (MethodType)exinfo; if (Type == MethodType.Jit) { CodeAddress = reader.ReadSLeb128 (); CodeSize = reader.ReadULeb128 (); Name = reader.ReadNullTerminatedString (); } }
public static Event Read(LogFileReader reader) { byte info = reader.ReadByte (); EventType type = (EventType)(info & 0xF); byte extendedInfo = (byte)(info & 0xF0); return CreateEvent (reader, type, extendedInfo); }
public CounterValue(LogFileReader reader, ulong index) { Index = index; Type = (uint)reader.ReadULeb128 (); switch ((CounterValueType)Type) { case CounterValueType.MONO_COUNTER_STRING: if (reader.ReadULeb128 () == 1) reader.ReadNullTerminatedString (); break; case CounterValueType.MONO_COUNTER_WORD: case CounterValueType.MONO_COUNTER_INT: case CounterValueType.MONO_COUNTER_LONG: reader.ReadSLeb128 (); break; case CounterValueType.MONO_COUNTER_UINT: case CounterValueType.MONO_COUNTER_ULONG: reader.ReadULeb128 (); break; case CounterValueType.MONO_COUNTER_DOUBLE: reader.ReadUInt64 (); break; default: throw new ArgumentException (String.Format("Unknown Counter Value type {0} [0x{0:x8}], for counter at index {3}, near byte {1} [0x{1:x8}] of {2}.", Type, reader.Position, reader.Length, Index)); } }
public static Event Read(LogFileReader reader, byte extendedInfo) { if (extendedInfo == TYPE_JITHELPER) return new RuntimeJitHelperEvent (reader); throw new ArgumentException ("Unknown `RuntimeEventType`: " + extendedInfo); }
public static new Event Read(LogFileReader reader) { return new ResizeGcEvent (reader); }
HeapEvent(LogFileReader reader, byte exinfo) { if (exinfo == TYPE_HEAP_START) { Type = EventType.Start; TimeDiff = reader.ReadULeb128 (); } else if (exinfo == TYPE_HEAP_END) { Type = EventType.End; TimeDiff = reader.ReadULeb128 (); } else if (exinfo == TYPE_HEAP_ROOT) { Type = EventType.Root; ulong nroots = reader.ReadULeb128 (); reader.ReadULeb128 (); // gcs RootRefs = new long [nroots]; RootRefTypes = new RootType [nroots]; RootRefExtraInfos = new ulong [nroots]; for (ulong n=0; n<nroots; n++) { RootRefs [n] = reader.ReadSLeb128 (); RootRefTypes [n] = (RootType) reader.ReadULeb128 (); RootRefExtraInfos [n] = reader.ReadULeb128 (); } } else if (exinfo == TYPE_HEAP_OBJECT) { Type = EventType.Object; Object = reader.ReadSLeb128 (); Class = reader.ReadSLeb128 (); Size = reader.ReadULeb128 (); ulong num = reader.ReadULeb128 (); ObjectRefs = new long[num]; RelOffset = new ulong[num]; for (ulong i = 0; i < num; i++) { RelOffset [i] = reader.ReadULeb128 (); ObjectRefs [i] = reader.ReadSLeb128 (); } } }
public static new Event Read(LogFileReader reader) { return new HandleDestroyedGcEvent (reader); }
public readonly ulong HandleType; // GC handle type (System.Runtime.InteropServices.GCHandleType) #endregion Fields #region Constructors HandleDestroyedGcEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); HandleType = reader.ReadULeb128 (); Handle = reader.ReadULeb128 (); }
public readonly long ObjAddr; // object pointer differences from obj_base #endregion Fields #region Constructors HandleCreatedGcEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); HandleType = reader.ReadULeb128 (); Handle = reader.ReadULeb128 (); ObjAddr = reader.ReadSLeb128 (); }
public readonly ulong Generation; // GC generation event refers to #endregion Fields #region Constructors GcEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); EventType = (GcEventType) reader.ReadULeb128 (); Generation = reader.ReadULeb128 (); }
public static Event Read(LogFileReader reader, byte exinfo) { return new ExceptionEvent (reader, exinfo); }
public readonly long Object; // the object that was thrown as a difference from obj_base If the TYPE_EXCEPTION_BT flag is set, a backtrace follows. #endregion Fields #region Constructors ExceptionEvent(LogFileReader reader, byte exinfo) { TimeDiff = reader.ReadULeb128 (); byte subtype = (byte)(exinfo & 0x70); if (subtype == TYPE_CLAUSE) { ClauseType = reader.ReadULeb128 (); ClauseNum = reader.ReadULeb128 (); Method = reader.ReadSLeb128 (); } else if (subtype == TYPE_THROW) { Object = reader.ReadSLeb128 (); if ((exinfo & TYPE_EXCEPTION_BT) == TYPE_EXCEPTION_BT) Backtrace = new Backtrace (reader); } }
public readonly long[] ObjAddr; // num_objects object pointer differences from obj_base #endregion Fields #region Constructors MoveGcEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); ulong num = reader.ReadULeb128 (); ObjAddr = new long[num]; for (ulong i = 0; i < num; i++) { ObjAddr [i] = reader.ReadSLeb128 (); } }
public readonly ulong HeapSize; // new heap size #endregion Fields #region Constructors ResizeGcEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); HeapSize = reader.ReadULeb128 (); }
public static Event Read(LogFileReader reader, byte exinfo) { return new HeapEvent (reader, exinfo); }
public RuntimeEvent(LogFileReader reader) { Time = reader.ReadULeb128 (); }
public CountersEvent(LogFileReader reader) { Timestamp = reader.ReadULeb128 (); var index = reader.ReadULeb128 (); while (index != 0) { new CounterValue (reader, index); index = reader.ReadULeb128 (); } }
public RuntimeJitHelperEvent(LogFileReader reader) : base(reader) { Type = reader.ReadULeb128 (); BufferAddress = reader.ReadSLeb128 (); BufferSize = reader.ReadULeb128 (); if (Type == (ulong)MonoProfilerCodeBufferType.MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE) { Name = reader.ReadNullTerminatedString (); } }
public static new Event Read(LogFileReader reader) { return new MetadataEvent (reader); }
public static LogBuffer Read(string fileName) { using (var reader = new LogFileReader (fileName)) { return new LogBuffer (reader); } }
public static Event CreateEvent(LogFileReader reader, EventType type, byte extendedInfo) { switch (type) { case EventType.Alloc: return AllocEvent.Read (reader, extendedInfo); case EventType.Exception: return ExceptionEvent.Read (reader, extendedInfo); case EventType.Gc: switch (extendedInfo) { case TYPE_GC_EVENT: return GcEvent.Read (reader); case TYPE_GC_RESIZE: return ResizeGcEvent.Read (reader); case TYPE_GC_MOVE: return MoveGcEvent.Read (reader); case TYPE_GC_HANDLE_CREATED: return HandleCreatedGcEvent.Read (reader); case TYPE_GC_HANDLE_DESTROYED: return HandleDestroyedGcEvent.Read (reader); } throw new InvalidOperationException ("unknown gc type:" + extendedInfo); case EventType.Heap: return HeapEvent.Read (reader, extendedInfo); case EventType.Metadata: return MetadataEvent.Read (reader); case EventType.Method: return MethodEvent.Read (reader, extendedInfo); case EventType.Monitor: return MonitiorEvent.Read (reader, extendedInfo); case EventType.Sample: return SampleEvent.Read (reader, extendedInfo); case EventType.Runtime: return RuntimeEvent.Read (reader, extendedInfo); } throw new InvalidOperationException ("invalid event type " + type); }
public HitSampleEvent(LogFileReader reader) { SampleType = (SampleType) reader.ReadULeb128 (); Timestamp = reader.ReadULeb128 (); ulong count = reader.ReadULeb128 (); InstructionPointers = new long [count]; for (uint n=0; n<count; n++) InstructionPointers [n] = reader.ReadSLeb128 (); }
public readonly long Pointer; // pointer of the metadata type depending on mtype #endregion Fields #region Constructors MetadataEvent(LogFileReader reader) { TimeDiff = reader.ReadULeb128 (); MType = (MetaDataType)reader.ReadByte (); Pointer = reader.ReadSLeb128 (); switch (MType) { case MetaDataType.Class: Image = reader.ReadSLeb128 (); Flags = reader.ReadULeb128 (); Name = reader.ReadNullTerminatedString (); break; case MetaDataType.Image: Flags = reader.ReadULeb128 (); Name = reader.ReadNullTerminatedString (); break; case MetaDataType.Thread: Flags = reader.ReadULeb128 (); Name = reader.ReadNullTerminatedString (); break; } }