Halide
Profiling.h
Go to the documentation of this file.
1 #ifndef HALIDE_PROFILING_H
2 #define HALIDE_PROFILING_H
3 
4 /** \file
5  * Defines the lowering pass that injects print statements when profiling is turned on.
6  * The profiler will print out per-pipeline and per-func stats, such as total time
7  * spent and heap/stack allocation information. To turn on the profiler, set
8  * HL_TARGET/HL_JIT_TARGET flags to 'host-profile'.
9  *
10  * Output format:
11  * <pipeline_name>
12  * <total time spent in this pipeline> <# of samples taken> <# of runs> <avg time/run>
13  * <# of heap allocations> <peak heap allocation>
14  * <func_name> <total time spent in this func> <percentage of time spent>
15  * (<peak heap alloc by this func> <num of allocs> <average alloc size> |
16  * <worst-case peak stack alloc by this func>)?
17  *
18  * Sample output:
19  * memory_profiler_mandelbrot
20  * total time: 59.832336 ms samples: 43 runs: 1000 time/run: 0.059832 ms
21  * heap allocations: 104000 peak heap usage: 505344 bytes
22  * f0: 0.025673ms (42%)
23  * mandelbrot: 0.006444ms (10%) peak: 505344 num: 104000 avg: 5376
24  * argmin: 0.027715ms (46%) stack: 20
25  */
26 #include <string>
27 
28 #include "Expr.h"
29 
30 namespace Halide {
31 namespace Internal {
32 
33 /** Take a statement representing a halide pipeline insert
34  * high-resolution timing into the generated code (via spawning a
35  * thread that acts as a sampling profiler); summaries of execution
36  * times and counts will be logged at the end. Should be done before
37  * storage flattening, but after all bounds inference.
38  *
39  */
40 Stmt inject_profiling(Stmt, const std::string &);
41 
42 } // namespace Internal
43 } // namespace Halide
44 
45 #endif
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Expr.h
Halide::Internal::inject_profiling
Stmt inject_profiling(Stmt, const std::string &)
Take a statement representing a halide pipeline insert high-resolution timing into the generated code...