|
tvm
|
#include <profiling.h>
Public Member Functions | |
| Profiler (std::vector< Device > devs, std::vector< MetricCollector > metric_collectors, std::unordered_map< ffi::String, ffi::Any > configuration={}) | |
| void | Start () |
| Start the profiler. More... | |
| void | Stop () |
| Stop the profiler. More... | |
| void | StartCall (ffi::String name, Device dev, std::unordered_map< std::string, ffi::Any > extra_metrics={}) |
| Start a function call. More... | |
| void | StopCall (std::unordered_map< std::string, ffi::Any > extra_metrics={}) |
Stop the last StartCall. More... | |
| profiling::Report | Report () |
A report of total runtime between Start and Stop as well as individual statistics for each StartCall-StopCall pair. More... | |
| bool | IsRunning () const |
| Check if the profiler is currently running. More... | |
Runtime profiler for function and/or operator calls. Used in the graph runtime and VM to provide profiling information for all operators.
Example usage:
|
explicit |
Constructor.
The profiler should be constructed before you do any warmup iterations.
| devs | The list of devices the profiler will be running on. Should include all devices used by profiled operators. |
| metric_collectors | Additional MetricCollectors to use with this profiler. |
| configuration | Additional configuration data to add to the outputted profiling report. |
|
inline |
Check if the profiler is currently running.
| profiling::Report tvm::runtime::profiling::Profiler::Report | ( | ) |
A report of total runtime between Start and Stop as well as individual statistics for each StartCall-StopCall pair.
Report that can either be formatted as CSV (with .AsCSV) or as a human readable table (with .AsTable). | void tvm::runtime::profiling::Profiler::Start | ( | ) |
Start the profiler.
This function should only be called once per object.
| void tvm::runtime::profiling::Profiler::StartCall | ( | ffi::String | name, |
| Device | dev, | ||
| std::unordered_map< std::string, ffi::Any > | extra_metrics = {} |
||
| ) |
Start a function call.
| name | The name of the function being called. |
| dev | The device on which the function is running. |
| extra_metrics | Optional additional profiling information to add to the frame (input sizes, allocations). |
StartCall may be nested, but each StartCall needs a matching StopCall. Function calls are stopped in LIFO order, so calls to StartCall and StopCall must be nested properly.
| void tvm::runtime::profiling::Profiler::Stop | ( | ) |
Stop the profiler.
This function should only be called once per object after start has been called.
| void tvm::runtime::profiling::Profiler::StopCall | ( | std::unordered_map< std::string, ffi::Any > | extra_metrics = {} | ) |
Stop the last StartCall.
| extra_metrics | Optional additional profiling information to add to the frame (input sizes, allocations). |