FreeRDP
Loading...
Searching...
No Matches
profiler.h
1
20#ifndef FREERDP_UTILS_PROFILER_H
21#define FREERDP_UTILS_PROFILER_H
22
23#include <freerdp/api.h>
24#include <freerdp/utils/stopwatch.h>
25
26#ifdef __cplusplus
27extern "C"
28{
29#endif
30
31 typedef struct S_PROFILER PROFILER;
32
33 FREERDP_API void profiler_free(PROFILER* profiler);
34
35 WINPR_ATTR_MALLOC(profiler_free, 1)
36 WINPR_ATTR_NODISCARD
37 FREERDP_API PROFILER* profiler_create(const char* name);
38
39 FREERDP_API void profiler_enter(PROFILER* profiler);
40 FREERDP_API void profiler_exit(PROFILER* profiler);
41
42 FREERDP_API void profiler_print_header(void);
43 FREERDP_API void profiler_print(PROFILER* profiler);
44 FREERDP_API void profiler_print_footer(void);
45
46#ifdef WITH_PROFILER
47#define PROFILER_RENAME(prof, name) \
48 do \
49 { \
50 profiler_free(prof); \
51 prof = profiler_create(name); \
52 } while (0);
53#define PROFILER_DEFINE(prof) PROFILER* prof;
54#define PROFILER_CREATE(prof, name) prof = profiler_create(name);
55#define PROFILER_FREE(prof) profiler_free(prof);
56#define PROFILER_ENTER(prof) profiler_enter(prof);
57#define PROFILER_EXIT(prof) profiler_exit(prof);
58#define PROFILER_PRINT_HEADER profiler_print_header();
59#define PROFILER_PRINT(prof) profiler_print(prof);
60#define PROFILER_PRINT_FOOTER profiler_print_footer();
61#else
62#define PROFILER_RENAME(prof, name) \
63 do \
64 { \
65 } while (0);
66
67#define PROFILER_DEFINE(prof)
68#define PROFILER_CREATE(prof, name) \
69 do \
70 { \
71 } while (0);
72#define PROFILER_FREE(prof) \
73 do \
74 { \
75 } while (0);
76#define PROFILER_ENTER(prof) \
77 do \
78 { \
79 } while (0);
80#define PROFILER_EXIT(prof) \
81 do \
82 { \
83 } while (0);
84#define PROFILER_PRINT_HEADER \
85 do \
86 { \
87 } while (0);
88#define PROFILER_PRINT(prof) \
89 do \
90 { \
91 } while (0);
92#define PROFILER_PRINT_FOOTER \
93 do \
94 { \
95 } while (0);
96#endif
97
98#ifdef __cplusplus
99}
100#endif
101
102#endif /* FREERDP_UTILS_PROFILER_H */