提交 468e257a 编写于 作者: S shibeiji

add log for kernel runtime in order to trace performance

上级 930a1fb0
...@@ -50,12 +50,19 @@ bool KernelRuntime::Run(session::KernelGraph *graph) { ...@@ -50,12 +50,19 @@ bool KernelRuntime::Run(session::KernelGraph *graph) {
bool ret = false; bool ret = false;
auto context_ptr = MsContext::GetInstance(); auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr); MS_EXCEPTION_IF_NULL(context_ptr);
struct timeval start_time, end_time;
(void)gettimeofday(&start_time, nullptr);
bool is_task_sink = context_ptr->enable_task_sink(); bool is_task_sink = context_ptr->enable_task_sink();
if (is_task_sink) { if (is_task_sink) {
ret = RunTask(graph); ret = RunTask(graph);
} else { } else {
ret = LaunchKernel(graph); ret = LaunchKernel(graph);
} }
(void)gettimeofday(&end_time, nullptr);
const uint64_t kUSecondInSecond = 1000000;
uint64_t cost = kUSecondInSecond * static_cast<uint64_t>(end_time.tv_sec - start_time.tv_sec);
cost += static_cast<uint64_t>(end_time.tv_usec - start_time.tv_usec);
MS_LOG(INFO) << "Call MS Run Success in " << cost << " us";
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册