Document of c-modernization-kit (util) 1.0.0
Loading...
Searching...
No Matches
trace-etw-util.h
Go to the documentation of this file.
1#ifndef TRACE_ETW_UTIL_H
2#define TRACE_ETW_UTIL_H
3
12
13#ifdef _WIN32
14
15/* ===== DLL エクスポート / インポート制御マクロ ===== */
16
17#ifdef DOXYGEN
18
31#define TRACE_ETW_UTIL_EXPORT
32
39#define TRACE_ETW_UTIL_API
40
41#else /* !DOXYGEN */
42
43#ifndef __INTELLISENSE__
44 #ifndef TRACE_ETW_UTIL_STATIC
45 #ifdef TRACE_ETW_UTIL_EXPORTS
46 #define TRACE_ETW_UTIL_EXPORT __declspec(dllexport)
47 #else /* !TRACE_ETW_UTIL_EXPORTS */
48 #define TRACE_ETW_UTIL_EXPORT __declspec(dllimport)
49 #endif /* TRACE_ETW_UTIL_EXPORTS */
50 #else /* TRACE_ETW_UTIL_STATIC */
51 #define TRACE_ETW_UTIL_EXPORT
52 #endif /* TRACE_ETW_UTIL_STATIC */
53#else /* __INTELLISENSE__ */
54 #define TRACE_ETW_UTIL_EXPORT
55#endif /* __INTELLISENSE__ */
56#ifndef TRACE_ETW_UTIL_API
57 #define TRACE_ETW_UTIL_API __stdcall
58#endif /* TRACE_ETW_UTIL_API */
59
60#endif /* DOXYGEN */
61
62/* ===== プロバイダ参照型 ===== */
63
69struct _tlgProvider_t;
70typedef struct _tlgProvider_t const *etw_provider_ref_t;
71
72/* ===== プロバイダ定義マクロ ===== */
73
98#define TRACE_ETW_UTIL_DEFINE_PROVIDER(var, name, guid) \
99 TRACELOGGING_DEFINE_PROVIDER(var, name, guid)
100
101/* ===== 不透明ハンドル型 ===== */
102
104typedef struct etw_provider etw_provider_t;
105
106/* ===== API 関数 ===== */
107
108#ifdef __cplusplus
109extern "C"
110{
111#endif /* __cplusplus */
112
126 TRACE_ETW_UTIL_EXPORT etw_provider_t *TRACE_ETW_UTIL_API
127 etw_provider_init(etw_provider_ref_t provider_ref);
128
155 TRACE_ETW_UTIL_EXPORT int TRACE_ETW_UTIL_API
156 etw_provider_write(etw_provider_t *handle, int level,
157 const char *service, const char *message);
158
165 TRACE_ETW_UTIL_EXPORT void TRACE_ETW_UTIL_API
166 etw_provider_dispose(etw_provider_t *handle);
167
168 /* ===== セッション (Consumer) API ===== */
169
172
174 #define ETW_SESSION_OK 0
176 #define ETW_SESSION_ERR_PARAM -1
178 #define ETW_SESSION_ERR_ACCESS -2
180 #define ETW_SESSION_ERR_SYSTEM -3
181
183
195 typedef void (*etw_event_callback_t)(int level, const char *message, void *context);
196
198 typedef struct etw_session etw_session_t;
199
217 TRACE_ETW_UTIL_EXPORT int TRACE_ETW_UTIL_API
218 etw_session_check_access(void);
219
248 TRACE_ETW_UTIL_EXPORT etw_session_t *TRACE_ETW_UTIL_API
249 etw_session_start(const char *session_name,
250 const char *provider_guid_str,
251 etw_event_callback_t callback,
252 void *context,
253 int *out_status);
254
263 TRACE_ETW_UTIL_EXPORT void TRACE_ETW_UTIL_API
264 etw_session_stop(etw_session_t *session);
265
266#ifdef __cplusplus
267}
268#endif /* __cplusplus */
269
270#endif /* _WIN32 */
271
272#endif /* TRACE_ETW_UTIL_H */