Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions libkineto/src/output_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ void ChromeTraceLogger::handleTraceStart(
device_properties);

metadataToJSON(metadata);

traceOf_ << fmt::format(
R"JSON(
"displayTimeUnit": "ms",
"baseTimeNanoseconds": {},)JSON",
ChromeTraceBaseTime::singleton().get());

traceOf_ << R"JSON(
"traceEvents": [)JSON";
}
Expand Down Expand Up @@ -681,13 +688,9 @@ void ChromeTraceLogger::finalizeTrace(
#endif // !USE_GOOGLE_LOG

// Putting this here because the last entry MUST not end with a comma.

traceOf_ << fmt::format(R"JSON(
"traceName": "{}",
"displayTimeUnit": "ms",
"baseTimeNanoseconds": {}
}})JSON", fileName_, ChromeTraceBaseTime::singleton().get());
// clang-format on
traceOf_ << fmt::format(R"JSON(
"traceName": "{}"
}})JSON", fileName_);

traceOf_.close();
// On some systems, rename() fails if the destination file exists.
Expand Down