예제 #1
0
void FProfilerManager::LoadProfilerCapture( const FString& ProfilerCaptureFilepath, const bool bAdd /*= false*/ )
{
	// deselect the active session
	if (ActiveSession.IsValid())
	{
		SessionManager->SelectSession(NULL);
	}

	if( bAdd == false )
	{
		ClearStatsAndInstances();
	}

	FProfilerSessionRef ProfilerSession = MakeShareable( new FProfilerSession( ProfilerCaptureFilepath ) );
	auto Var = ProfilerSession->AsShared();
	const FGuid ProfilerInstanceID = ProfilerSession->GetInstanceID();

	ProfilerSession->
		SetOnCaptureFileProcessed( FProfilerSession::FCaptureFileProcessedDelegate::CreateSP( this, &FProfilerManager::ProfilerSession_OnCaptureFileProcessed ) )
		.SetOnAddThreadTime( FProfilerSession::FAddThreadTimeDelegate::CreateSP( this, &FProfilerManager::ProfilerSession_OnAddThreadTime ) );

	ProfilerSessionInstances.Add( ProfilerInstanceID, ProfilerSession );
	{
		PROFILER_SCOPE_LOG_TIME( TEXT( "ProfilerClient->LoadCapture" ), );
		ProfilerClient->LoadCapture( ProfilerCaptureFilepath, ProfilerInstanceID );
	}

	SessionInstancesUpdatedEvent.Broadcast();
	ProfilerType = EProfilerSessionTypes::StatsFile;
	
	GetProfilerWindow()->ManageEventGraphTab( ProfilerInstanceID, true, ProfilerSession->GetName() );
	SetViewMode( EProfilerViewMode::LineIndexBased );
}