summaryrefslogtreecommitdiff
path: root/lib/jxl/base/profiler.h
blob: 13f95d2b7a28b7ee40c6d5c70f8c2c8b9ea61de3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#ifndef LIB_JXL_BASE_PROFILER_H_
#define LIB_JXL_BASE_PROFILER_H_

// High precision, low overhead time measurements. Returns exact call counts and
// total elapsed time for user-defined 'zones' (code regions, i.e. C++ scopes).
//
// To use the profiler you must set the JPEGXL_ENABLE_PROFILER CMake flag, which
// defines PROFILER_ENABLED and links against the libjxl_profiler library.

// If zero, this file has no effect and no measurements will be recorded.
#ifndef PROFILER_ENABLED
#define PROFILER_ENABLED 0
#endif  // PROFILER_ENABLED

#if PROFILER_ENABLED

#include "lib/profiler/profiler.h"

#else  // !PROFILER_ENABLED

#define PROFILER_ZONE(name)
#define PROFILER_FUNC
#define PROFILER_PRINT_RESULTS()

#endif  // PROFILER_ENABLED

#endif  // LIB_JXL_BASE_PROFILER_H_