Commit 9799d373 authored by Paul Fultz II's avatar Paul Fultz II Committed by mvermeulen
Browse files

Sort instruction in perf report by time (#398)

parent 522da00b
......@@ -538,10 +538,16 @@ void program::perf_report(std::ostream& os, std::size_t n, parameter_map params)
os << std::endl;
os << "Summary:" << std::endl;
for(auto&& p : op_times)
{
auto&& name = p.first;
double avg = p.second;
std::vector<std::pair<double, std::string>> op_times_sorted;
std::transform(op_times.begin(),
op_times.end(),
std::back_inserter(op_times_sorted),
[](auto p) { return std::make_pair(p.second, p.first); });
std::sort(op_times_sorted.begin(), op_times_sorted.end(), std::greater<>{});
for(auto&& p : op_times_sorted)
{
auto&& name = p.second;
double avg = p.first;
double percent = std::ceil(100.0 * avg / total_instruction_time);
os << name << ": " << avg << "ms, " << percent << "%" << std::endl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment