Beispiel #1
0
        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:
                case TYPE_GC_HANDLE_CREATED_BT:
                    return(HandleCreatedGcEvent.Read(reader, extendedInfo));

                case TYPE_GC_HANDLE_DESTROYED:
                case TYPE_GC_HANDLE_DESTROYED_BT:
                    return(HandleDestroyedGcEvent.Read(reader, extendedInfo));
                }
                throw new InvalidOperationException("unknown gc type:" + extendedInfo);

            case EventType.Heap:
                return(HeapEvent.Read(reader, extendedInfo));

            case EventType.Metadata:
                return(MetadataEvent.Read(reader, extendedInfo));

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

            case EventType.Coverage:
                return(CoverageEvent.Read(reader, extendedInfo));
            }
            throw new InvalidOperationException("invalid event type " + type);
        }
Beispiel #2
0
		public virtual object Visit (MetadataEvent metadataEvent)
		{
			return null;
		}
        private void ReadLogFileChunk_Type(MetadataEvent t)
        {
            if (t.MType != MetadataEvent.MetaDataType.Class)
                return;

            TypeInfo ti = new TypeInfo ();
            ti.Code = t.Pointer + currentPtrBase;
            ti.Name = t.Name;
            ti.FieldsIndex = currentData.FieldCodes.Count;

            int nf = 0;
            /*			uint fcode;
            while ((fcode = reader.ReadUInt32 ()) != 0) {
                fieldCodes.Add (fcode);
                fieldNamesList.Add (reader.ReadString ());
                nf++;
            }*/
            ti.FieldsCount = nf;
            currentData.TypesList.Add (ti);
        }
			public override object Visit (MetadataEvent metadataEvent)
			{
				TimeBase += metadataEvent.TimeDiff;
				switch (metadataEvent.MType) {
				case MetadataEvent.MetaDataType.Thread:
					ThreadContext ctx;
					long threadId = currentBuffer.Header.PtrBase * metadataEvent.Pointer;
					if (!threadDictionary.TryGetValue (threadId, out ctx)) {
						threadDictionary [threadId] = ctx = new ThreadContext () { ThreadId = threadId };
					}
					ctx.Name = metadataEvent.Name;
					break;
				}
				return null;
			}
Beispiel #5
0
 public virtual object Visit(MetadataEvent metadataEvent)
 {
     return(null);
 }
Beispiel #6
0
        public static Event CreateEvent(BinaryReader reader, EventType type, byte extendedInfo)
        {
            switch (type)
            {
            case EventType.Alloc:
                return(AllocEvent.Read(reader, extendedInfo));

            case EventType.Exception:
                switch (extendedInfo & (TYPE_EXCEPTION_BT - 1))
                {
                case TYPE_CLAUSE:
                    return(new ExceptionClauseEvent(reader));

                case TYPE_THROW:
                    return(new ExceptionThrowEvent(reader));

                default:
                    throw new InvalidOperationException("Unknown exception event type:" + (extendedInfo & (TYPE_EXCEPTION_BT - 1)));
                }

            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:
                switch (extendedInfo)
                {
                case TYPE_HEAP_START:
                    return(new HeapStartEvent(reader));

                case TYPE_HEAP_END:
                    return(new HeapEndEvent(reader));

                case TYPE_HEAP_OBJECT:
                    return(new HeapObjectEvent(reader));

                case TYPE_HEAP_ROOT:
                    return(new HeapRootEvent(reader));

                default:
                    throw new InvalidOperationException("Unknown heap event type:" + extendedInfo);
                }

            case EventType.Metadata:
                return(MetadataEvent.Read(reader));

            case EventType.Method:
                switch (extendedInfo)
                {
                case TYPE_LEAVE:
                    return(new MethodLeaveEvent(reader));

                case TYPE_ENTER:
                    return(new MethodEnterEvent(reader));

                case TYPE_EXC_LEAVE:
                    return(new MethodExcLeaveEvent(reader));

                case TYPE_JIT:
                    return(new MethodJitEvent(reader));

                default:
                    throw new InvalidOperationException("Unknown method event type:" + extendedInfo);
                }

            case EventType.Monitor:
                return(MonitiorEvent.Read(reader, extendedInfo));

            case EventType.Sample:
                switch (extendedInfo)
                {
                case TYPE_SAMPLE_HIT:
                    return(new SampleHitEvent(reader));

                case TYPE_SAMPLE_USYM:
                    return(new SampleUSymEvent(reader));

                case TYPE_SAMPLE_UBIN:
                    return(new SampleUBinEvent(reader));

                default:
                    throw new InvalidOperationException("Unknown sample event:" + extendedInfo);
                }
            }
            throw new InvalidOperationException("invalid event type " + type);
        }