1 #ifndef _BABELTRACE_CTF_METADATA_H
2 #define _BABELTRACE_CTF_METADATA_H
9 * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
22 #include <babeltrace/types.h>
23 #include <babeltrace/format.h>
24 #include <babeltrace/ctf/types.h>
25 #include <sys/types.h>
27 #include <uuid/uuid.h>
31 #define CTF_MAGIC 0xC1FC1FC1
34 struct ctf_stream_class
;
37 struct ctf_file_stream
{
39 struct ctf_stream_class
*stream
;
40 struct ctf_stream_pos pos
; /* current stream position */
43 #define CTF_TRACE_SET_FIELD(ctf_trace, field) \
45 (ctf_trace)->field_mask |= CTF_TRACE_ ## field; \
48 #define CTF_TRACE_FIELD_IS_SET(ctf_trace, field) \
49 ((ctf_trace)->field_mask & CTF_TRACE_ ## field)
51 #define CTF_TRACE_GET_FIELD(ctf_trace, field) \
53 assert(CTF_TRACE_FIELD_IS_SET(ctf_trace, field)); \
54 (ctf_trace)->(field); \
59 struct trace_descriptor parent
;
61 struct declaration_scope
*root_declaration_scope
;
63 struct declaration_scope
*declaration_scope
;
64 /* innermost definition scope. to be used as parent of stream. */
65 struct definition_scope
*definition_scope
;
66 GPtrArray
*streams
; /* Array of struct ctf_stream_class pointers */
67 struct ctf_file_stream metadata
;
69 /* Declarations only used when parsing */
70 struct declaration_struct
*packet_header_decl
;
72 /* Definitions used afterward */
73 struct definition_struct
*packet_header
;
78 int byte_order
; /* trace BYTE_ORDER. 0 if unset. */
80 enum { /* Fields populated mask */
81 CTF_TRACE_major
= (1U << 0),
82 CTF_TRACE_minor
= (1U << 1),
83 CTF_TRACE_uuid
= (1U << 2),
84 CTF_TRACE_byte_order
= (1U << 3),
85 CTF_TRACE_packet_header
= (1U << 4),
88 /* Information about trace backing directory and files */
91 int flags
; /* open flags */
94 #define CTF_STREAM_SET_FIELD(ctf_stream, field) \
96 (ctf_stream)->field_mask |= CTF_STREAM_ ## field; \
99 #define CTF_STREAM_FIELD_IS_SET(ctf_stream, field) \
100 ((ctf_stream)->field_mask & CTF_STREAM_ ## field)
102 #define CTF_STREAM_GET_FIELD(ctf_stream, field) \
104 assert(CTF_STREAM_FIELD_IS_SET(ctf_stream, field)); \
105 (ctf_stream)->(field); \
108 struct ctf_stream_class
{
109 struct ctf_trace
*trace
;
110 /* parent is lexical scope conaining the stream scope */
111 struct declaration_scope
*declaration_scope
;
112 /* innermost definition scope. to be used as parent of event. */
113 struct definition_scope
*definition_scope
;
114 GPtrArray
*events_by_id
; /* Array of struct ctf_event pointers indexed by id */
115 GHashTable
*event_quark_to_id
; /* GQuark to numeric id */
117 /* Declarations only used when parsing */
118 struct declaration_struct
*packet_context_decl
;
119 struct declaration_struct
*event_header_decl
;
120 struct declaration_struct
*event_context_decl
;
122 /* Definitions used afterward */
123 struct definition_struct
*packet_context
;
124 struct definition_struct
*event_header
;
125 struct definition_struct
*event_context
;
129 enum { /* Fields populated mask */
130 CTF_STREAM_stream_id
= (1 << 0),
133 GPtrArray
*files
; /* Array of struct ctf_file_stream pointers */
136 #define CTF_EVENT_SET_FIELD(ctf_event, field) \
138 (ctf_event)->field_mask |= CTF_EVENT_ ## field; \
141 #define CTF_EVENT_FIELD_IS_SET(ctf_event, field) \
142 ((ctf_event)->field_mask & CTF_EVENT_ ## field)
144 #define CTF_EVENT_GET_FIELD(ctf_event, field) \
146 assert(CTF_EVENT_FIELD_IS_SET(ctf_event, field)); \
147 (ctf_event)->(field); \
151 /* stream mapped by stream_id */
152 struct ctf_stream_class
*stream
;
153 /* parent is lexical scope conaining the event scope */
154 struct declaration_scope
*declaration_scope
;
156 /* Declarations only used when parsing */
157 struct declaration_struct
*context_decl
;
158 struct declaration_struct
*fields_decl
;
160 /* Definitions used afterward */
161 struct definition_struct
*context
;
162 struct definition_struct
*fields
;
165 uint64_t id
; /* Numeric identifier within the stream */
168 enum { /* Fields populated mask */
169 CTF_EVENT_name
= (1 << 0),
170 CTF_EVENT_id
= (1 << 1),
171 CTF_EVENT_stream_id
= (1 << 2),
175 #endif /* _BABELTRACE_CTF_METADATA_H */
This page took 0.031782 seconds and 4 git commands to generate.