Esempio n. 1
0
/**
 * Renders the headings for grouped rendering
 *
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 *
 * @return the height of headings rendered
 */
static int32 RenderGroupedHeadings(class FCanvas* Canvas,int X,int32 Y,const bool bIsHierarchy)
{
	// The heading looks like:
	// Stat [32chars]    CallCount [8chars]    IncAvg [8chars]    IncMax [8chars]    ExcAvg [8chars]    ExcMax [8chars]

	static const TCHAR* CaptionFlat = TEXT("Cycle counters (flat)");
	static const TCHAR* CaptionHier = TEXT("Cycle counters (hierarchy)");

	Canvas->DrawShadowedString(X,Y,bIsHierarchy?CaptionHier:CaptionFlat,GetStatRenderGlobals().StatFont,GetStatRenderGlobals().HeadingColor);

	int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("CallCount"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	RightJustify(Canvas,CurrX,Y,TEXT("InclusiveAvg"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("InclusiveMax"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	RightJustify(Canvas,CurrX,Y,TEXT("ExclusiveAvg"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("ExclusiveMax"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	return GetStatRenderGlobals().GetFontHeight() + (GetStatRenderGlobals().GetFontHeight() / 3);
}
Esempio n. 2
0
/**
 * Renders the counter headings for grouped rendering
 *
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 *
 * @return the height of headings rendered
 */
static int32 RenderCounterHeadings(class FCanvas* Canvas,int32 X,int32 Y)
{
	// The heading looks like:
	// Stat [32chars]    Value [8chars]    Average [8chars]

	Canvas->DrawShadowedString(X,Y,TEXT("Counters"),GetStatRenderGlobals().StatFont,GetStatRenderGlobals().HeadingColor);

	// Determine where the first column goes
	int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset;

	// Draw the average column label.
	RightJustify(Canvas,CurrX,Y,TEXT("Average"),GetStatRenderGlobals().HeadingColor);
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	// Draw the max column label.
	RightJustify(Canvas,CurrX,Y,TEXT("Max"),GetStatRenderGlobals().HeadingColor);
	return GetStatRenderGlobals().GetFontHeight() + (GetStatRenderGlobals().GetFontHeight() / 3);
}
Esempio n. 3
0
/**
 * Renders the counter headings for grouped rendering
 *
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 *
 * @return the height of headings rendered
 */
static int32 RenderCounterHeadings(class FCanvas* Canvas,int32 X,int32 Y)
{
	// The heading looks like:
	// Stat [32chars]    Value [8chars]    Average [8chars]

	Canvas->DrawShadowedString(X,Y,TEXT("Counters"),STAT_FONT,StatGlobals.HeadingColor);

	// Determine where the first column goes
	int32 CurrX = X + StatGlobals.AfterNameColumnOffset;

	// Draw the average column label.
	RightJustify(Canvas,CurrX,Y,TEXT("Average"),StatGlobals.HeadingColor);
	CurrX += StatGlobals.InterColumnOffset;

	// Draw the max column label.
	RightJustify(Canvas,CurrX,Y,TEXT("Max"),StatGlobals.HeadingColor);
	return FONT_HEIGHT + (FONT_HEIGHT / 3);
}
Esempio n. 4
0
static int32 RenderCounter(const FGameThreadHudData& ViewData, const FComplexStatMessage& All,class FCanvas* Canvas,int32 X,int32 Y)
{
	// If this is a cycle, render it as a cycle. This is a special case for manually set cycle counters.
	const bool bIsCycle = All.NameAndInfo.GetFlag(EStatMetaFlags::IsCycle);
	if( bIsCycle )
	{
		return RenderCycle( All, Canvas, X, Y, 0, false );
	}

	const bool bDisplayAll = All.NameAndInfo.GetFlag(EStatMetaFlags::ShouldClearEveryFrame);

	// Draw the label
	Canvas->DrawShadowedString(X,Y,*ShortenName(*All.GetDescription()),GetStatRenderGlobals().StatFont,GetStatRenderGlobals().StatColor);
	int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset;

	if( bDisplayAll )
	{
		// Append the average.
		if (All.NameAndInfo.GetField<EStatDataType>() == EStatDataType::ST_double)
		{
			RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%.2f"), All.GetValue_double(EComplexStatField::IncAve)),GetStatRenderGlobals().StatColor);
		}
		else if (All.NameAndInfo.GetField<EStatDataType>() == EStatDataType::ST_int64)
		{
			RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%lld"), All.GetValue_int64(EComplexStatField::IncAve)),GetStatRenderGlobals().StatColor);
		}
	}
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	// Append the maximum.
	if (All.NameAndInfo.GetField<EStatDataType>() == EStatDataType::ST_double)
	{
		RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%.2f"), All.GetValue_double(EComplexStatField::IncMax)),GetStatRenderGlobals().StatColor);
	}
	else if (All.NameAndInfo.GetField<EStatDataType>() == EStatDataType::ST_int64)
	{
		RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%lld"), All.GetValue_int64(EComplexStatField::IncMax)),GetStatRenderGlobals().StatColor);
	}
	return GetStatRenderGlobals().GetFontHeight();
}
Esempio n. 5
0
/**
 * Renders the memory headings for grouped rendering
 *
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 *
 * @return the height of headings rendered
 */
static int32 RenderMemoryHeadings(class FCanvas* Canvas,int32 X,int32 Y)
{
	// The heading looks like:
	// Stat [32chars]    MemUsed [8chars]    PhysMem [8chars]

	// get the size of the spaces, since we can't render the width calculation strings
	int32 StatColumnSpaceSizeX, StatColumnSpaceSizeY;
	int32 TimeColumnSpaceSizeX, TimeColumnSpaceSizeY;
	StringSize(STAT_FONT, StatColumnSpaceSizeX, StatColumnSpaceSizeY, *STAT_COLUMN_WIDTH);
	StringSize(STAT_FONT, TimeColumnSpaceSizeX, TimeColumnSpaceSizeY, *TIME_COLUMN_WIDTH);

	Canvas->DrawShadowedString(X,Y,TEXT("Memory Counters"),STAT_FONT,StatGlobals.HeadingColor);

	// Determine where the first column goes
	int32 CurrX = X + StatGlobals.AfterNameColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedAvg"),StatGlobals.HeadingColor);

	CurrX += StatGlobals.InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedAvg%"),StatGlobals.HeadingColor);

	CurrX += StatGlobals.InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedMax"),StatGlobals.HeadingColor);

	CurrX += StatGlobals.InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedMax%"),StatGlobals.HeadingColor);

	CurrX += StatGlobals.InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemPool"),StatGlobals.HeadingColor);

	CurrX += StatGlobals.InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("Pool Capacity"),StatGlobals.HeadingColor);

	return FONT_HEIGHT + (FONT_HEIGHT / 3);
}
Esempio n. 6
0
/**
 * Renders the memory headings for grouped rendering
 *
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 *
 * @return the height of headings rendered
 */
static int32 RenderMemoryHeadings(class FCanvas* Canvas,int32 X,int32 Y)
{
	// The heading looks like:
	// Stat [32chars]    MemUsed [8chars]    PhysMem [8chars]

	Canvas->DrawShadowedString(X,Y,TEXT("Memory Counters"),GetStatRenderGlobals().StatFont,GetStatRenderGlobals().HeadingColor);

	// Determine where the first column goes
	int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedMax"),GetStatRenderGlobals().HeadingColor);

	CurrX += GetStatRenderGlobals().InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemUsedMax%"),GetStatRenderGlobals().HeadingColor);

	CurrX += GetStatRenderGlobals().InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("MemPool"),GetStatRenderGlobals().HeadingColor);

	CurrX += GetStatRenderGlobals().InterColumnOffset;
	RightJustify(Canvas,CurrX,Y,TEXT("Pool Capacity"),GetStatRenderGlobals().HeadingColor);

	return GetStatRenderGlobals().GetFontHeight() + (GetStatRenderGlobals().GetFontHeight() / 3);
}
Esempio n. 7
0
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();
}
Esempio n. 8
0
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;
}
Esempio n. 9
0
/**
 *
 * @param Item the stat to render
 * @param Canvas the render interface to draw with
 * @param X the X location to start drawing at
 * @param Y the Y location to start drawing at
 * @param Indent Indentation of this cycles, used when rendering hierarchy
 * @param bStackStat If false, this is a non-stack cycle counter, don't render the call count column
 */
static int32 RenderCycle( const FComplexStatMessage& Item, class FCanvas* Canvas, int32 X, int32 Y, const int32 Indent, const bool bStackStat )
{
	FColor Color = GetStatRenderGlobals().StatColor;	

	check(Item.NameAndInfo.GetFlag(EStatMetaFlags::IsCycle));

	const bool bIsInitialized = Item.NameAndInfo.GetField<EStatDataType>() == EStatDataType::ST_int64;

	const int32 IndentWidth = Indent*8;

	if( bIsInitialized )
	{
		const float InMs = FPlatformTime::ToMilliseconds(Item.GetValue_Duration(EComplexStatField::IncAve));
		// Color will be determined by the average value of history
		// If show inclusive and and show exclusive is on, then it will choose color based on inclusive average
		// @TODO yrx 2014-08-21 This is slow, fix this.
		FString CounterName = Item.GetShortName().ToString();
		CounterName.RemoveFromStart(TEXT("STAT_"));
		GEngine->GetStatValueColoration(CounterName, InMs, Color);

		const float MaxMeter = 33.3f; // the time of a "full bar" in ms
		const int32 MeterWidth = GetStatRenderGlobals().AfterNameColumnOffset;

		int32 BarWidth = int32((InMs / MaxMeter) * MeterWidth);
		if (BarWidth > 2)
		{
			if (BarWidth > MeterWidth ) 
			{
				BarWidth = MeterWidth;
			}

			FCanvasBoxItem BoxItem( FVector2D(X + MeterWidth - BarWidth, Y + .4f * GetStatRenderGlobals().GetFontHeight()), FVector2D(BarWidth, 0.2f * GetStatRenderGlobals().GetFontHeight()) );
			BoxItem.SetColor( FLinearColor::Red );
			BoxItem.Draw( Canvas );		
		}
	}

	Canvas->DrawShadowedString(X + IndentWidth, Y, *ShortenName(*Item.GetDescription()), GetStatRenderGlobals().StatFont, Color);

	int32 CurrX = X + GetStatRenderGlobals().AfterNameColumnOffset;
	// Now append the call count
	if( bStackStat )
	{
		if (Item.NameAndInfo.GetFlag(EStatMetaFlags::IsPackedCCAndDuration) && bIsInitialized)
		{
			RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%u"), Item.GetValue_CallCount(EComplexStatField::IncAve)),Color);
		}
		CurrX += GetStatRenderGlobals().InterColumnOffset;
	}

	// Add the two inclusive columns if asked
	if( bIsInitialized )
	{
		RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%1.2f ms"),FPlatformTime::ToMilliseconds(Item.GetValue_Duration(EComplexStatField::IncAve))),Color); 
	}
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	if( bIsInitialized )
	{
		RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%1.2f ms"),FPlatformTime::ToMilliseconds(Item.GetValue_Duration(EComplexStatField::IncMax))),Color);
		
	}
	CurrX += GetStatRenderGlobals().InterColumnOffset;

	if( bStackStat )
	{
		// And the exclusive if asked
		if( bIsInitialized )
		{
			RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%1.2f ms"),FPlatformTime::ToMilliseconds(Item.GetValue_Duration(EComplexStatField::ExcAve))),Color);
		}
		CurrX += GetStatRenderGlobals().InterColumnOffset;

		if( bIsInitialized )
		{
			RightJustify(Canvas,CurrX,Y,*FString::Printf(TEXT("%1.2f ms"),FPlatformTime::ToMilliseconds(Item.GetValue_Duration(EComplexStatField::ExcMax))),Color);
		}
		CurrX += GetStatRenderGlobals().InterColumnOffset;
	}
	return GetStatRenderGlobals().GetFontHeight();
}