2 * Copyright © 2020 Endless Mobile, Inc.
4 * SPDX-License-Identifier: LGPL-2.1-or-later
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 * Author: Philip Withnall <withnall@endlessm.com>
25 #include <sysprof-capture.h>
33 * G_TRACE_CURRENT_TIME:
35 * Get the current time, in nanoseconds since the tracing epoch. This (and only
36 * this) is suitable for passing to tracing functions like g_trace_mark(). It is
37 * not suitable for other timekeeping.
39 * The tracing epoch is implementation defined, but is guaranteed to be
40 * unchanged within the lifetime of each thread. It is not comparable across
41 * threads or process instances.
43 * If tracing support is disabled, this evaluates to `0`.
48 #define G_TRACE_CURRENT_TIME SYSPROF_CAPTURE_CURRENT_TIME
50 #define G_TRACE_CURRENT_TIME 0
53 void (g_trace_mark) (gint64 begin_time_nsec,
57 const gchar *message_format,
58 ...) G_GNUC_PRINTF (5, 6);
61 /* Optimise the whole call out */
62 #if defined(G_HAVE_ISO_VARARGS)
63 #define g_trace_mark(b, d, g, n, m, ...)
64 #elif defined(G_HAVE_GNUC_VARARGS)
65 #define g_trace_mark(b, d, g, n, m...)
67 /* no varargs macro support; the call will have to be optimised out by the compiler */
71 guint (g_trace_define_int64_counter) (const char *group,
73 const char *description);
74 void (g_trace_set_int64_counter) (guint id,
78 #define g_trace_define_int64_counter(g, n, d) ((guint) -1)
79 #define g_trace_set_int64_counter(i,v)