Exemple #1
0
 GcEvent(LogFileReader reader)
 {
     TimeDiff = reader.ReadULeb128();
     //EventType = (GcEventType) reader.ReadULeb128 ();
     //Generation = reader.ReadULeb128 ();
     EventType  = (GcEventType)reader.ReadByte();
     Generation = reader.ReadByte();
 }
Exemple #2
0
        public CounterValue(LogFileReader reader, ulong index)
        {
            Index = index;
            //			Type = (uint)reader.ReadULeb128 ();
            Type = reader.ReadByte();
            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));
            }
        }
Exemple #3
0
        ExceptionEvent(LogFileReader reader, byte exinfo)
        {
            TimeDiff = reader.ReadULeb128();
            byte subtype = (byte)(exinfo & ~TYPE_EXCEPTION_BT);

            if (subtype == TYPE_CLAUSE)
            {
                //ClauseType = reader.ReadULeb128 ();
                ClauseType = reader.ReadByte();
                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);
                }
            }
            else
            {
                throw new InvalidOperationException("Unknown exception event type:" + (exinfo & ~TYPE_EXCEPTION_BT));
            }
        }
Exemple #4
0
        public CounterSection(LogFileReader reader)
        {
            Section = reader.ReadULeb128();
            if (Section == MONO_COUNTER_PERFCOUNTERS)
            {
                SectionName = reader.ReadNullTerminatedString();
            }

            Name = reader.ReadNullTerminatedString();
            //Type = reader.ReadULeb128 ();
            //Unit = reader.ReadULeb128 ();
            //Variance = reader.ReadULeb128 ();
            Type     = reader.ReadByte();
            Unit     = reader.ReadByte();
            Variance = reader.ReadByte();
            Index    = reader.ReadULeb128();
        }
Exemple #5
0
        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));
        }
Exemple #6
0
 MetaEvent(LogFileReader reader, byte exinfo)
 {
     TimeDiff = reader.ReadULeb128();
     if (exinfo == TYPE_SYNC_POINT)
     {
         MonoProfilerSyncPointType = reader.ReadByte();
     }
 }
Exemple #7
0
        public readonly int SysId;         //  operating system and architecture identifier

        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();
        }
Exemple #8
0
 public RuntimeJitHelperEvent(LogFileReader reader) : base(reader)
 {
     //			Type = reader.ReadULeb128 ();
     Type          = reader.ReadByte();
     BufferAddress = reader.ReadSLeb128();
     BufferSize    = reader.ReadULeb128();
     if (Type == (ulong)MonoProfilerCodeBufferType.MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE)
     {
         Name = reader.ReadNullTerminatedString();
     }
 }
Exemple #9
0
 Header(LogFileReader reader)
 {
     Console.WriteLine("hoge");
     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 ();
     Args = reader.ReadVarString();
     Arch = reader.ReadVarString();
     OS   = reader.ReadVarString();
 }
Exemple #10
0
        public readonly long Image;         // MonoImage* as a pointer difference from ptr_base

        MetadataEvent(LogFileReader reader, byte extendedInfo)
        {
            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.Assembly:
//				Flags = reader.ReadULeb128 ();
                Name = reader.ReadNullTerminatedString();
                break;

            case MetaDataType.Thread:
                //				Flags = reader.ReadULeb128 ();
                //if (reader.Header.Format < 11 || (reader.Header.Format > 10 && extendedInfo == 0)) {
                //	Name = reader.ReadNullTerminatedString ();
                //}
                if (extendedInfo == 0)
                {
                    Name = reader.ReadNullTerminatedString();
                }
                break;

            case MetaDataType.Domain:
//				Flags = reader.ReadULeb128 ();
                if (extendedInfo == 0)
                {
                    Name = reader.ReadNullTerminatedString();
                }
                break;

            case MetaDataType.Context:
//				Flags = reader.ReadULeb128 ();
                Domain = reader.ReadSLeb128();
                break;

            default:
                throw new ArgumentException("Unknown metadata type: " + MType);
            }
        }
Exemple #11
0
        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)
            {
                //omanuke
                TimeDiff = reader.ReadULeb128();

                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 ();
                    RootRefTypes[n]      = (RootType)reader.ReadByte();
                    RootRefExtraInfos[n] = reader.ReadULeb128();
                }
            }
            else if (exinfo == TYPE_HEAP_OBJECT)
            {
                TimeDiff = reader.ReadULeb128();

                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();
                }
            }
        }
Exemple #12
0
        public HitSampleEvent(LogFileReader reader)
        {
            TimeDiff = reader.ReadULeb128();
            //			SampleType = (SampleType) reader.ReadULeb128 ();
            SampleType = (SampleType)reader.ReadByte();
            //Timestamp = reader.ReadULeb128 ();
            Thread = reader.ReadSLeb128();
            ulong count = reader.ReadULeb128();

            InstructionPointers = new long [count];
            for (uint n = 0; n < count; n++)
            {
                InstructionPointers [n] = reader.ReadSLeb128();
            }

            //Xamarin.Profiler 0.34 doesn't generate data below?

            //ulong mcount = reader.ReadULeb128();
            //Methods = new long[mcount];
            //for (uint n = 0; n < mcount; n++)
            //    Methods[n] = reader.ReadSLeb128();
        }
Exemple #13
0
        public readonly long Image;         // MonoImage* as a pointer difference from ptr_base

        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;
            }
        }