[libinspect] Sort numeric values numerically.
All metric/property/children keys are strings in inspect, but sometimes lexicographic sorting is not desired. For example, values with numeric keys make the most sense to sort numerically. This change changes the logic to the following: - If all children of a node have keys consisting of digits, sort numerically. - Otherwise, sort lexicographically. - Perform the above for metrics and properties as well. This behavior makes a sensible default based on current use cases. Future use cases may implement their own sorting if needed. CF-684: #done Change-Id: I378dfa7ce60e51252139e14bb3c9ccc14ef7eb72
Showing
- garnet/public/lib/inspect/hierarchy.cc 38 additions, 11 deletionsgarnet/public/lib/inspect/hierarchy.cc
- garnet/public/lib/inspect/hierarchy.h 3 additions, 0 deletionsgarnet/public/lib/inspect/hierarchy.h
- garnet/public/lib/inspect/tests/BUILD.gn 1 addition, 0 deletionsgarnet/public/lib/inspect/tests/BUILD.gn
- garnet/public/lib/inspect/tests/hierarchy_unittest.cc 92 additions, 0 deletionsgarnet/public/lib/inspect/tests/hierarchy_unittest.cc
Loading
Please register or sign in to comment