[profiler_capture_api] more changes based on PR feedback

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-10-29 17:19:38 -07:00
parent b2e6711196
commit 4721f44b92
3 changed files with 5 additions and 11 deletions
@@ -16,12 +16,8 @@ namespace AZ::Debug
{
AZStd::string GenerateOutputFile(const char* nameHint)
{
AZStd::string timeString;
AZStd::to_string(timeString, AZStd::GetTimeNowSecond());
AZ::IO::FixedMaxPathString captureOutput = GetProfilerCaptureLocation();
return AZStd::string::format("%s/capture_%s_%s.json", captureOutput.c_str(), nameHint, timeString.c_str());
return AZStd::string::format("%s/capture_%s_%lld.json", captureOutput.c_str(), nameHint, AZStd::GetTimeNowSecond());
}
void ProfilerCaptureFrame([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments)
@@ -41,7 +37,7 @@ namespace AZ::Debug
{
AZStd::string captureFile = GenerateOutputFile("multi");
AZLOG_INFO("Setting capture file to %s", captureFile.c_str());
profilerSystem->StartCapture(captureFile);
profilerSystem->StartCapture(AZStd::move(captureFile));
}
}
AZ_CONSOLEFREEFUNC(ProfilerStartCapture, AZ::ConsoleFunctorFlags::DontReplicate, "Start a multi-frame capture of profiling data");
@@ -74,7 +74,8 @@ namespace AZ::Debug
->Method("GetCaptureLocation",
[](ProfilerSystemScriptProxy*) -> AZStd::string
{
return AZStd::string(GetProfilerCaptureLocation().c_str());
AZ::IO::FixedMaxPathString captureOutput = GetProfilerCaptureLocation();
return AZStd::string(captureOutput.c_str(), captureOutput.length());
})
->Method("IsActive", ProfilerSystemScriptProxy::WrapMethod<&ProfilerRequests::IsActive>())
@@ -402,13 +402,10 @@ namespace Profiler
AZStd::string ImGuiCpuProfiler::GenerateOutputFile(const char* nameHint)
{
AZStd::string timeString;
AZStd::to_string(timeString, AZStd::GetTimeNowSecond());
AZ::IO::FixedMaxPathString captureOutput = AZ::Debug::GetProfilerCaptureLocation();
const AZ::IO::FixedMaxPathString frameDataFilePath =
AZ::IO::FixedMaxPathString::format("%s/cpu_%s_%s.json", captureOutput.c_str(), nameHint, timeString.c_str());
AZ::IO::FixedMaxPathString::format("%s/cpu_%s_%lld.json", captureOutput.c_str(), nameHint, AZStd::GetTimeNowSecond());
AZ::IO::FileIOBase::GetInstance()->ResolvePath(m_lastCapturedFilePath, frameDataFilePath.c_str());