From a79ab5ec5b06874ce581875a2ba1835c48458d39 Mon Sep 17 00:00:00 2001 From: ybrnathan <7902510+ybrnathan@users.noreply.github.com> Date: Wed, 26 Jun 2019 21:58:10 -0700 Subject: [PATCH] Add document for ONNX Runtime latency profiling and JSON file viewing. (#1301) --- docs/ONNX_Runtime_Perf_Tuning.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/ONNX_Runtime_Perf_Tuning.md b/docs/ONNX_Runtime_Perf_Tuning.md index d901beed3abc1..32e7be449be9e 100644 --- a/docs/ONNX_Runtime_Perf_Tuning.md +++ b/docs/ONNX_Runtime_Perf_Tuning.md @@ -89,6 +89,20 @@ whether next task is ready or not. Use PASSIVE if your CPU usage already high, u Yes, we have created a tool named onnxruntime_perf_test.exe, and you find it at the build drop. You can use this tool to test all those knobs easily. Please find the usage of this tool by onnxruntime_perf_test.exe -h +## How to enable profiling and view the generated JSON file? +You can enable ONNX Runtime latency profiling in code: +```python +import onnxruntime as rt + +sess_options = rt.SessionOptions() +enable_profiling.enable_profiling = True +``` +Or, if you are using the onnxruntime_perf_test.exe tool, you can add -p [profile_file] to enable performance profiling. + +In both ways, you will get a JSON file, which contains the detailed performance data (threading, latency of each operator, etc). This file is a standard performance tracing file, and to view it in a user friendly way, you can open it by using chrome://tracing: +* Open chrome browser +* Type chrome://tracing in the address bar +* Load the generated JSON file