示例#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);
        }
示例#2
0
		public virtual object Visit (HeapEvent heapEvent)
		{
			return null;
		}
示例#3
0
        private void ReadLogFileChunk_Object(HeapEvent he)
        {
            if (he.Type == HeapEvent.EventType.Start) {
                Console.WriteLine ("ppe: START");
                return;
            }
            else if (he.Type == HeapEvent.EventType.End) {
                Console.WriteLine ("ppe: END");
                HeapSnapshot shot = new HeapSnapshot ();
                shotCount++;
                shot.Build (shotCount.ToString (), currentData);
                AddShot (shot);
            }
            if (he.Type == HeapEvent.EventType.Object) {
                ObjectInfo ob = new ObjectInfo ();
                ob.Code = currentObjBase + he.Object;
                ob.Size = he.Size;
                ob.RefsIndex = currentData.ReferenceCodes.Count;
                ob.RefsCount = he.ObjectRefs != null ? he.ObjectRefs.Length : 0;
                currentData.ObjectTypeCodes.Add (currentPtrBase + he.Class);
                totalMemory += ob.Size;
                if (ob.Size != 0)
                    currentData.RealObjectCount++;

                // Read referenceCodes

                ulong lastOff = 0;
                for (int n=0; n < ob.RefsCount; n++) {
                    currentData.ReferenceCodes.Add (he.ObjectRefs [n] + currentObjBase);
                    lastOff += he.RelOffset [n];
                    currentData.FieldReferenceCodes.Add (lastOff);
                }
                currentData.ObjectsList.Add (ob);
            }
            else if (he.Type == HeapEvent.EventType.Root) {
                for (int n=0; n<he.RootRefs.Length; n++) {
                    ObjectInfo ob = new ObjectInfo ();
                    ob.Size = 0;
                    ob.RefsIndex = currentData.ReferenceCodes.Count;
                    ob.RefsCount = 1;
                    long type = UnknownTypeId;
                    switch (he.RootRefTypes [n] & HeapEvent.RootType.TypeMask) {
                    case HeapEvent.RootType.Stack: type = -2; ob.Code = StackObjectId; break;
                    case HeapEvent.RootType.Finalizer: type = -3; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Handle: type = -4; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Other: type = -5; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Misc: type = -6; ob.Code = --rootId; break;
                    default:
                        Console.WriteLine ("pp1:"); break;
                    }
                    currentData.ObjectTypeCodes.Add (type);
                    currentData.ReferenceCodes.Add (he.RootRefs [n] + currentObjBase);
                    currentData.FieldReferenceCodes.Add (0);
                    currentData.ObjectsList.Add (ob);
                    currentData.RealObjectCount++;
                }
            }
        }
示例#4
0
			public override object Visit (HeapEvent heapEvent)
			{
				TimeBase += heapEvent.TimeDiff;
				return null;
			}
示例#5
0
 public virtual object Visit(HeapEvent heapEvent)
 {
     return(null);
 }