1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
5 
6 #ifndef LIB_JXL_BASE_PROFILER_H_
7 #define LIB_JXL_BASE_PROFILER_H_
8 
9 // High precision, low overhead time measurements. Returns exact call counts and
10 // total elapsed time for user-defined 'zones' (code regions, i.e. C++ scopes).
11 //
12 // To use the profiler you must set the JPEGXL_ENABLE_PROFILER CMake flag, which
13 // defines PROFILER_ENABLED and links against the libjxl_profiler library.
14 
15 // If zero, this file has no effect and no measurements will be recorded.
16 #ifndef PROFILER_ENABLED
17 #define PROFILER_ENABLED 0
18 #endif  // PROFILER_ENABLED
19 
20 #if PROFILER_ENABLED
21 
22 #include "lib/profiler/profiler.h"
23 
24 #else  // !PROFILER_ENABLED
25 
26 #define PROFILER_ZONE(name)
27 #define PROFILER_FUNC
28 #define PROFILER_PRINT_RESULTS()
29 
30 #endif  // PROFILER_ENABLED
31 
32 #endif  // LIB_JXL_BASE_PROFILER_H_
33