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 PROFILER* profiler_create(const char* name);
34 FREERDP_API void profiler_free(PROFILER* profiler);
35
36 FREERDP_API void profiler_enter(PROFILER* profiler);
37 FREERDP_API void profiler_exit(PROFILER* profiler);
38
39 FREERDP_API void profiler_print_header(void);
40 FREERDP_API void profiler_print(PROFILER* profiler);
41 FREERDP_API void profiler_print_footer(void);
42
43#ifdef WITH_PROFILER
44#define PROFILER_RENAME(prof, name) \
45 do \
46 { \
47 profiler_free(prof); \
48 prof = profiler_create(name); \
49 } while (0);
50#define PROFILER_DEFINE(prof) PROFILER* prof;
51#define PROFILER_CREATE(prof, name) prof = profiler_create(name);
52#define PROFILER_FREE(prof) profiler_free(prof);
53#define PROFILER_ENTER(prof) profiler_enter(prof);
54#define PROFILER_EXIT(prof) profiler_exit(prof);
55#define PROFILER_PRINT_HEADER profiler_print_header();
56#define PROFILER_PRINT(prof) profiler_print(prof);
57#define PROFILER_PRINT_FOOTER profiler_print_footer();
58#else
59#define PROFILER_RENAME(prof, name) \
60 do \
61 { \
62 } while (0);
63
64#define PROFILER_DEFINE(prof)
65#define PROFILER_CREATE(prof, name) \
66 do \
67 { \
68 } while (0);
69#define PROFILER_FREE(prof) \
70 do \
71 { \
72 } while (0);
73#define PROFILER_ENTER(prof) \
74 do \
75 { \
76 } while (0);
77#define PROFILER_EXIT(prof) \
78 do \
79 { \
80 } while (0);
81#define PROFILER_PRINT_HEADER \
82 do \
83 { \
84 } while (0);
85#define PROFILER_PRINT(prof) \
86 do \
87 { \
88 } while (0);
89#define PROFILER_PRINT_FOOTER \
90 do \
91 { \
92 } while (0);
93#endif
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* FREERDP_UTILS_PROFILER_H */