提交 01ee42b1 编写于 作者: L Luo Tao

fix compile error in profiler.cc

上级 e94db381
...@@ -183,35 +183,35 @@ void ParseEvents(std::vector<std::vector<Event>>& events, ...@@ -183,35 +183,35 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
if (g_profiler_place == "") return; if (g_profiler_place == "") return;
std::string sorted_domain; std::string sorted_domain;
std::function<bool(EventItem&, EventItem&)> sorted_func; std::function<bool(const EventItem&, const EventItem&)> sorted_func;
switch (sorted_by) { switch (sorted_by) {
case EventSortingKey::kCalls: case EventSortingKey::kCalls:
sorted_domain = "number of calls"; sorted_domain = "number of calls";
sorted_func = [](EventItem& a, EventItem& b) { sorted_func = [](const EventItem& a, const EventItem& b) {
return a.calls > b.calls; return a.calls > b.calls;
}; };
break; break;
case EventSortingKey::kTotal: case EventSortingKey::kTotal:
sorted_domain = "total time"; sorted_domain = "total time";
sorted_func = [](EventItem& a, EventItem& b) { sorted_func = [](const EventItem& a, const EventItem& b) {
return a.total_time > b.total_time; return a.total_time > b.total_time;
}; };
break; break;
case EventSortingKey::kMin: case EventSortingKey::kMin:
sorted_domain = "minimum time"; sorted_domain = "minimum time";
sorted_func = [](EventItem& a, EventItem& b) { sorted_func = [](const EventItem& a, const EventItem& b) {
return a.min_time > b.min_time; return a.min_time > b.min_time;
}; };
break; break;
case EventSortingKey::kMax: case EventSortingKey::kMax:
sorted_domain = "maximum time"; sorted_domain = "maximum time";
sorted_func = [](EventItem& a, EventItem& b) { sorted_func = [](const EventItem& a, const EventItem& b) {
return a.max_time > b.max_time; return a.max_time > b.max_time;
}; };
break; break;
case EventSortingKey::kAve: case EventSortingKey::kAve:
sorted_domain = "average time"; sorted_domain = "average time";
sorted_func = [](EventItem& a, EventItem& b) { sorted_func = [](const EventItem& a, const EventItem& b) {
return a.ave_time > b.ave_time; return a.ave_time > b.ave_time;
}; };
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册