Lunderberg commented on a change in pull request #9300:
URL: https://github.com/apache/tvm/pull/9300#discussion_r730117435



##########
File path: src/runtime/profiling.cc
##########
@@ -407,18 +407,19 @@ String ReportNode::AsTable(bool sort, bool aggregate) 
const {
   }
 
   // Table formatting
-  std::unordered_set<std::string> unique_headers;
+  std::set<std::string> unique_headers;
 
   for (auto row : aggregated_calls) {
     for (auto p : row) {
       unique_headers.insert(p.first);
     }
   }
 
-  std::vector<std::string> headers = {"Name", "Duration (us)",
-                                      "Percent"};  // always include these 
headers
+  // always include these headers in this order
+  std::vector<std::string> headers = {"Name",   "Duration (us)", "Percent",
+                                      "Device", "Count",         "Argument 
Shapes"};
   for (auto header : unique_headers) {
-    if (header != "Name" && header != "Duration (us)" && header != "Percent") {
+    if (std::find(headers.begin(), headers.end(), header) == headers.end()) {

Review comment:
       Are we worried about this being quadratic in the number of unique 
headers, or will there always be a small number?

##########
File path: src/runtime/profiling.cc
##########
@@ -407,18 +407,19 @@ String ReportNode::AsTable(bool sort, bool aggregate) 
const {
   }
 
   // Table formatting
-  std::unordered_set<std::string> unique_headers;
+  std::set<std::string> unique_headers;
 
   for (auto row : aggregated_calls) {
     for (auto p : row) {
       unique_headers.insert(p.first);
     }
   }
 
-  std::vector<std::string> headers = {"Name", "Duration (us)",
-                                      "Percent"};  // always include these 
headers
+  // always include these headers in this order
+  std::vector<std::string> headers = {"Name",   "Duration (us)", "Percent",
+                                      "Device", "Count",         "Argument 
Shapes"};
   for (auto header : unique_headers) {
-    if (header != "Name" && header != "Duration (us)" && header != "Percent") {
+    if (std::find(headers.begin(), headers.end(), header) == headers.end()) {

Review comment:
       Agreed, I just wasn't sure if there were other edge cases.  In that 
case, looks good to me.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to