未验证 提交 f3d59232 编写于 作者: Y Yibing Liu 提交者: GitHub

Merge pull request #8116 from kuke/fix_profiler

Fix the error when sorted_key is none in profiler
......@@ -233,7 +233,7 @@ void ParseEvents(std::vector<std::vector<Event>>& events,
};
break;
default:
sorted_domain = "event end time";
sorted_domain = "event first end time";
}
std::vector<std::vector<EventItem>> events_table;
......
......@@ -103,10 +103,10 @@ def profiler(state, sorted_key=None):
core.enable_profiler(prof_state)
yield
if sorted_key not in ['calls', 'total', 'max', 'min', 'ave']:
raise ValueError("The state must be in 'calls', 'total', "
"'max', 'min', 'ave'")
sorted_key = 'default' if sorted_key is None else sorted_key
if sorted_key not in ['default', 'calls', 'total', 'max', 'min', 'ave']:
raise ValueError("The sorted_key must be None or in 'calls', 'total', "
"'max', 'min' and 'ave'")
key_map = {
'default': core.EventSortingKey.kDefault,
'calls': core.EventSortingKey.kCalls,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册