JULEA
Loading...
Searching...
No Matches
jtrace.h
Go to the documentation of this file.
1/*
2 * JULEA - Flexible storage framework
3 * Copyright (C) 2010-2024 Michael Kuhn
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
23#ifndef JULEA_TRACE_H
24#define JULEA_TRACE_H
25
26#if !defined(JULEA_H) && !defined(JULEA_COMPILATION)
27#error "Only <julea.h> can be included directly."
28#endif
29
30#include <glib.h>
31
32G_BEGIN_DECLS
33
55
57
58struct JTrace;
59
60typedef struct JTrace JTrace;
61
75void j_trace_init(gchar const* name);
76
84void j_trace_fini(void);
85
95JTrace* j_trace_enter(gchar const* name, gchar const* format, ...) G_GNUC_PRINTF(2, 3);
96
105void j_trace_leave(JTrace* trace);
106
107G_DEFINE_AUTOPTR_CLEANUP_FUNC(JTrace, j_trace_leave)
108
109#ifdef JULEA_DEBUG
110#ifdef __COUNTER__
111#define J_TRACE(name, ...) g_autoptr(JTrace) G_PASTE(j_trace, __COUNTER__) G_GNUC_UNUSED = j_trace_enter(name, __VA_ARGS__)
112#define J_TRACE_FUNCTION(...) g_autoptr(JTrace) G_PASTE(j_trace_function, __COUNTER__) G_GNUC_UNUSED = j_trace_enter(G_STRFUNC, __VA_ARGS__)
113#else
114#define J_TRACE(name, ...) g_autoptr(JTrace) G_PASTE(j_trace, __LINE__) G_GNUC_UNUSED = j_trace_enter(name, __VA_ARGS__)
115#define J_TRACE_FUNCTION(...) g_autoptr(JTrace) G_PASTE(j_trace_function, __LINE__) G_GNUC_UNUSED = j_trace_enter(G_STRFUNC, __VA_ARGS__)
116#endif
117#else
118#ifdef __COUNTER__
119#define J_TRACE(name, ...) g_autoptr(JTrace) G_PASTE(j_trace, __COUNTER__) G_GNUC_UNUSED = NULL
120#define J_TRACE_FUNCTION(...) g_autoptr(JTrace) G_PASTE(j_trace_function, __COUNTER__) G_GNUC_UNUSED = NULL
121#else
122#define J_TRACE(name, ...) g_autoptr(JTrace) G_PASTE(j_trace, __LINE__) G_GNUC_UNUSED = NULL
123#define J_TRACE_FUNCTION(...) g_autoptr(JTrace) G_PASTE(j_trace_function, __LINE__) G_GNUC_UNUSED = NULL
124#endif
125#endif
126
136void j_trace_file_begin(gchar const* path, JTraceFileOperation op);
137
149void j_trace_file_end(gchar const* path, JTraceFileOperation op, guint64 length, guint64 offset);
150
160void j_trace_counter(gchar const* name, guint64 counter_value);
161
166G_END_DECLS
167
168#endif
JTrace * j_trace_enter(gchar const *name, gchar const *format,...) G_GNUC_PRINTF(2
Definition jtrace.c:503
void j_trace_file_begin(gchar const *path, JTraceFileOperation op)
Definition jtrace.c:710
void j_trace_counter(gchar const *name, guint64 counter_value)
Definition jtrace.c:847
JTrace void j_trace_leave(JTrace *trace)
Definition jtrace.c:607
JTraceFileOperation
Definition jtrace.h:44
void j_trace_init(gchar const *name)
Definition jtrace.c:356
void j_trace_file_end(gchar const *path, JTraceFileOperation op, guint64 length, guint64 offset)
Definition jtrace.c:763
void j_trace_fini(void)
Definition jtrace.c:441
@ J_TRACE_FILE_STATUS
Definition jtrace.h:51
@ J_TRACE_FILE_SEEK
Definition jtrace.h:50
@ J_TRACE_FILE_CREATE
Definition jtrace.h:46
@ J_TRACE_FILE_DELETE
Definition jtrace.h:47
@ J_TRACE_FILE_WRITE
Definition jtrace.h:53
@ J_TRACE_FILE_SYNC
Definition jtrace.h:52
@ J_TRACE_FILE_READ
Definition jtrace.h:49
@ J_TRACE_FILE_OPEN
Definition jtrace.h:48
@ J_TRACE_FILE_CLOSE
Definition jtrace.h:45
Definition jtrace.c:104
gchar * name
Definition jtrace.c:105