File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -50,19 +50,20 @@ bool WasmEngine::benchmarkingEnabled = false;
5050
5151void WasmEngine::collectBenchmarkingData ()
5252{
53- constexpr auto to_us = [](clock::duration d) {
54- return std::chrono::duration_cast<std::chrono::microseconds>(d).count ();
53+ // Convert duration to string with microsecond units.
54+ constexpr auto to_us_str = [](clock::duration d) {
55+ return std::to_string (std::chrono::duration_cast<std::chrono::microseconds>(d).count ());
5556 };
5657
5758 const auto now = clock::now ();
5859 const auto instantiationDuration = executionStartTime - instantiationStartTime;
5960 const auto executionDuration = now - executionStartTime;
6061
61- std::cerr << " Time [us]: " << to_us (instantiationDuration + executionDuration) << " = "
62- << to_us (instantiationDuration) << " + " << to_us (executionDuration) << " \n " ;
63-
64- std::ofstream f{ " hera_benchmarks.csv " , std::ios::out | std::ios::app} ;
65- f << to_us (instantiationDuration) << ' , ' << to_us (executionDuration) << ' \n ' ;
62+ const auto log = " Time [us]: " + to_us_str (instantiationDuration + executionDuration) +
63+ " (instantiation: " + to_us_str (instantiationDuration) +
64+ " , execution: " + to_us_str (executionDuration) + " ) \n " ;
65+ std::cerr << log ;
66+ std::ofstream{ " hera_benchmarks.log " , std::ios::out | std::ios::app} << log ;
6667}
6768
6869#if HERA_DEBUGGING
You can’t perform that action at this time.
0 commit comments