public bool IsSnapshotTypeEnabled( EProfilingPayloadSubType SubType ) { switch( SubType ) { case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: return GCStartSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: return GCEndSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: return LoadMapStartSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: return LoadMapMidSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: return LoadMapEndSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: return LevelStreamStartSnapshotsCheckBox.Checked; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: return LevelStreamEndSnapshotsCheckBox.Checked; default: throw new ArgumentException(); } }
public bool IsSnapshotTypeEnabled(EProfilingPayloadSubType SubType) { switch (SubType) { case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: return(GCStartSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: return(GCEndSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: return(LoadMapStartSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: return(LoadMapMidSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: return(LoadMapEndSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: return(LevelStreamStartSnapshotsCheckBox.Checked); case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: return(LevelStreamEndSnapshotsCheckBox.Checked); default: throw new ArgumentException(); } }
private static string GetNextSnapshotDescription(EProfilingPayloadSubType SubType, string Tag) { string Result; switch (SubType) { case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: Result = "LoadMap Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: Result = "LoadMap Mid"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: Result = "LoadMap End"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: Result = "GC Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: Result = "GC End"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: Result = "LevelStream Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: Result = "LevelStream End"; break; default: Result = "Snapshot"; break; } Result += " " + SnapshotTypeCounts[(int)SubType]; if (!String.IsNullOrEmpty(Tag)) { Result += ": " + Tag; } SnapshotTypeCounts[(int)SubType]++; return(Result); }
/// <summary> Updates the token with data read from passed in stream and returns whether we've reached the end. </summary> /// <param name="BinaryStream"> Stream to serialize data from </param> public bool ReadNextToken(BinaryReader BinaryStream) { bool bReachedEndOfStream = false; // Initialize to defaults. SubType = EProfilingPayloadSubType.SUBTYPE_Unknown; TextIndex = -1; // Read the pointer and convert to token type by looking at lowest 2 bits. Pointers are always // 4 byte aligned so need to clear them again after the conversion. UInt64 RawPointerData = BinaryStream.ReadUInt64(); Pool = EMemoryPool.MEMPOOL_Main; Type = (EProfilingPayloadType)(RawPointerData & TypeMask); Pointer = RawPointerData & PointerMask; Metrics.Clear(); LoadedLevels.Clear(); CallStackIndex = -1; TagsIndex = -1; ScriptCallstackIndex = -1; ScriptObjectTypeIndex = -1; NewPointer = 0; OldPointer = 0; Size = -1; Payload = 0; DeltaTime = -1.0f; // Serialize based on token type. switch (Type) { // Malloc case EProfilingPayloadType.TYPE_Malloc: { // Get the call stack index. CallStackIndex = BinaryStream.ReadInt32(); // Get the tags index. if (Version >= 7) { TagsIndex = BinaryStream.ReadInt32(); } // Get the size of an allocation. UInt32 UnsignedSize = BinaryStream.ReadUInt32(); // Read GCM data if any. bool bHasGCMData = ReadGCMData(BinaryStream, ref UnsignedSize); // If GCM doesn't exist read script callstack. if (bHasGCMData == false) { ReadScriptCallstack(BinaryStream); } Size = ( int )UnsignedSize; break; } // Free case EProfilingPayloadType.TYPE_Free: { break; } // Realloc case EProfilingPayloadType.TYPE_Realloc: { OldPointer = Pointer; NewPointer = BinaryStream.ReadUInt64(); CallStackIndex = BinaryStream.ReadInt32(); // Get the tags index. if (Version >= 7) { TagsIndex = BinaryStream.ReadInt32(); } UInt32 UnsignedSize = BinaryStream.ReadUInt32(); bool bHasGCMData = ReadGCMData(BinaryStream, ref UnsignedSize); if (bHasGCMData == false) { ReadScriptCallstack(BinaryStream); } Size = ( int )UnsignedSize; break; } // Other case EProfilingPayloadType.TYPE_Other: { SubType = ( EProfilingPayloadSubType )BinaryStream.ReadInt32(); Payload = BinaryStream.ReadUInt32(); // Read subtype. switch (SubType) { // End of stream! case EProfilingPayloadSubType.SUBTYPE_EndOfStreamMarker: { ReadMemoryAllocationsStats(BinaryStream); ReadLoadedLevels(BinaryStream); bReachedEndOfStream = true; break; } case EProfilingPayloadSubType.SUBTYPE_EndOfFileMarker: { break; } case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker: { TextIndex = ( int )Payload; ReadMemoryAllocationsStats(BinaryStream); ReadLoadedLevels(BinaryStream); break; } case EProfilingPayloadSubType.SUBTYPE_FrameTimeMarker: { DeltaTime = BitConverter.ToSingle(System.BitConverter.GetBytes(Payload), 0); TotalTime += DeltaTime; ElapsedTime += DeltaTime; break; } case EProfilingPayloadSubType.SUBTYPE_TextMarker: { TextIndex = ( int )Payload; break; } case EProfilingPayloadSubType.SUBTYPE_MemoryAllocationStats: { ReadMemoryAllocationsStats(BinaryStream); break; } case EProfilingPayloadSubType.SUBTYPE_TotalUsed: case EProfilingPayloadSubType.SUBTYPE_TotalAllocated: case EProfilingPayloadSubType.SUBTYPE_CPUUsed: case EProfilingPayloadSubType.SUBTYPE_CPUSlack: case EProfilingPayloadSubType.SUBTYPE_CPUWaste: case EProfilingPayloadSubType.SUBTYPE_GPUUsed: case EProfilingPayloadSubType.SUBTYPE_GPUSlack: case EProfilingPayloadSubType.SUBTYPE_GPUWaste: case EProfilingPayloadSubType.SUBTYPE_ImageSize: case EProfilingPayloadSubType.SUBTYPE_OSOverhead: { break; } default: { throw new InvalidDataException(); } } break; } } return(!bReachedEndOfStream); }
public virtual void Snapshot(EProfilingPayloadSubType SnapshotType) { }
/// <summary> Updates the token with data read from passed in stream and returns whether we've reached the end. </summary> /// <param name="BinaryStream"> Stream to serialize data from </param> public bool ReadNextToken( BinaryReader BinaryStream ) { bool bReachedEndOfStream = false; // Initialize to defaults. SubType = EProfilingPayloadSubType.SUBTYPE_Unknown; TextIndex = -1; // Read the pointer and convert to token type by looking at lowest 2 bits. Pointers are always // 4 byte aligned so need to clear them again after the conversion. UInt64 RawPointerData = BinaryStream.ReadUInt64(); Pool = EMemoryPool.MEMPOOL_Main; Type = (EProfilingPayloadType)(RawPointerData & TypeMask); Pointer = RawPointerData & PointerMask; Metrics.Clear(); LoadedLevels.Clear(); MemoryAllocationStats.Zero(); CallStackIndex = -1; ScriptCallstackIndex = -1; ScriptObjectTypeIndex = -1; NewPointer = 0; OldPointer = 0; Size = -1; Payload = 0; DeltaTime = -1.0f; // Serialize based on token type. switch( Type ) { // Malloc case EProfilingPayloadType.TYPE_Malloc: { // Get the call stack index. CallStackIndex = BinaryStream.ReadInt32(); // Get the size of an allocation. UInt32 UnsignedSize = BinaryStream.ReadUInt32(); // Read GCM data if any. bool bHasGCMData = ReadGCMData( BinaryStream, ref UnsignedSize ); // If GCM doesn't exist read script callstack. if( bHasGCMData == false ) { ReadScriptCallstack( BinaryStream ); } Size = ( int )UnsignedSize; break; } // Free case EProfilingPayloadType.TYPE_Free: { break; } // Realloc case EProfilingPayloadType.TYPE_Realloc: { OldPointer = Pointer; NewPointer = BinaryStream.ReadUInt64(); CallStackIndex = BinaryStream.ReadInt32(); UInt32 UnsignedSize = BinaryStream.ReadUInt32(); bool bHasGCMData = ReadGCMData( BinaryStream, ref UnsignedSize ); if( bHasGCMData == false ) { ReadScriptCallstack( BinaryStream ); } Size = ( int )UnsignedSize; break; } // Other case EProfilingPayloadType.TYPE_Other: { SubType = ( EProfilingPayloadSubType )BinaryStream.ReadInt32(); Payload = BinaryStream.ReadUInt32(); // Read subtype. switch( SubType ) { // End of stream! case EProfilingPayloadSubType.SUBTYPE_EndOfStreamMarker: { if( Version > 2 ) { ReadMemoryAllocationsStats( BinaryStream ); ReadLoadedLevels( BinaryStream ); ReadMetrics( BinaryStream ); } bReachedEndOfStream = true; break; } case EProfilingPayloadSubType.SUBTYPE_EndOfFileMarker: { break; } case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker: { TextIndex = ( int )Payload; if( Version > 2 ) { ReadMemoryAllocationsStats( BinaryStream ); ReadLoadedLevels( BinaryStream ); ReadMetrics( BinaryStream ); } break; } case EProfilingPayloadSubType.SUBTYPE_FrameTimeMarker: { DeltaTime = BitConverter.ToSingle( System.BitConverter.GetBytes( Payload ), 0 ); TotalTime += DeltaTime; ElapsedTime += DeltaTime; break; } case EProfilingPayloadSubType.SUBTYPE_TextMarker: { TextIndex = ( int )Payload; break; } case EProfilingPayloadSubType.SUBTYPE_MemoryAllocationStats: { ReadMemoryAllocationsStats( BinaryStream ); break; } case EProfilingPayloadSubType.SUBTYPE_TotalUsed: case EProfilingPayloadSubType.SUBTYPE_TotalAllocated: case EProfilingPayloadSubType.SUBTYPE_CPUUsed: case EProfilingPayloadSubType.SUBTYPE_CPUSlack: case EProfilingPayloadSubType.SUBTYPE_CPUWaste: case EProfilingPayloadSubType.SUBTYPE_GPUUsed: case EProfilingPayloadSubType.SUBTYPE_GPUSlack: case EProfilingPayloadSubType.SUBTYPE_GPUWaste: case EProfilingPayloadSubType.SUBTYPE_ImageSize: case EProfilingPayloadSubType.SUBTYPE_OSOverhead: { break; } default: { throw new InvalidDataException(); } } break; } } return !bReachedEndOfStream; }
private static string GetNextSnapshotDescription(EProfilingPayloadSubType SubType, string Tag) { string Result; switch (SubType) { case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Start: Result = "LoadMap Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_Mid: Result = "LoadMap Mid"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LoadMap_End: Result = "LoadMap End"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_Start: Result = "GC Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_GC_End: Result = "GC End"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_Start: Result = "LevelStream Start"; break; case EProfilingPayloadSubType.SUBTYPE_SnapshotMarker_LevelStream_End: Result = "LevelStream End"; break; default: Result = "Snapshot"; break; } Result += " " + SnapshotTypeCounts[(int)SubType]; if (!String.IsNullOrEmpty(Tag)) { Result += ": " + Tag; } SnapshotTypeCounts[(int)SubType]++; return Result; }
public virtual void Snapshot( EProfilingPayloadSubType SnapshotType ) { }