static int32 RenderMemoryCounter(const FGameThreadHudData& ViewData, const FComplexStatMessage& All,class FCanvas* Canvas,int32 X,int32 Y) { FPlatformMemory::EMemoryCounterRegion Region = FPlatformMemory::EMemoryCounterRegion(All.NameAndInfo.GetField<EMemoryRegion>()); const bool bDisplayAll = All.NameAndInfo.GetFlag(EStatMetaFlags::ShouldClearEveryFrame); const float MemUsed = All.GetValue_double(EComplexStatField::IncAve); const float MaxMemUsed = All.GetValue_double(EComplexStatField::IncMax); // Draw the label Canvas->DrawShadowedString(X,Y,*ShortenName(*All.GetDescription()),STAT_FONT,StatGlobals.StatColor); int32 CurrX = X + StatGlobals.AfterNameColumnOffset; if( bDisplayAll ) { // Now append the value of the stat RightJustify(Canvas,CurrX,Y,*GetMemoryString(MemUsed),StatGlobals.StatColor); CurrX += StatGlobals.InterColumnOffset; if (ViewData.PoolCapacity.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%.0f%%"), float(100.0 * MemUsed / double(ViewData.PoolCapacity[Region]))),StatGlobals.StatColor); } CurrX += StatGlobals.InterColumnOffset; } else { CurrX += StatGlobals.InterColumnOffset; CurrX += StatGlobals.InterColumnOffset; } // Now append the max value of the stat RightJustify(Canvas,CurrX,Y,*GetMemoryString(MaxMemUsed),StatGlobals.StatColor); CurrX += StatGlobals.InterColumnOffset; if (ViewData.PoolCapacity.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%.0f%%"), float(100.0 * MaxMemUsed / double(ViewData.PoolCapacity[Region]))),StatGlobals.StatColor); } CurrX += StatGlobals.InterColumnOffset; if (ViewData.PoolAbbreviation.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*ViewData.PoolAbbreviation[Region],StatGlobals.StatColor); } CurrX += StatGlobals.InterColumnOffset; if (ViewData.PoolCapacity.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*GetMemoryString(double(ViewData.PoolCapacity[Region])),StatGlobals.StatColor); } CurrX += StatGlobals.InterColumnOffset; return FONT_HEIGHT; }
static int32 RenderMemoryCounter(const FGameThreadHudData& ViewData, const FComplexStatMessage& All,class FCanvas* Canvas,int32 X,int32 Y) { FPlatformMemory::EMemoryCounterRegion Region = FPlatformMemory::EMemoryCounterRegion(All.NameAndInfo.GetField<EMemoryRegion>()); // At this moment we only have memory stats that are marked as non frame stats, so can't be cleared every frame. //const bool bDisplayAll = All.NameAndInfo.GetFlag(EStatMetaFlags::ShouldClearEveryFrame); const float MaxMemUsed = All.GetValue_double(EComplexStatField::IncMax); // Draw the label Canvas->DrawShadowedString(X,Y,*ShortenName(*All.GetDescription()),GetStatRenderGlobals().StatFont,GetStatRenderGlobals().StatColor); int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset; // always use MB for easier comparisons const bool bAutoType = false; // Now append the max value of the stat RightJustify(Canvas,CurrX,Y,*GetMemoryString(MaxMemUsed, bAutoType),GetStatRenderGlobals().StatColor); CurrX += GetStatRenderGlobals().InterColumnOffset; if (ViewData.PoolCapacity.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%.0f%%"), float(100.0 * MaxMemUsed / double(ViewData.PoolCapacity[Region]))),GetStatRenderGlobals().StatColor); } CurrX += GetStatRenderGlobals().InterColumnOffset; if (ViewData.PoolAbbreviation.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*ViewData.PoolAbbreviation[Region],GetStatRenderGlobals().StatColor); } CurrX += GetStatRenderGlobals().InterColumnOffset; if (ViewData.PoolCapacity.Contains(Region)) { RightJustify(Canvas,CurrX,Y,*GetMemoryString(double(ViewData.PoolCapacity[Region]), bAutoType),GetStatRenderGlobals().StatColor); } CurrX += GetStatRenderGlobals().InterColumnOffset; return GetStatRenderGlobals().GetFontHeight(); }