Skip to content

Commit

Permalink
Update statistics display
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Oct 5, 2023
1 parent 1810b2a commit 8e7c0be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cpp/piscsi_interface.proto
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ enum PbStatisticsCategory {
NO_CATEGORY = 0;
INFO = 1;
ERROR = 2;
}
}

message PbStatistics {
PbStatisticsCategory category = 1;
Expand Down
8 changes: 4 additions & 4 deletions cpp/scsictl/scsictl_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ string ScsictlDisplay::DisplayStatisticsInfo(const PbStatisticsInfo& statistics_

s << "Statistics:\n";

map<string, PbStatistics, less<>> sorted_statistics;
multimap<string, PbStatistics, less<>> sorted_statistics;
for (const auto& statistics : statistics_info.statistics()) {
sorted_statistics[statistics.key()] = statistics;
sorted_statistics.emplace(PbStatisticsCategory_Name(statistics.category()), statistics);
}

for (const auto& [key, statistics] : sorted_statistics) {
s << " " << key << ": " << statistics.value() << " (" << PbStatisticsCategory_Name(statistics.category()) << ")\n";
for (const auto& [category, statistics] : sorted_statistics) {
s << " " << category << " " << statistics.key() << ": " << statistics.value() << '\n';
}

return s.str();
Expand Down

0 comments on commit 8e7c0be

Please sign in to comment.