From 3244fe8bee1b93c30ecbf1e9521931c4d3e49445 Mon Sep 17 00:00:00 2001 From: Sven Breuner Date: Tue, 3 Sep 2024 00:09:34 +0200 Subject: [PATCH] csv: add iso date column to live csv --- CHANGELOG.md | 1 + source/Statistics.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4e7f9f..915eb02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * AWS SDK build process now tries to recover if it turns out that a previous build did not complete successfully. * Stonewall will no longer get triggered by workers without any work assignments in custom tree mode (e.g. because of very small dataset). * Random IOs are aligned by default now. Corresponding option ` --randalign` has been removed and new option `--norandalign` has been added. +* Live CSV now has a new column for ISO date. ### Fixes * Fixed a segmentation fault when attempting to validate an empty S3 tag set. (Will throw an appropriate error instead.) diff --git a/source/Statistics.cpp b/source/Statistics.cpp index abc6ef5..a5f8363 100644 --- a/source/Statistics.cpp +++ b/source/Statistics.cpp @@ -2194,6 +2194,7 @@ void Statistics::prepLiveCSVFile() // print table headline... stream << + "ISO Date," "Label," "Phase," "RuntimeMS," @@ -2232,6 +2233,16 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults) if(liveCSVFileFD == -1) return; // output file not open => nothing to do + auto now = std::chrono::system_clock::now(); + time_t time = std::chrono::system_clock::to_time_t(now); + auto milliseconds = std::chrono::duration_cast( + now.time_since_epoch()).count() % 1000; + + std::stringstream dateStream; + dateStream << std::put_time(std::localtime(&time), "%FT%T") << "." + << std::setfill('0') << std::setw(3) << milliseconds + << std::put_time(std::localtime(&time), "%z"); + std::chrono::milliseconds elapsedMS = std::chrono::duration_cast (std::chrono::steady_clock::now() - workersSharedData.phaseStartT); @@ -2251,6 +2262,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults) // print total for all workers... stream << + dateStream.str() << "," << progArgs.getBenchLabelNoCommas() << "," << liveResults.phaseName << "," << elapsedMS.count() << "," << @@ -2281,6 +2293,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults) liveResults.liveOpsPerSec.numEntriesDone; stream << + dateStream.str() << "," << progArgs.getBenchLabelNoCommas() << "," << liveResults.phaseName << "," << elapsedMS.count() << "," << @@ -2335,6 +2348,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults) workerPercentDone = (100 * workerDone.numEntriesDone) / liveResults.numEntriesPerWorker; stream << + dateStream.str() << "," << progArgs.getBenchLabelNoCommas() << "," << liveResults.phaseName << "," << elapsedMS.count() << "," << @@ -2384,6 +2398,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults) liveResults.numEntriesPerWorker; stream << + dateStream.str() << "," << progArgs.getBenchLabelNoCommas() << "," << liveResults.phaseName << "," << elapsedMS.count() << "," <<