| 1316 | |
| 1317 | template<typename FrameMetricsT> |
| 1318 | void UpdateCsvT( |
| 1319 | PMTraceSession const& pmSession, |
| 1320 | ProcessInfo* processInfo, |
| 1321 | PresentEvent const& p, |
| 1322 | FrameMetricsT const& metrics) |
| 1323 | { |
| 1324 | auto const& args = GetCommandLineArgs(); |
| 1325 | |
| 1326 | // Early return if not outputing to CSV. |
| 1327 | if (args.mCSVOutput == CSVOutput::None) { |
| 1328 | return; |
| 1329 | } |
| 1330 | |
| 1331 | // Don't output dropped frames (if requested). |
| 1332 | auto presented = p.FinalState == PresentResult::Presented; |
| 1333 | if (args.mExcludeDropped && !presented) { |
| 1334 | return; |
| 1335 | } |
| 1336 | |
| 1337 | // Get/create file |
| 1338 | FILE** fp = args.mMultiCsv |
| 1339 | ? &processInfo->mOutputCsv |
| 1340 | : &gGlobalOutputCsv; |
| 1341 | |
| 1342 | if (*fp == nullptr) { |
| 1343 | if (args.mCSVOutput == CSVOutput::File) { |
| 1344 | wchar_t path[MAX_PATH]; |
| 1345 | GenerateFilename(path, processInfo->mModuleName, p.ProcessId); |
| 1346 | if (_wfopen_s(fp, path, L"w,ccs=UTF-8")) { |
| 1347 | return; |
| 1348 | } |
| 1349 | } else { |
| 1350 | *fp = stdout; |
| 1351 | } |
| 1352 | |
| 1353 | WriteCsvHeader<FrameMetricsT>(*fp); |
| 1354 | } |
| 1355 | |
| 1356 | // Output in CSV format |
| 1357 | WriteCsvRow(*fp, pmSession, *processInfo, p, metrics); |
| 1358 | } |
| 1359 | |
| 1360 | template<typename FrameMetricsT> |
| 1361 | void UpdateCsvT( |
no test coverage detected