const TGraphDataType FGraphDataSource::GetUncachedValueFromIndex( const uint32 FrameIndex ) const
{
	check( FrameIndex < ProfilerSession->GetDataProvider()->GetNumFrames() );
	double Result = 0.0;

	// Hierarchical samples are stored in different location.
	// We skip hierarchical samples to ignore misleading recursion which would be counted twice etc.
	if (GetSampleType() == EProfilerSampleTypes::HierarchicalTime)
	{
		const TMap<uint32, FInclusiveTime>& InclusiveAggregates = ProfilerSession->GetInclusiveAggregateStackStats( FrameIndex );
		const FInclusiveTime* InclusiveTime = InclusiveAggregates.Find( GetStatID() );

		if (InclusiveTime)
		{
			Result = ProfilerSession->GetMetaData()->ConvertCyclesToMS( InclusiveTime->DurationCycles ) * Scale;
		}
	}
	else
	{
		const IDataProviderRef DataProvider = ProfilerSession->GetDataProvider();

		const FIntPoint& IndicesForFrame = DataProvider->GetSamplesIndicesForFrame( FrameIndex );
		const uint32 SampleStartIndex = IndicesForFrame.X;
		const uint32 SampleEndIndex = IndicesForFrame.Y;

		const FProfilerSampleArray& Collection = DataProvider->GetCollection();

		for (uint32 SampleIndex = SampleStartIndex; SampleIndex < SampleEndIndex; SampleIndex++)
		{
			const FProfilerSample& ProfilerSample = Collection[SampleIndex];
			const bool bValidStat = ProfilerSample.StatID() == GetStatID();

			if (bValidStat)
			{
				Result += ProfilerSample.GetDoubleValue() * Scale;
			}
		}
	}

	return (TGraphDataType)Result;
}
Beispiel #2
0
TStatId UGASAbility::GetStatId() const
{
	return GetStatID();
}