@@ -44,6 +44,8 @@ class Result {
4444 enum Operation { WRITE , TRIM , OVERWRITE , READ , FALLOCATE };
4545 static std::vector<Result> results;
4646 static std::map<std::string, std::string> metas;
47+ static std::map<Action, std::chrono::nanoseconds> total_duration_per_action;
48+ static std::map<Action, DataSize<DataUnit::B>> total_size_per_action;
4749
4850private:
4951 int _iteration;
@@ -85,7 +87,17 @@ class Result {
8587 void setExtentsCount (int64_t extents_count) { _total_extents_count = extents_count; }
8688 void setFileExtentCount (int64_t file_extent_count) { _file_extent_count = file_extent_count; }
8789
88- void commit () { results.push_back (*this ); }
90+ void commit () {
91+ results.push_back (*this );
92+ if (total_duration_per_action.find (_action) == total_duration_per_action.end ()) {
93+ total_duration_per_action[_action] = std::chrono::nanoseconds (0 );
94+ }
95+ if (total_size_per_action.find (_action) == total_size_per_action.end ()) {
96+ total_size_per_action[_action] = DataSize<DataUnit::B>(0 );
97+ }
98+ total_duration_per_action[_action] += _duration;
99+ total_size_per_action[_action] += _size;
100+ }
89101
90102 static constexpr const char * actionToString (Action action) {
91103 switch (action) {
@@ -202,6 +214,20 @@ class Result {
202214 table.format ().font_align (tabulate::FontAlign::center).border_left (" |" ).border_right (" |" );
203215
204216 std::cout << table << std::endl;
217+ // print total duration and total size per action
218+ std::cout << " Total Duration per Action (seconds):" << std::endl;
219+ for (const auto & action : usedActions) {
220+ if (total_duration_per_action.find (action) != total_duration_per_action.end ()) {
221+ std::cout << " " << actionToString (action) << " : " << std::chrono::duration_cast<std::chrono::seconds>(total_duration_per_action[action]).count () << " s" << std::endl;
222+ }
223+ }
224+ std::cout << " Total Size per Action (MB):" << std::endl;
225+ for (const auto & action : usedActions) {
226+ if (total_size_per_action.find (action) != total_size_per_action.end ()) {
227+ DataSize<DataUnit::MB > total_size_per_action_mb = total_size_per_action[action];
228+ std::cout << " " << actionToString (action) << " : " << fmt::format (" {}" , total_size_per_action_mb) << std::endl;
229+ }
230+ }
205231 }
206232
207233 static std::vector<Result> getActionResults (Action action) {
0 commit comments