The Pedigree Project 0.1
FunctionProfile.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef PEDIGREE_KERNEL_HOSTED_FUNCTION_PROFILE_H
3#define PEDIGREE_KERNEL_HOSTED_FUNCTION_PROFILE_H
4
5#include <config.h>
6#include <stddef.h>
7
8#if PEDIGREE_HOSTED_FUNCTION_PROFILE
9#include "pedigree/kernel/compiler.h"
10
11enum class HostedProfileInvalidation {
12 Schedule = 1,
13 InterruptEnable = 2,
14 ContextTransfer = 3,
15};
16
17EXPORTED_PUBLIC bool hostedFunctionProfileInitialise() __attribute__((no_instrument_function));
18EXPORTED_PUBLIC size_t hostedFunctionProfileCount(size_t count)
19 __attribute__((no_instrument_function));
20EXPORTED_PUBLIC void hostedFunctionProfileBegin(const char* phase, size_t repetition, size_t count)
21 __attribute__((no_instrument_function));
22EXPORTED_PUBLIC bool hostedFunctionProfileEnd() __attribute__((no_instrument_function));
23EXPORTED_PUBLIC void hostedFunctionProfileInvalidate(HostedProfileInvalidation reason)
24 __attribute__((no_instrument_function));
25#else
26inline void hostedFunctionProfileBegin(const char*, size_t, size_t) {}
27inline bool hostedFunctionProfileEnd() {
28 return true;
29}
30#endif
31
32#endif