diff --git a/projects/hip-tests/samples/1_Utils/hipBusBandwidth/ResultDatabase.cpp b/projects/hip-tests/samples/1_Utils/hipBusBandwidth/ResultDatabase.cpp index 2ec686f260..4be2ea258d 100644 --- a/projects/hip-tests/samples/1_Utils/hipBusBandwidth/ResultDatabase.cpp +++ b/projects/hip-tests/samples/1_Utils/hipBusBandwidth/ResultDatabase.cpp @@ -7,16 +7,22 @@ using namespace std; +#define SORT_RETAIN_ATTS_ORDER 1 + + bool ResultDatabase::Result::operator<(const Result &rhs) const { if (test < rhs.test) return true; if (test > rhs.test) return false; +#if (SORT_RETAIN_ATTS_ORDER == 0) + // For ties, sort by the value of the attribute: if (atts < rhs.atts) return true; if (atts > rhs.atts) return false; +#endif return false; // less-operator returns false on equal } @@ -189,7 +195,8 @@ void ResultDatabase::AddResult(const string &test_orig, void ResultDatabase::DumpDetailed(ostream &out) { vector sorted(results); - sort(sorted.begin(), sorted.end()); + + stable_sort(sorted.begin(), sorted.end()); const int testNameW = 24 ; const int attW = 12; @@ -281,7 +288,8 @@ void ResultDatabase::DumpDetailed(ostream &out) void ResultDatabase::DumpSummary(ostream &out) { vector sorted(results); - sort(sorted.begin(), sorted.end()); + + stable_sort(sorted.begin(), sorted.end()); const int testNameW = 24 ; const int attW = 12; @@ -377,7 +385,7 @@ void ResultDatabase::DumpCsv(string fileName) bool emptyFile; vector sorted(results); - sort(sorted.begin(), sorted.end()); + stable_sort(sorted.begin(), sorted.end()); //Check to see if the file is empty - if so, add the headers emptyFile = this->IsFileEmpty(fileName); diff --git a/projects/hip-tests/samples/1_Utils/hipBusBandwidth/hipBusBandwidth.cpp b/projects/hip-tests/samples/1_Utils/hipBusBandwidth/hipBusBandwidth.cpp index faff9ba6e9..a42a561ac7 100644 --- a/projects/hip-tests/samples/1_Utils/hipBusBandwidth/hipBusBandwidth.cpp +++ b/projects/hip-tests/samples/1_Utils/hipBusBandwidth/hipBusBandwidth.cpp @@ -49,8 +49,8 @@ std::string sizeToString(int size) using namespace std; stringstream ss; if (size < 0) { - // char (09, horiz tab) lexically sorts before " " so will cause Byte values to be displayed before kB. - ss << char(0x09)/*tab*/ << setfill('0') << setw(3) << -size << "B"; + // char (-) lexically sorts before " " so will cause Byte values to be displayed before kB. + ss << "+" << setfill('0') << setw(3) << -size << "By"; } else { ss << size << "kB"; }