| 1 | #ifndef _BABELTRACE_INTERNAL_H |
| 2 | #define _BABELTRACE_INTERNAL_H |
| 3 | |
| 4 | /* |
| 5 | * babeltrace/babeltrace-internal.h |
| 6 | * |
| 7 | * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 8 | * |
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 10 | * of this software and associated documentation files (the "Software"), to deal |
| 11 | * in the Software without restriction, including without limitation the rights |
| 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 13 | * copies of the Software, and to permit persons to whom the Software is |
| 14 | * furnished to do so, subject to the following conditions: |
| 15 | * |
| 16 | * The above copyright notice and this permission notice shall be included in |
| 17 | * all copies or substantial portions of the Software. |
| 18 | */ |
| 19 | #include <stdio.h> |
| 20 | #include <glib.h> |
| 21 | #include <stdint.h> |
| 22 | |
| 23 | extern int babeltrace_verbose, babeltrace_debug; |
| 24 | |
| 25 | #define printf_verbose(fmt, args...) \ |
| 26 | do { \ |
| 27 | if (babeltrace_verbose) \ |
| 28 | fprintf(stdout, "[verbose] " fmt, ## args); \ |
| 29 | } while (0) |
| 30 | |
| 31 | #define printf_debug(fmt, args...) \ |
| 32 | do { \ |
| 33 | if (babeltrace_debug) \ |
| 34 | fprintf(stdout, "[debug] " fmt, ## args); \ |
| 35 | } while (0) |
| 36 | |
| 37 | #define likely(x) __builtin_expect(!!(x), 1) |
| 38 | #define unlikely(x) __builtin_expect(!!(x), 0) |
| 39 | |
| 40 | struct trace_descriptor; |
| 41 | struct trace_collection { |
| 42 | GPtrArray *array; /* struct trace_descriptor */ |
| 43 | GHashTable *clocks; /* struct ctf_clock */ |
| 44 | |
| 45 | uint64_t single_clock_offset_avg; |
| 46 | uint64_t offset_first; |
| 47 | int64_t delta_offset_first_sum; |
| 48 | int offset_nr; |
| 49 | int clock_use_offset_avg; |
| 50 | }; |
| 51 | |
| 52 | extern int opt_all_field_names, |
| 53 | opt_scope_field_names, |
| 54 | opt_header_field_names, |
| 55 | opt_context_field_names, |
| 56 | opt_payload_field_names, |
| 57 | opt_all_fields, |
| 58 | opt_trace_field, |
| 59 | opt_trace_domain_field, |
| 60 | opt_trace_procname_field, |
| 61 | opt_trace_vpid_field, |
| 62 | opt_trace_hostname_field, |
| 63 | opt_trace_default_fields, |
| 64 | opt_loglevel_field, |
| 65 | opt_emf_field, |
| 66 | opt_delta_field, |
| 67 | opt_clock_cycles, |
| 68 | opt_clock_seconds, |
| 69 | opt_clock_date, |
| 70 | opt_clock_gmt, |
| 71 | opt_clock_force_correlate; |
| 72 | |
| 73 | extern uint64_t opt_clock_offset; |
| 74 | |
| 75 | #endif |