1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <mos/mos_global.h>
6#include <mos/types.h>
7
8typedef u64 pf_point_t;
9
10#if MOS_CONFIG(MOS_PROFILING)
11#include "mos/platform/platform.h"
12
13/**
14 * @brief Enter a profiling scope
15 *
16 * @param name Scope name
17 * @return id_t The scope ID used to exit the scope
18 */
19should_inline pf_point_t profile_enter(void)
20{
21 return platform_get_timestamp();
22}
23
24/**
25 * @brief Exit a profiling scope
26 *
27 * @param id Scope ID
28 */
29void profile_leave(pf_point_t point, const char *fmt, ...) __printf(2, 3);
30
31#else
32
33#define profile_enter() 0
34
35#define profile_leave(p, ...) ((void) p)
36
37#endif
38