Skip to content

Commit b9ce55f

Browse files
authored
Merge pull request #7290 from luotao1/profiler
fix compile error in profiler.cc
2 parents 41307c7 + 01ee42b commit b9ce55f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

paddle/platform/profiler.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,35 +183,35 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
183183
if (g_profiler_place == "") return;
184184

185185
std::string sorted_domain;
186-
std::function<bool(EventItem&, EventItem&)> sorted_func;
186+
std::function<bool(const EventItem&, const EventItem&)> sorted_func;
187187
switch (sorted_by) {
188188
case EventSortingKey::kCalls:
189189
sorted_domain = "number of calls";
190-
sorted_func = [](EventItem& a, EventItem& b) {
190+
sorted_func = [](const EventItem& a, const EventItem& b) {
191191
return a.calls > b.calls;
192192
};
193193
break;
194194
case EventSortingKey::kTotal:
195195
sorted_domain = "total time";
196-
sorted_func = [](EventItem& a, EventItem& b) {
196+
sorted_func = [](const EventItem& a, const EventItem& b) {
197197
return a.total_time > b.total_time;
198198
};
199199
break;
200200
case EventSortingKey::kMin:
201201
sorted_domain = "minimum time";
202-
sorted_func = [](EventItem& a, EventItem& b) {
202+
sorted_func = [](const EventItem& a, const EventItem& b) {
203203
return a.min_time > b.min_time;
204204
};
205205
break;
206206
case EventSortingKey::kMax:
207207
sorted_domain = "maximum time";
208-
sorted_func = [](EventItem& a, EventItem& b) {
208+
sorted_func = [](const EventItem& a, const EventItem& b) {
209209
return a.max_time > b.max_time;
210210
};
211211
break;
212212
case EventSortingKey::kAve:
213213
sorted_domain = "average time";
214-
sorted_func = [](EventItem& a, EventItem& b) {
214+
sorted_func = [](const EventItem& a, const EventItem& b) {
215215
return a.ave_time > b.ave_time;
216216
};
217217
break;

0 commit comments

Comments
 (0)