d833a56d771dad990d5bf566160254f86f7107f8
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/ctf/types.h>
24 #include <sys/types.h>
26 #include <uuid/uuid.h>
34 struct ctf_stream_file
{
35 /* Information about stream backing file */
37 char *mmap
; /* current stream mmap */
38 struct stream_pos pos
; /* current stream position */
41 #define CTF_TRACE_SET_FIELD(ctf_trace, field) \
43 (ctf_trace)->field_mask |= CTF_TRACE_ ## field; \
46 #define CTF_TRACE_FIELD_IS_SET(ctf_trace, field) \
47 ((ctf_trace)->field_mask & CTF_TRACE_ ## field)
49 #define CTF_TRACE_GET_FIELD(ctf_trace, field) \
51 assert(CTF_TRACE_FIELD_IS_SET(ctf_trace, field)); \
52 (ctf_trace)->(field); \
58 struct declaration_scope
*root_declaration_scope
;
60 struct declaration_scope
*declaration_scope
;
61 GPtrArray
*streams
; /* Array of struct ctf_stream pointers*/
62 struct ctf_stream_file metadata
;
69 enum { /* Fields populated mask */
70 CTF_TRACE_major
= (1U << 0),
71 CTF_TRACE_minor
= (1U << 1),
72 CTF_TRACE_uuid
= (1U << 2),
75 /* Information about trace backing directory and files */
78 int flags
; /* open flags */
81 #define CTF_STREAM_SET_FIELD(ctf_stream, field) \
83 (ctf_stream)->field_mask |= CTF_STREAM_ ## field; \
86 #define CTF_STREAM_FIELD_IS_SET(ctf_stream, field) \
87 ((ctf_stream)->field_mask & CTF_STREAM_ ## field)
89 #define CTF_STREAM_GET_FIELD(ctf_stream, field) \
91 assert(CTF_STREAM_FIELD_IS_SET(ctf_stream, field)); \
92 (ctf_stream)->(field); \
96 struct ctf_trace
*trace
;
97 /* parent is lexical scope conaining the stream scope */
98 struct declaration_scope
*declaration_scope
;
99 /* innermost definition scope. to be used as parent of event. */
100 struct definition_scope
*definition_scope
;
101 GPtrArray
*events_by_id
; /* Array of struct ctf_event pointers indexed by id */
102 GHashTable
*event_quark_to_id
; /* GQuark to numeric id */
104 /* Declarations only used when parsing */
105 struct declaration_struct
*packet_context_decl
;
106 struct declaration_struct
*event_header_decl
;
107 struct declaration_struct
*event_context_decl
;
109 /* Definitions used afterward */
110 struct definition_struct
*packet_context
;
111 struct definition_struct
*event_header
;
112 struct definition_struct
*event_context
;
116 enum { /* Fields populated mask */
117 CTF_STREAM_stream_id
= (1 << 0),
120 struct ctf_stream_file file
; /* Backing file */
123 #define CTF_EVENT_SET_FIELD(ctf_event, field) \
125 (ctf_event)->field_mask |= CTF_EVENT_ ## field; \
128 #define CTF_EVENT_FIELD_IS_SET(ctf_event, field) \
129 ((ctf_event)->field_mask & CTF_EVENT_ ## field)
131 #define CTF_EVENT_GET_FIELD(ctf_event, field) \
133 assert(CTF_EVENT_FIELD_IS_SET(ctf_event, field)); \
134 (ctf_event)->(field); \
138 /* stream mapped by stream_id */
139 struct ctf_stream
*stream
;
140 /* parent is lexical scope conaining the event scope */
141 struct declaration_scope
*declaration_scope
;
143 /* Declarations only used when parsing */
144 struct declaration_struct
*context_decl
;
145 struct declaration_struct
*fields_decl
;
147 /* Definitions used afterward */
148 struct definition_struct
*context
;
149 struct definition_struct
*fields
;
152 uint64_t id
; /* Numeric identifier within the stream */
155 enum { /* Fields populated mask */
156 CTF_EVENT_name
= (1 << 0),
157 CTF_EVENT_id
= (1 << 1),
158 CTF_EVENT_stream_id
= (1 << 2),
162 #endif /* _BABELTRACE_CTF_METADATA_H */
This page took 0.050713 seconds and 3 git commands to generate.