Beispiel #1
0
void UCheatManager::LogOutBugItGoToLogFile( const FString& InScreenShotDesc, const FString& InGoString, const FString& InLocString )
{
#if ALLOW_DEBUG_FILES
	// Create folder if not already there

	const FString OutputDir = FPaths::BugItDir() + InScreenShotDesc + TEXT("/");

	IFileManager::Get().MakeDirectory( *OutputDir );
	// Create archive for log data.
	// we have to +1 on the GScreenshotBitmapIndex as it will be incremented by the bugitscreenshot which is processed next tick

	const FString DescPlusExtension = FString::Printf( TEXT("%s%i.txt"), *InScreenShotDesc, GScreenshotBitmapIndex );
	const FString TxtFileName = CreateProfileFilename( DescPlusExtension, false );

	//FString::Printf( TEXT("BugIt%s-%s%05i"), *GEngineVersion.ToString(), *InScreenShotDesc, GScreenshotBitmapIndex+1 ) + TEXT( ".txt" );
	const FString FullFileName = OutputDir + TxtFileName;

	FOutputDeviceFile OutputFile(*FullFileName);
	//FArchive* OutputFile = IFileManager::Get().CreateDebugFileWriter( *(FullFileName), FILEWRITE_Append );


	OutputFile.Logf( TEXT("Dumping BugIt data chart at %s using build %s built from changelist %i"), *FDateTime::Now().ToString(), *GEngineVersion.ToString(), GetChangeListNumberForPerfTesting() );

	const FString MapNameStr = GetWorld()->GetMapName();

	OutputFile.Logf( TEXT("MapName: %s"), *MapNameStr );

	OutputFile.Logf( TEXT("Description: %s"), *InScreenShotDesc );
	OutputFile.Logf( TEXT("%s"), *InGoString );
	OutputFile.Logf( TEXT("%s"), *InLocString );

	OutputFile.Logf( TEXT(" ---=== GameSpecificData ===--- ") );
	DoGameSpecificBugItLog(OutputFile);


	// Flush, close and delete.
	//delete OutputFile;
	OutputFile.TearDown();

	// so here we want to send this bad boy back to the PC
	SendDataToPCViaUnrealConsole( TEXT("UE_PROFILER!BUGIT:"), *(FullFileName) );
#endif // ALLOW_DEBUG_FILES
}
/**
 * Stop writing stats data and finalize the file
 */
void FStatNotifyProvider_BinaryFile::StopWritingStatsFile()
{
	if( File != NULL )
	{
		FArchive& OutputFile = *File;

		// Make sure the stats manager has a fresh list of descriptions for us.  Note that
		// this MUST happen after we've finished capturing stat data, because some stat types
		// are added on-demand, such as script cycle stats
		// @todo: This is a bit sketchy right here, we should avoid hitting the other provider types
		GStatManager.SendNotifiersDescriptions();


		// Write group descriptions
		{
			// Write data chunk tag for 'Script profiler data'
			DWORD DataChunkTag = EStatsDataChunkTag_GroupDescriptions;
			OutputFile << DataChunkTag;

			/* const */ WORD GroupDescriptionCount = GroupDescriptions.Num();
			OutputFile << GroupDescriptionCount;

			for( WORD CurGroupIndex = 0; CurGroupIndex < GroupDescriptionCount; ++CurGroupIndex )
			{
				/* const */ FStatGroupDescriptionData& CurGroupDesc = GroupDescriptions( CurGroupIndex );
				
				WORD ShortGroupID = CurGroupDesc.ID;
				OutputFile << ShortGroupID;
				OutputFile << CurGroupDesc.Name;
			}
		}


		// Write stat descriptions
		{
			// Write data chunk tag for 'Script profiler data'
			DWORD DataChunkTag = EStatsDataChunkTag_StatDescriptions;
			OutputFile << DataChunkTag;

			/* const */ WORD StatDescriptionCount = StatDescriptions.Num();
			OutputFile << StatDescriptionCount;

			for( WORD CurStatIndex = 0; CurStatIndex < StatDescriptionCount; ++CurStatIndex )
			{
				/* const */ FStatDescriptionData& CurStatDesc = StatDescriptions( CurStatIndex );
				
				WORD ShortStatID = CurStatDesc.ID;
				OutputFile << ShortStatID;
				OutputFile << CurStatDesc.Name;
				BYTE ShortStatType = CurStatDesc.StatType;
				OutputFile << ShortStatType;
				WORD ShortGroupID = CurStatDesc.GroupID;
				OutputFile << ShortGroupID;
				BYTE ShortIsScriptFunctionStat = CurStatDesc.bIsScriptFunctionStat;
				OutputFile << ShortIsScriptFunctionStat;
			}
		}

	

		const FString FullFileName = ArchiveFilename;

		// Flush and close the file
		CloseOutputFile();


		warnf(TEXT("UE3Stats: done writing file [%s]"),*(FullFileName));

		SendDataToPCViaUnrealConsole( TEXT("UE_PROFILER!UE3STATS:"), FullFileName );

		// Decrease counter forcing scoped cycle stats to be enabled.
		--GForceEnableScopedCycleStats;

		debugf( TEXT( "Stats System: Finished capturing stat data." ) );

	}
	else
	{
		// File not started yet?
		debugf( TEXT( "Stats System: Stats file capture hasn't been started yet." ) );
	}
}