本文整理汇总了C++中FArchive::Logf方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::Logf方法的具体用法?C++ FArchive::Logf怎么用?C++ FArchive::Logf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::Logf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpSimpleSet
bool UParticleSystemAuditCommandlet::DumpSimpleSet(TSet<FString>& InSet, const TCHAR* InShortFilename, const TCHAR* InObjectClassName)
{
if (InSet.Num() > 0)
{
check(InShortFilename != NULL);
check(InObjectClassName != NULL);
FArchive* OutputStream = GetOutputFile(InShortFilename);
if (OutputStream != NULL)
{
UE_LOG(LogParticleSystemAuditCommandlet, Log, TEXT("Dumping '%s' results..."), InShortFilename);
OutputStream->Logf(TEXT("%s,..."), InObjectClassName);
for (TSet<FString>::TIterator DumpIt(InSet); DumpIt; ++DumpIt)
{
FString ObjName = *DumpIt;
OutputStream->Logf(TEXT("%s"), *ObjName);
}
OutputStream->Close();
delete OutputStream;
}
else
{
return false;
}
}
return true;
}
示例2: DumpFrameTimesToStatsLog
/**
* Dumps the frame times information to the special stats log file.
*/
void UEngine::DumpFrameTimesToStatsLog( float TotalTime, float DeltaTime, int32 NumFrames, const FString& InMapName )
{
#if ALLOW_DEBUG_FILES
// Create folder for FPS chart data.
const FString OutputDir = CreateOutputDirectory();
// Create archive for log data.
const FString ChartType = GetFPSChartType();
const FString ChartName = OutputDir / CreateFileNameForChart( ChartType, InMapName, TEXT( ".csv" ) );
FArchive* OutputFile = IFileManager::Get().CreateDebugFileWriter( *ChartName );
if( OutputFile )
{
OutputFile->Logf(TEXT("Percentile,Frame (ms), GT (ms), RT (ms), GPU (ms)"));
TArray<float> FrameTimesCopy = GFrameTimes;
TArray<float> GameThreadFrameTimesCopy = GGameThreadFrameTimes;
TArray<float> RenderThreadFrameTimesCopy = GRenderThreadFrameTimes;
TArray<float> GPUFrameTimesCopy = GGPUFrameTimes;
// using selection a few times should still be faster than full sort once,
// since it's linear vs non-linear (O(n) vs O(n log n) for quickselect vs quicksort)
for (int32 Percentile = 25; Percentile <= 75; Percentile += 25)
{
OutputFile->Logf(TEXT("%d,%.2f,%.2f,%.2f,%.2f"), Percentile,
GetPercentileValue(FrameTimesCopy, Percentile) * 1000,
GetPercentileValue(GameThreadFrameTimesCopy, Percentile) * 1000,
GetPercentileValue(RenderThreadFrameTimesCopy, Percentile) * 1000,
GetPercentileValue(GPUFrameTimesCopy, Percentile) * 1000
);
}
OutputFile->Logf(TEXT("Time (sec),Frame (ms), GT (ms), RT (ms), GPU (ms)"));
float ElapsedTime = 0;
for( int32 i=0; i<GFrameTimes.Num(); i++ )
{
OutputFile->Logf(TEXT("%.2f,%.2f,%.2f,%.2f,%.2f"),ElapsedTime,GFrameTimes[i]*1000,GGameThreadFrameTimes[i]*1000,GRenderThreadFrameTimes[i]*1000,GGPUFrameTimes[i]*1000);
ElapsedTime += GFrameTimes[i];
}
delete OutputFile;
}
#endif
}
示例3: Main
int32 UFixupRedirectsCommandlet::Main( const FString& Params )
{
// Retrieve list of all packages in .ini paths.
TArray<FString> PackageList;
FEditorFileUtils::FindAllPackageFiles(PackageList);
if( !PackageList.Num() )
{
return 0;
}
// process the commandline
FString Token;
const TCHAR* CommandLine = *Params;
bool bIsQuietMode = false;
bool bIsTestOnly = false;
bool bShouldRestoreProgress= false;
bool bIsSCCDisabled = false;
bool bUpdateEnginePackages = false;
bool bDeleteRedirects = true;
bool bDeleteOnlyReferencedRedirects = false;
bool bAutoSubmit = false;
bool bSandboxed = IFileManager::Get().IsSandboxEnabled();
while (FParse::Token(CommandLine, Token, 1))
{
if (Token == TEXT("-nowarn"))
{
bIsQuietMode = true;
}
else if (Token == TEXT("-testonly"))
{
bIsTestOnly = true;
}
else if (Token == TEXT("-restore"))
{
bShouldRestoreProgress = true;
}
else if (Token == TEXT("-NoAutoCheckout"))
{
bIsSCCDisabled = true;
}
else if (Token == TEXT("-AutoSubmit"))
{
bAutoSubmit = true;
}
else if (Token == TEXT("-UpdateEnginePackages"))
{
bUpdateEnginePackages = true;
}
else if (Token == TEXT("-NoDelete"))
{
bDeleteRedirects = false;
}
else if (Token == TEXT("-NoDeleteUnreferenced"))
{
bDeleteOnlyReferencedRedirects = true;
}
else if ( Token.Left(1) != TEXT("-") )
{
FPackageName::SearchForPackageOnDisk(Token, &GRedirectCollector.FileToFixup);
}
}
if (bSandboxed)
{
UE_LOG(LogFixupRedirectsCommandlet, Display, TEXT("Running in a sandbox."));
bIsSCCDisabled = true;
bAutoSubmit = false;
bDeleteRedirects = false;
}
bool bShouldSkipErrors = false;
// Setup file Output log in the Saved Directory
const FString ProjectDir = FPaths::GetPath(FPaths::GetProjectFilePath());
const FString LogFilename = FPaths::Combine(*ProjectDir, TEXT("Saved"), TEXT("FixupRedirect"), TEXT("FixupRedirect.log"));
FArchive* LogOutputFile = IFileManager::Get().CreateFileWriter(*LogFilename);
LogOutputFile->Logf(TEXT("[Redirects]"));
/////////////////////////////////////////////////////////////////////
// Display any script code referenced redirects
/////////////////////////////////////////////////////////////////////
TArray<FString> UpdatePackages;
TArray<FString> RedirectorsThatCantBeCleaned;
if (!bShouldRestoreProgress)
{
// load all string asset reference targets, and add fake redirectors for them
GRedirectCollector.ResolveStringAssetReference();
for (int32 RedirIndex = 0; RedirIndex < GRedirectCollector.Redirections.Num(); RedirIndex++)
{
FRedirection& Redir = GRedirectCollector.Redirections[RedirIndex];
UE_LOG(LogFixupRedirectsCommandlet, Warning, TEXT("Boot redirector can't be cleaned: %s(%s) -> %s(%s)"), *Redir.RedirectorName, *Redir.RedirectorPackageFilename, *Redir.DestinationObjectName, *Redir.PackageFilename);
RedirectorsThatCantBeCleaned.AddUnique(Redir.RedirectorName);
}
/////////////////////////////////////////////////////////////////////
//.........这里部分代码省略.........
示例4: ExportText
bool UAnimExporterITP::ExportText(const FExportObjectInnerContext* Context, UObject* Object, const TCHAR* Type, FOutputDevice& Ar, FFeedbackContext* Warn, uint32 PortFlags /*= 0*/)
{
UAnimSequence* AnimSeq = CastChecked<UAnimSequence>(Object);
USkeleton* Skeleton = AnimSeq->GetSkeleton();
const FReferenceSkeleton& RefSkeleton = Skeleton->GetReferenceSkeleton();
USkeletalMesh* SkelMesh = Skeleton->GetPreviewMesh();
if (AnimSeq->SequenceLength == 0.f)
{
// something is wrong
return false;
}
const float FrameRate = AnimSeq->NumFrames / AnimSeq->SequenceLength;
// Open another archive
FArchive* File = IFileManager::Get().CreateFileWriter(*UExporter::CurrentFilename);
// Let's try the header...
File->Logf(TEXT("{"));
File->Logf(TEXT("\t\"metadata\":{"));
File->Logf(TEXT("\t\t\"type\":\"itpanim\","));
File->Logf(TEXT("\t\t\"version\":2"));
File->Logf(TEXT("\t},"));
File->Logf(TEXT("\t\"sequence\":{"));
File->Logf(TEXT("\t\t\"frames\":%d,"), AnimSeq->NumFrames);
File->Logf(TEXT("\t\t\"length\":%f,"), AnimSeq->SequenceLength);
File->Logf(TEXT("\t\t\"bonecount\":%d,"), RefSkeleton.GetNum());
File->Logf(TEXT("\t\t\"tracks\":["));
bool firstOutput = false;
for (int32 BoneIndex = 0; BoneIndex < RefSkeleton.GetNum(); ++BoneIndex)
{
//int32 BoneTreeIndex = Skeleton->GetSkeletonBoneIndexFromMeshBoneIndex(SkelMesh, BoneIndex);
int32 BoneTrackIndex = Skeleton->GetAnimationTrackIndex(BoneIndex, AnimSeq);
if (BoneTrackIndex == INDEX_NONE)
{
// If this sequence does not have a track for the current bone, then skip it
continue;
}
if (firstOutput)
{
File->Logf(TEXT("\t\t\t},"));
}
firstOutput = true;
File->Logf(TEXT("\t\t\t{"));
File->Logf(TEXT("\t\t\t\t\"bone\":%d,"), BoneIndex);
File->Logf(TEXT("\t\t\t\t\"transforms\":["));
float AnimTime = 0.0f;
float AnimEndTime = AnimSeq->SequenceLength;
// Subtracts 1 because NumFrames includes an initial pose for 0.0 second
double TimePerKey = (AnimSeq->SequenceLength / (AnimSeq->NumFrames - 1));
const float AnimTimeIncrement = TimePerKey;
bool bLastKey = false;
// Step through each frame and add the bone's transformation data
while (!bLastKey)
{
const TArray<FBoneNode>& BoneTree = Skeleton->GetBoneTree();
FTransform BoneAtom;
AnimSeq->GetBoneTransform(BoneAtom, BoneTrackIndex, AnimTime, true);
bLastKey = AnimTime >= AnimEndTime;
File->Logf(TEXT("\t\t\t\t\t{"));
FQuat rot = BoneAtom.GetRotation();
// For the root bone, we need to fix-up the rotation because Unreal exports
// animations with Y-forward for some reason (maybe because Maya?)
if (BoneIndex == 0)
{
FQuat addRot(FVector(0.0f, 0.0f, 1.0f), -1.57f);
rot = addRot * rot;
}
File->Logf(TEXT("\t\t\t\t\t\t\"rot\":[%f,%f,%f,%f],"), rot.X, rot.Y, rot.Z, rot.W);
FVector trans = BoneAtom.GetTranslation();
// Sanjay: If it's skeleton retargeting, change the translation to be from the ref pose skeleton
if (BoneTree[BoneIndex].TranslationRetargetingMode == EBoneTranslationRetargetingMode::Skeleton)
{
const FTransform& BoneTransform = RefSkeleton.GetRefBonePose()[BoneIndex];
trans = BoneTransform.GetTranslation();
}
File->Logf(TEXT("\t\t\t\t\t\t\"trans\":[%f,%f,%f]"), trans.X, trans.Y, trans.Z);
if (!bLastKey)
{
File->Logf(TEXT("\t\t\t\t\t},"));
}
else
{
File->Logf(TEXT("\t\t\t\t\t}"));
//.........这里部分代码省略.........
示例5: EndFrame
void FSlateStatCycleCounter::EndFrame(double CurrentTime)
{
// Ensure the overhead is tracked at minimum even if all other detail levels are turned off.
const int32 SLATE_STATS_DETAIL_LEVEL_FORCE_ON = INT_MIN;
SLATE_CYCLE_COUNTER_SCOPE_FLAT_DETAILED(SLATE_STATS_DETAIL_LEVEL_FORCE_ON, GSlateStatsOverhead);
// dump stats hierarchy if one was collected this frame.
if (FSlateStatHierarchy::Get().GetStatEntries().Num() > 0)
{
// Place in the <UE4>\<GAME>\Saved\<InFolderName> folder
FString Filename = FString::Printf(TEXT("%sSlateHierachyStats-%s.csv"), *FPaths::GameSavedDir(), *FDateTime::Now().ToString());
UE_LOG(LogSlate, Log, TEXT("Dumping Slate Hierarchy Stats to %s..."), *Filename);
FArchive* OutputStream = IFileManager::Get().CreateFileWriter(*Filename, EFileWrite::FILEWRITE_NoReplaceExisting);
// some state vars used to print the path of the stat.
const int kMaxDepth = 100;
int32 Path[kMaxDepth] = { 0 };
int32 PathCurrentDepth = -1;
TCHAR PathStr[4 * kMaxDepth] = { 0 };
TCHAR* PathStrCurrent = PathStr;
FSlateStatHierarchy::Get().ComputeExclusiveTimes();
for (const auto& Entry : FSlateStatHierarchy::Get().GetStatEntries())
{
const bool bDescending = Entry.StackDepth > PathCurrentDepth;
const bool bAscending = Entry.StackDepth < PathCurrentDepth;
const bool bOverflow = PathCurrentDepth >= (int32)ARRAY_COUNT(Path);
const int PathPrevDepth = PathCurrentDepth;
PathCurrentDepth = Entry.StackDepth;
if (!bOverflow)
{
if (bDescending)
{
// we always increment the ordinal, so init to -1 so the first value is zero.
Path[PathCurrentDepth] = -1;
// put a dot after the current depth and track the new position to put new depths.
if (PathCurrentDepth > 0)
{
while (*PathStrCurrent != 0) ++PathStrCurrent;
*PathStrCurrent++ = '.';
*PathStrCurrent = 0;
}
}
else if (bAscending)
{
// back up until we find the dot matching our current depth (or get to depth zero)
if (PathCurrentDepth == 0)
{
// we are at level zero, so just back up all the way. Saves us from checking boundaries in the loop below when we are not at zero depth.
PathStrCurrent = PathStr;
}
else
{
int LevelsAscended = 0;
const int LevelsToAscend = PathPrevDepth - PathCurrentDepth;
while (LevelsAscended < LevelsToAscend)
{
// we are not back to level zero, so we know we will find a '.' eventually.
PathStrCurrent -= 2; // back us up before the dot marking this level
// keep backing up until we find the dot for the previous level.
while (*(PathStrCurrent - 1) != '.')
{
--PathStrCurrent;
}
++LevelsAscended;
}
}
}
// increment the ordinal at this depth
++Path[PathCurrentDepth];
FCString::Sprintf(PathStrCurrent, TEXT("%4d"), Path[PathCurrentDepth]);
}
OutputStream->Logf(TEXT("%s,%s,%s,%.8f,%.8f"), PathStr, *Entry.CounterName.ToString(), Entry.CustomName != NAME_None ? *Entry.CustomName.ToString() : TEXT(""), Entry.InclusiveTime*1000, Entry.ExclusiveTime*1000);
//UE_LOG(LogSlate, Log, TEXT("%s,%s,%s,%.8f,%.8f"), PathStr, *Entry.CounterName.ToString(), Entry.CustomName != NAME_None ? *Entry.CustomName.ToString() : TEXT(""), Entry.InclusiveTime*1000, Entry.ExclusiveTime*1000);
}
OutputStream->Close();
delete OutputStream;
OutputStream = nullptr;
UE_LOG(LogSlate, Log, TEXT("Done dumping Slate Hierarchy Stats!"), *Filename);
}
// static state for tracking when to re-average the stats
static double Time = CurrentTime;
static double LastTime = CurrentTime;
static double NumFrames = 0.0;
NumFrames += 1.0;
Time = CurrentTime;
const double Delta = Time - LastTime;
// let things settle down before taking the first real sample
static double NextDelta = GSlateStatsFlatIntervalWindowSec;
// ensure this gets reset every frame.
GAverageInclusiveTimesWereUpdatedThisFrame = false;
// output flat stats if it's time to do so
if (Delta > NextDelta)
{
LastTime = Time;
NumFrames = NumFrames / 1000.0; // convert to ms.
//.........这里部分代码省略.........
示例6: DumpFPSChartToStatsLog
/**
* Dumps the FPS chart information to the special stats log file.
*/
void UEngine::DumpFPSChartToStatsLog( float TotalTime, float DeltaTime, int32 NumFrames, const FString& InMapName )
{
#if ALLOW_DEBUG_FILES
const FString OutputDir = CreateOutputDirectory();
// Create archive for log data.
const FString ChartType = GetFPSChartType();
const FString ChartName = OutputDir / CreateFileNameForChart( ChartType, InMapName, TEXT( ".log" ) );
FArchive* OutputFile = IFileManager::Get().CreateDebugFileWriter( *ChartName, FILEWRITE_Append );
if( OutputFile )
{
OutputFile->Logf(TEXT("Dumping FPS chart at %s using build %s built from changelist %i"), *FDateTime::Now().ToString(), *GEngineVersion.ToString(), GetChangeListNumberForPerfTesting() );
// Get OS info
FString OSMajor;
FString OSMinor;
FPlatformMisc::GetOSVersions(OSMajor, OSMinor);
// Get settings info
const Scalability::FQualityLevels& Quality = GEngine->GetGameUserSettings()->ScalabilityQuality;
OutputFile->Logf(TEXT("Machine info:"));
OutputFile->Logf(TEXT("\tOS: %s %s"), *OSMajor, *OSMinor);
OutputFile->Logf(TEXT("\tCPU: %s %s"), *FPlatformMisc::GetCPUVendor(), *FPlatformMisc::GetCPUBrand());
OutputFile->Logf(TEXT("\tGPU: %s"), *FPlatformMisc::GetPrimaryGPUBrand());
OutputFile->Logf(TEXT("\tResolution Quality: %d"), Quality.ResolutionQuality);
OutputFile->Logf(TEXT("\tView Distance Quality: %d"), Quality.ViewDistanceQuality);
OutputFile->Logf(TEXT("\tAnti-Aliasing Quality: %d"), Quality.AntiAliasingQuality);
OutputFile->Logf(TEXT("\tShadow Quality: %d"), Quality.ShadowQuality);
OutputFile->Logf(TEXT("\tPost-Process Quality: %d"), Quality.PostProcessQuality);
OutputFile->Logf(TEXT("\tTexture Quality: %d"), Quality.TextureQuality);
OutputFile->Logf(TEXT("\tEffects Quality: %d"), Quality.EffectsQuality);
int32 NumFramesBelow30 = 0; // keep track of the number of frames below 30 FPS
float PctTimeAbove30 = 0; // Keep track of percentage of time at 30+ FPS.
int32 NumFramesBelow60 = 0; // keep track of the number of frames below 60 FPS
float PctTimeAbove60 = 0; // Keep track of percentage of time at 60+ FPS.
// Iterate over all buckets, dumping percentages.
for( int32 BucketIndex=0; BucketIndex<ARRAY_COUNT(GFPSChart); BucketIndex++ )
{
// Figure out bucket time and frame percentage.
const float BucketTimePercentage = 100.f * GFPSChart[BucketIndex].CummulativeTime / TotalTime;
const float BucketFramePercentage = 100.f * GFPSChart[BucketIndex].Count / NumFrames;
int32 StartFPS = 0;
int32 EndFPS = 0;
CalcQuantisedFPSRange(BucketIndex, StartFPS, EndFPS);
// Keep track of time spent at 30+ FPS.
if (StartFPS >= 30)
{
PctTimeAbove30 += BucketTimePercentage;
}
else
{
NumFramesBelow30 += GFPSChart[BucketIndex].Count;
}
// Keep track of time spent at 60+ FPS.
if (StartFPS >= 60)
{
PctTimeAbove60 += BucketTimePercentage;
}
else
{
NumFramesBelow60 += GFPSChart[BucketIndex].Count;
}
// Log bucket index, time and frame Percentage.
OutputFile->Logf(TEXT("Bucket: %2i - %2i Time: %5.2f Frame: %5.2f"), StartFPS, EndFPS, BucketTimePercentage, BucketFramePercentage);
}
OutputFile->Logf(TEXT("%i frames collected over %4.2f seconds, disregarding %4.2f seconds for a %4.2f FPS average, %4.2f percent of time spent > 30 FPS, %4.2f percent of time spent > 60 FPS"),
NumFrames,
DeltaTime,
FMath::Max<float>( 0, DeltaTime - TotalTime ),
NumFrames / TotalTime,
PctTimeAbove30, PctTimeAbove60 );
OutputFile->Logf(TEXT("Average GPU frame time: %4.2f ms"), float((GTotalGPUTime / NumFrames)*1000.0));
OutputFile->Logf(TEXT("BoundGameThreadPct: %4.2f BoundRenderThreadPct: %4.2f BoundGPUPct: %4.2f PercentFrames30+: %f PercentFrames60+: %f BoundGameTime: %f BoundRenderTime: %f BoundGPUTime: %f PctTimeAbove30: %f PctTimeAbove60: %f ")
, (float(GNumFramesBound_GameThread)/float(NumFrames))*100.0f
, (float(GNumFramesBound_RenderThread)/float(NumFrames))*100.0f
, (float(GNumFramesBound_GPU)/float(NumFrames))*100.0f
, float(NumFrames - NumFramesBelow30) / float(NumFrames)*100.0f
, float(NumFrames - NumFramesBelow60) / float(NumFrames)*100.0f
, (GTotalFramesBoundTime_GameThread / DeltaTime)*100.0f
, ((GTotalFramesBoundTime_RenderThread)/DeltaTime)*100.0f
, ((GTotalFramesBoundTime_GPU)/DeltaTime)*100.0f
, PctTimeAbove30
, PctTimeAbove60
);
// Dump hitch data
{
OutputFile->Logf( TEXT( "Hitch chart:" ) );
//.........这里部分代码省略.........