提交 be655168 编写于 作者: Y Yibing Liu

Fix the error when sorted_key is none in profiler

上级 b60da672
......@@ -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.
先完成此消息的编辑!
想要评论请 注册