Skip to content

Commit

Permalink
csv: add iso date column to live csv
Browse files Browse the repository at this point in the history
  • Loading branch information
breuner committed Sep 2, 2024
1 parent f10ccd0 commit 3244fe8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
15 changes: 15 additions & 0 deletions source/Statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,7 @@ void Statistics::prepLiveCSVFile()
// print table headline...

stream <<
"ISO Date,"
"Label,"
"Phase,"
"RuntimeMS,"
Expand Down Expand Up @@ -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<std::chrono::milliseconds>(
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::milliseconds>
(std::chrono::steady_clock::now() - workersSharedData.phaseStartT);
Expand All @@ -2251,6 +2262,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults)
// print total for all workers...

stream <<
dateStream.str() << "," <<
progArgs.getBenchLabelNoCommas() << "," <<
liveResults.phaseName << "," <<
elapsedMS.count() << "," <<
Expand Down Expand Up @@ -2281,6 +2293,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults)
liveResults.liveOpsPerSec.numEntriesDone;

stream <<
dateStream.str() << "," <<
progArgs.getBenchLabelNoCommas() << "," <<
liveResults.phaseName << "," <<
elapsedMS.count() << "," <<
Expand Down Expand Up @@ -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() << "," <<
Expand Down Expand Up @@ -2384,6 +2398,7 @@ void Statistics::printLiveStatsCSV(const LiveResults& liveResults)
liveResults.numEntriesPerWorker;

stream <<
dateStream.str() << "," <<
progArgs.getBenchLabelNoCommas() << "," <<
liveResults.phaseName << "," <<
elapsedMS.count() << "," <<
Expand Down

0 comments on commit 3244fe8

Please sign in to comment.