Nuitka
The Python compiler
Loading...
Searching...
No Matches
python_pgo.h
1// Copyright 2025, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
3#ifndef __NUITKA_PYTHON_PGO_H__
4#define __NUITKA_PYTHON_PGO_H__
5
6// In Visual Code, evaluate the code for PGO so we see errors of it sooner.
7#ifdef __IDE_ONLY__
8#define _NUITKA_PGO_PYTHON 1
9#include "nuitka/prelude.h"
10#endif
11
12#if _NUITKA_PGO_PYTHON
13
14#include <stdint.h>
15
16// Initialize PGO data collection.
17extern void PGO_Initialize(void);
18
19// At end of program, write tables.
20extern void PGO_Finalize(void);
21
22// When a module is entered.
23extern void PGO_onModuleEntered(char const *module_name);
24// When a module is exited.
25extern void PGO_onModuleExit(char const *module_name, bool had_error);
26
27extern void PGO_onProbePassed(char const *module_name, char const *probe_id, uint32_t probe_arg);
28
29extern void PGO_onTechnicalModule(char const *module_name);
30
31#else
32
33#define PGO_Initialize()
34#define PGO_Finalize()
35
36#define PGO_onModuleEntered(module_name) ;
37#define PGO_onModuleExit(module_name, had_error) ;
38
39#define PGO_onProbePassed(module_name, probe_id, probe_arg) ;
40
41#endif
42
43#endif
44// Part of "Nuitka", an optimizing Python compiler that is compatible and
45// integrates with CPython, but also works on its own.
46//
47// Licensed under the Apache License, Version 2.0 (the "License");
48// you may not use this file except in compliance with the License.
49// You may obtain a copy of the License at
50//
51// http://www.apache.org/licenses/LICENSE-2.0
52//
53// Unless required by applicable law or agreed to in writing, software
54// distributed under the License is distributed on an "AS IS" BASIS,
55// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56// See the License for the specific language governing permissions and
57// limitations under the License.