Commit | Line | Data |
---|---|---|
43c59509 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
43c59509 | 3 | * |
0235b0db | 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
43c59509 PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE2_GRAPH_MESSAGE_H |
8 | #define BABELTRACE2_GRAPH_MESSAGE_H | |
9 | ||
f38da6ca SM |
10 | /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */ |
11 | ||
43c59509 PP |
12 | #ifndef __BT_IN_BABELTRACE_H |
13 | # error "Please include <babeltrace2/babeltrace.h> instead." | |
14 | #endif | |
15 | ||
16 | #include <babeltrace2/types.h> | |
17 | ||
18 | #ifdef __cplusplus | |
19 | extern "C" { | |
20 | #endif | |
21 | ||
22 | /*! | |
23 | @defgroup api-msg Messages | |
24 | @ingroup api-comp-cls-dev | |
25 | ||
26 | @brief | |
27 | Elements exchanged between \bt_p_comp. | |
28 | ||
29 | <strong><em>Messages</em></strong> are the objects which are exchanged | |
30 | between \bt_p_comp in a trace processing \bt_graph to accomplish a | |
31 | trace processing job. | |
32 | ||
33 | \bt_cp_msg_iter create messages while message iterators \em and | |
34 | \bt_p_sink_comp consume messages. | |
35 | ||
36 | There are eight types of messages: | |
37 | ||
38 | - \bt_c_sb_msg | |
39 | - \bt_c_se_msg | |
40 | - \bt_c_ev_msg | |
41 | - \bt_c_pb_msg | |
42 | - \bt_c_pe_msg | |
43 | - \bt_c_disc_ev_msg | |
44 | - \bt_c_disc_pkt_msg | |
45 | - \bt_c_inac_msg | |
46 | ||
47 | The type of a message is #bt_message. | |
48 | ||
49 | Get the type enumerator of a message with bt_message_get_type(). | |
50 | ||
51 | A message is a \ref api-fund-shared-object "shared object": get a | |
52 | new reference with bt_message_get_ref() and put an existing | |
53 | reference with bt_message_put_ref(). | |
54 | ||
55 | Some library functions \ref api-fund-freezing "freeze" messages on | |
56 | success. The documentation of those functions indicate this | |
57 | postcondition. | |
58 | ||
59 | Messages transport objects of the \ref api-tir API, which is an | |
60 | intermediate representation of the tracing domain concepts. | |
61 | ||
62 | All types of messages, except the \bt_inac_msg type, are related to a | |
63 | specific <em>\bt_stream</em>, which represents a conceptual | |
64 | \ref api-msg-seq "sequence of messages". | |
65 | ||
66 | Some types of messages can have a default \bt_cs, depending on whether | |
67 | or not their stream has a conceptual default clock, that is, whether or | |
68 | not the stream's \ref api-tir-stream-cls "class" has a | |
69 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
70 | The creation functions for those types of messages contain | |
71 | <code>_with_default_clock_snapshot</code> (for example, | |
72 | bt_message_event_create_with_default_clock_snapshot()). | |
73 | ||
74 | For the \bt_sb_msg and \bt_se_msg, the default clock snapshot property | |
75 | is optional, therefore they have dedicated | |
76 | bt_message_stream_beginning_set_default_clock_snapshot() and | |
77 | bt_message_stream_end_set_default_clock_snapshot() functions. | |
78 | ||
79 | All the message creation functions take a \bt_self_msg_iter as their | |
80 | first parameter. This is because a message iterator method is the only | |
81 | valid context to create a message. | |
82 | ||
83 | <h1>Message types</h1> | |
84 | ||
85 | This section details each type of message. | |
86 | ||
87 | The following table shows the creation functions and types for each type | |
88 | of message: | |
89 | ||
90 | <table> | |
91 | <tr> | |
92 | <th>Name | |
93 | <th>Type enumerator | |
94 | <th>Creation functions | |
95 | <tr> | |
96 | <td>\ref api-msg-sb "Stream beginning" | |
97 | <td>#BT_MESSAGE_TYPE_STREAM_BEGINNING | |
98 | <td>bt_message_stream_beginning_create() | |
99 | <tr> | |
100 | <td>\ref api-msg-se "Stream end" | |
101 | <td>#BT_MESSAGE_TYPE_STREAM_END | |
102 | <td>bt_message_stream_end_create() | |
103 | <tr> | |
104 | <td>\ref api-msg-ev "Event" | |
105 | <td>#BT_MESSAGE_TYPE_EVENT | |
106 | <td> | |
107 | bt_message_event_create()<br> | |
108 | bt_message_event_create_with_default_clock_snapshot()<br> | |
109 | bt_message_event_create_with_packet()<br> | |
110 | bt_message_event_create_with_packet_and_default_clock_snapshot() | |
111 | <tr> | |
112 | <td>\ref api-msg-pb "Packet beginning" | |
113 | <td>#BT_MESSAGE_TYPE_PACKET_BEGINNING | |
114 | <td> | |
115 | bt_message_packet_beginning_create()<br> | |
116 | bt_message_packet_beginning_create_with_default_clock_snapshot() | |
117 | <tr> | |
118 | <td>\ref api-msg-pe "Packet end" | |
119 | <td>#BT_MESSAGE_TYPE_PACKET_END | |
120 | <td> | |
121 | bt_message_packet_end_create()<br> | |
122 | bt_message_packet_end_create_with_default_clock_snapshot() | |
123 | <tr> | |
124 | <td>\ref api-msg-disc-ev "Discarded events" | |
125 | <td>#BT_MESSAGE_TYPE_DISCARDED_EVENTS | |
126 | <td> | |
127 | bt_message_discarded_events_create()<br> | |
128 | bt_message_discarded_events_create_with_default_clock_snapshots() | |
129 | <tr> | |
130 | <td>\ref api-msg-disc-pkt "Discarded packets" | |
131 | <td>#BT_MESSAGE_TYPE_DISCARDED_PACKETS | |
132 | <td> | |
133 | bt_message_discarded_packets_create()<br> | |
134 | bt_message_discarded_packets_create_with_default_clock_snapshots() | |
135 | <tr> | |
136 | <td>\ref api-msg-inac "Message iterator inactivity" | |
137 | <td>#BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY | |
138 | <td>bt_message_message_iterator_inactivity_create() | |
139 | </table> | |
140 | ||
141 | <h2>\anchor api-msg-sb Stream beginning message</h2> | |
142 | ||
143 | A <strong><em>stream beginning message</em></strong> indicates the | |
144 | beginning of a \bt_stream. | |
145 | ||
146 | For a given stream: | |
147 | ||
148 | - A stream beginning message is always the first one in the | |
149 | \ref api-msg-seq "message sequence". | |
150 | ||
151 | - There can be only one stream beginning message. | |
152 | ||
153 | Create a stream beginning message with | |
154 | bt_message_stream_beginning_create(). | |
155 | ||
156 | A stream beginning message has the following properties: | |
157 | ||
158 | <dl> | |
159 | <dt>\anchor api-msg-sb-prop-stream Stream</dt> | |
160 | <dd> | |
161 | \bt_c_stream of which the message indicates the beginning. | |
162 | ||
163 | You cannot change the stream once the message is created. | |
164 | ||
165 | Borrow a stream beginning message's stream with | |
166 | bt_message_stream_beginning_borrow_stream() and | |
167 | bt_message_stream_beginning_borrow_stream_const(). | |
168 | </dd> | |
169 | ||
170 | <dt> | |
171 | \anchor api-msg-sb-prop-cs | |
172 | \bt_dt_opt Default \bt_cs | |
173 | </dt> | |
174 | <dd> | |
175 | Snapshot of the message's \bt_stream's default clock when the | |
176 | stream begins. | |
177 | ||
178 | A stream beginning message can only have a default clock snapshot | |
179 | if its stream's \ref api-tir-stream-cls "class" has a | |
180 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
181 | ||
182 | When a stream beginning message has no default clock snapshot, | |
183 | then its time is <em>unknown</em>. | |
184 | ||
185 | Set a stream beginning message's default clock snapshot with | |
186 | bt_message_stream_beginning_set_default_clock_snapshot(). | |
187 | ||
188 | Borrow a stream beginning message's default clock snapshot with | |
189 | bt_message_stream_beginning_borrow_default_clock_snapshot_const(). | |
190 | </dd> | |
191 | </dl> | |
192 | ||
193 | <h2>\anchor api-msg-se Stream end message</h2> | |
194 | ||
195 | A <strong><em>stream end message</em></strong> indicates the | |
196 | end of a \bt_stream. | |
197 | ||
198 | For a given stream: | |
199 | ||
200 | - A stream end message is always the last one in the | |
201 | \ref api-msg-seq "message sequence". | |
202 | ||
203 | - There can be only one stream end message. | |
204 | ||
205 | Create a stream end message with bt_message_stream_end_create(). | |
206 | ||
207 | A stream end message has the following properties: | |
208 | ||
209 | <dl> | |
210 | <dt>\anchor api-msg-se-prop-stream Stream</dt> | |
211 | <dd> | |
212 | \bt_c_stream of which the message indicates the end. | |
213 | ||
214 | You cannot change the stream once the message is created. | |
215 | ||
216 | Borrow a stream end message's stream with | |
217 | bt_message_stream_end_borrow_stream() and | |
218 | bt_message_stream_end_borrow_stream_const(). | |
219 | </dd> | |
220 | ||
221 | <dt> | |
222 | \anchor api-msg-se-prop-cs | |
223 | \bt_dt_opt Default \bt_cs | |
224 | </dt> | |
225 | <dd> | |
226 | Snapshot of the message's \bt_stream's default clock when the | |
227 | stream ends. | |
228 | ||
229 | A stream end message can only have a default clock snapshot | |
230 | if its stream's \ref api-tir-stream-cls "class" has a | |
231 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
232 | ||
233 | When a stream end message has no default clock snapshot, then its | |
234 | time is <em>unknown</em>. | |
235 | ||
236 | Set a stream end message's default clock snapshot with | |
237 | bt_message_stream_end_set_default_clock_snapshot(). | |
238 | ||
239 | Borrow a stream end message's default clock snapshot with | |
240 | bt_message_stream_end_borrow_default_clock_snapshot_const(). | |
241 | </dd> | |
242 | </dl> | |
243 | ||
244 | <h2>\anchor api-msg-ev Event message</h2> | |
245 | ||
246 | An <strong><em>event message</em></strong> transports an \bt_ev and has, | |
247 | possibly, a default \bt_cs. | |
248 | ||
249 | Within its \bt_stream's \ref api-msg-seq "message sequence", an event | |
250 | message can only occur: | |
251 | ||
252 | <dl> | |
253 | <dt> | |
254 | If the stream's \ref api-tir-stream-cls "class" | |
255 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets" | |
256 | </dt> | |
257 | <dd>After a \bt_pb_msg and before a \bt_pe_msg.</dd> | |
258 | ||
259 | <dt> | |
260 | If the stream's class does not support packets | |
261 | </dt> | |
262 | <dd>After the \bt_sb_msg and before the \bt_se_msg.</dd> | |
263 | </dl> | |
264 | ||
265 | To create an event message for a given stream, use: | |
266 | ||
267 | <dl> | |
268 | <dt> | |
269 | If the stream's \ref api-tir-stream-cls "class" | |
270 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets" | |
271 | </dt> | |
272 | <dd> | |
273 | <dl> | |
274 | <dt> | |
275 | If the stream's class has a | |
276 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
277 | </dt> | |
278 | <dd>bt_message_event_create_with_packet_and_default_clock_snapshot()</dd> | |
279 | ||
280 | <dt> | |
281 | If the stream's class does not have a | |
282 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
283 | </dt> | |
284 | <dd>bt_message_event_create_with_packet()</dd> | |
285 | </dl> | |
286 | ||
287 | Those two creation functions accept a \bt_pkt parameter which is | |
288 | the packet logically containing the message's event. A packet is | |
289 | part of a stream. | |
290 | </dd> | |
291 | ||
292 | <dt> | |
293 | If the stream's class does not supports packets | |
294 | </dt> | |
295 | <dd> | |
296 | <dl> | |
297 | <dt> | |
298 | If the stream's class has a default clock class | |
299 | </dt> | |
300 | <dd>bt_message_event_create_with_default_clock_snapshot()</dd> | |
301 | ||
302 | <dt> | |
303 | If the stream's class does not have a | |
304 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
305 | </dt> | |
306 | <dd>bt_message_event_create()</dd> | |
307 | </dl> | |
308 | </dd> | |
309 | </dl> | |
310 | ||
311 | The four creation functions above accept an \bt_ev_cls parameter. When | |
312 | you create the message, the library instantiates this event class as an | |
313 | \bt_ev. Borrow the resulting event with bt_message_event_borrow_event(). | |
314 | This event class must be part of the class of the event message's | |
315 | stream. | |
316 | ||
317 | An event message's event is initially <em>not set</em>: before you emit | |
318 | the event message from a \bt_msg_iter's | |
319 | \link api-msg-iter-cls-meth-next "next" method\endlink, you need to | |
320 | borrow each of its \bt_p_field (with bt_event_borrow_payload_field(), | |
321 | bt_event_borrow_specific_context_field(), and | |
322 | bt_event_borrow_common_context_field()) and, recursively, set the values | |
323 | of the all their inner fields. | |
324 | ||
325 | An event message has the following properties: | |
326 | ||
327 | <dl> | |
328 | <dt>\anchor api-msg-ev-prop-ev Event</dt> | |
329 | <dd> | |
330 | \bt_c_ev which the message transports. | |
331 | ||
332 | This is an instance of the \bt_ev_cls which was passed to the | |
333 | message's creation function. | |
334 | ||
335 | With this event, you can access its \bt_pkt (if any) with | |
336 | bt_event_borrow_packet_const() and its | |
337 | \bt_stream with bt_event_borrow_stream_const(). | |
338 | ||
339 | Borrow an event message's event with bt_message_event_borrow_event() | |
340 | and bt_message_event_borrow_event_const(). | |
341 | </dd> | |
342 | ||
343 | <dt> | |
344 | \anchor api-msg-ev-prop-cs | |
345 | \bt_dt_opt Default \bt_cs | |
346 | </dt> | |
347 | <dd> | |
348 | Snapshot of the message's \bt_stream's default clock when the | |
349 | event occurs. | |
350 | ||
351 | An event message has a default clock snapshot | |
352 | if its stream's \ref api-tir-stream-cls "class" has a | |
353 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class", | |
354 | and has none otherwise. | |
355 | ||
356 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
357 | the default clock snapshot of an event message must be greater than | |
358 | or equal to any default clock snapshot of any previous message. | |
359 | ||
360 | Borrow an event message's default clock snapshot with | |
361 | bt_message_event_borrow_default_clock_snapshot_const(). | |
362 | </dd> | |
363 | </dl> | |
364 | ||
365 | <h2>\anchor api-msg-pb Packet beginning message</h2> | |
366 | ||
367 | A <strong><em>packet beginning message</em></strong> indicates the | |
368 | beginning of a \bt_pkt. | |
369 | ||
370 | A packet beginning message can only exist if its \bt_stream's | |
371 | \ref api-tir-stream-cls "class" | |
372 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets". | |
373 | ||
374 | For a given packet, there can be only one packet beginning message. | |
375 | ||
376 | Within its \bt_stream's \ref api-msg-seq "message sequence", a packet | |
377 | beginning message can only occur after the \bt_sb_msg and before the | |
378 | \bt_se_msg. | |
379 | ||
380 | To create a packet beginning message for a given stream, use: | |
381 | ||
382 | <dl> | |
383 | <dt> | |
384 | If, for this stream's class, | |
385 | \ref api-tir-stream-cls-prop-pkt-beg-cs "packets have a beginning default clock snapshot" | |
386 | </dt> | |
387 | <dd>bt_message_packet_beginning_create_with_default_clock_snapshot()</dd> | |
388 | ||
389 | <dt> | |
390 | If, for this stream's class, packets do not have a beginning default | |
391 | clock snapshot | |
392 | </dt> | |
393 | <dd>bt_message_packet_beginning_create()</dd> | |
394 | </dl> | |
395 | ||
396 | A packet beginning message has the following properties: | |
397 | ||
398 | <dl> | |
399 | <dt>\anchor api-msg-pb-prop-pkt Packet</dt> | |
400 | <dd> | |
401 | \bt_c_pkt of which the message indicates the beginning. | |
402 | ||
403 | You cannot change the packet once the message is created. | |
404 | ||
405 | Borrow a packet beginning message's packet with | |
406 | bt_message_packet_beginning_borrow_packet() and | |
407 | bt_message_packet_beginning_borrow_packet_const(). | |
408 | </dd> | |
409 | ||
410 | <dt> | |
411 | \anchor api-msg-pb-prop-cs | |
412 | \bt_dt_opt Default \bt_cs | |
413 | </dt> | |
414 | <dd> | |
415 | Snapshot of the message's \bt_stream's default clock when the | |
416 | packet begins. | |
417 | ||
418 | A packet beginning message has a default clock snapshot if: | |
419 | ||
420 | - Its stream's \ref api-tir-stream-cls "class" has a | |
421 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
422 | ||
423 | - For its stream's class, | |
424 | \ref api-tir-stream-cls-prop-pkt-beg-cs "packets have a beginning default clock snapshot". | |
425 | ||
426 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
427 | the default clock snapshot of a packet beginning message must be | |
428 | greater than or equal to any clock snapshot of any previous message. | |
429 | ||
430 | Borrow a packet beginning message's default clock snapshot with | |
431 | bt_message_packet_beginning_borrow_default_clock_snapshot_const(). | |
432 | </dd> | |
433 | </dl> | |
434 | ||
435 | <h2>\anchor api-msg-pe Packet end message</h2> | |
436 | ||
437 | A <strong><em>packet end message</em></strong> indicates the | |
438 | end of a \bt_pkt. | |
439 | ||
440 | A packet end message can only exist if its \bt_stream's | |
441 | \ref api-tir-stream-cls "class" | |
442 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets". | |
443 | ||
444 | For a given packet, there can be only one packet end message. | |
445 | ||
446 | Within its \bt_stream's \ref api-msg-seq "message sequence", a packet | |
447 | end message can only occur: | |
448 | ||
449 | - After the \bt_sb_msg and before the \bt_se_msg. | |
450 | - After a \bt_pb_msg for the same packet. | |
451 | ||
452 | To create a packet end message for a given stream, use: | |
453 | ||
454 | <dl> | |
455 | <dt> | |
456 | If, for this stream's class, | |
457 | \ref api-tir-stream-cls-prop-pkt-end-cs "packets have an end default clock snapshot" | |
458 | </dt> | |
459 | <dd>bt_message_packet_end_create_with_default_clock_snapshot()</dd> | |
460 | ||
461 | <dt> | |
462 | If, for this stream's class, packets do not have an end default | |
463 | clock snapshot | |
464 | </dt> | |
465 | <dd>bt_message_packet_end_create()</dd> | |
466 | </dl> | |
467 | ||
468 | A packet end message has the following properties: | |
469 | ||
470 | <dl> | |
471 | <dt>\anchor api-msg-pe-prop-pkt Packet</dt> | |
472 | <dd> | |
473 | \bt_c_pkt of which the message indicates the end. | |
474 | ||
475 | You cannot change the packet once the message is created. | |
476 | ||
477 | Borrow a packet end message's packet with | |
478 | bt_message_packet_end_borrow_packet() and | |
479 | bt_message_packet_end_borrow_packet_const(). | |
480 | </dd> | |
481 | ||
482 | <dt> | |
483 | \anchor api-msg-pe-prop-cs | |
484 | \bt_dt_opt Default \bt_cs | |
485 | </dt> | |
486 | <dd> | |
487 | Snapshot of the message's \bt_stream's default clock when the | |
488 | packet ends. | |
489 | ||
490 | A packet end message has a default clock snapshot if: | |
491 | ||
492 | - Its stream's \ref api-tir-stream-cls "class" has a | |
493 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
494 | ||
495 | - For its stream's class, | |
496 | \ref api-tir-stream-cls-prop-pkt-end-cs "packets have an end default clock snapshot". | |
497 | ||
498 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
499 | the default clock snapshot of a packet end message must be greater | |
500 | than or equal to any clock snapshot of any previous message. | |
501 | ||
502 | Borrow a packet end message's default clock snapshot with | |
503 | bt_message_packet_end_borrow_default_clock_snapshot_const(). | |
504 | </dd> | |
505 | </dl> | |
506 | ||
507 | <h2>\anchor api-msg-disc-ev Discarded events message</h2> | |
508 | ||
509 | A <strong><em>discarded events message</em></strong> indicates that | |
510 | events were discarded at <em>tracing time</em>. It does \em not indicate | |
511 | that \bt_p_ev_msg were dropped during a trace processing \bt_graph run. | |
512 | ||
513 | A discarded events message can only exist if its \bt_stream's | |
514 | \ref api-tir-stream-cls "class" | |
515 | \ref api-tir-stream-cls-prop-supports-disc-ev "supports discarded events". | |
516 | ||
517 | Within its \bt_stream's \ref api-msg-seq "message sequence", a discarded | |
518 | events message can only occur after the \bt_sb_msg and before the | |
519 | \bt_se_msg. | |
520 | ||
521 | To create a discarded events message for a given stream, use: | |
522 | ||
523 | <dl> | |
524 | <dt> | |
525 | If, for this stream's class, | |
526 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots" | |
527 | </dt> | |
528 | <dd>bt_message_discarded_events_create_with_default_clock_snapshots()</dd> | |
529 | ||
530 | <dt> | |
531 | If, for this stream's class, discarded events do not have default | |
532 | clock snapshots | |
533 | </dt> | |
534 | <dd>bt_message_discarded_events_create()</dd> | |
535 | </dl> | |
536 | ||
537 | A discarded events message has the following properties: | |
538 | ||
539 | <dl> | |
540 | <dt>\anchor api-msg-disc-ev-prop-stream Stream</dt> | |
541 | <dd> | |
542 | \bt_c_stream into which events were discarded. | |
543 | ||
544 | You cannot change the stream once the message is created. | |
545 | ||
546 | Borrow a discarded events message's stream with | |
547 | bt_message_discarded_events_borrow_stream() and | |
548 | bt_message_discarded_events_borrow_stream_const(). | |
549 | </dd> | |
550 | ||
551 | <dt> | |
552 | \anchor api-msg-disc-ev-prop-cs-beg | |
553 | \bt_dt_opt Beginning default \bt_cs | |
554 | </dt> | |
555 | <dd> | |
556 | Snapshot of the message's \bt_stream's default clock which indicates | |
557 | the beginning of the discarded events time range. | |
558 | ||
559 | A discarded events message has a beginning default clock snapshot | |
560 | if: | |
561 | ||
562 | - Its stream's \ref api-tir-stream-cls "class" has a | |
563 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
564 | ||
565 | - For its stream's class, | |
566 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots". | |
567 | ||
568 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
569 | the beginning default clock snapshot of a discarded events message | |
570 | must be greater than or equal to any clock snapshot of any previous | |
571 | message. | |
572 | ||
573 | Borrow a discarded events message's beginning default clock snapshot | |
574 | with | |
575 | bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(). | |
576 | </dd> | |
577 | ||
578 | <dt> | |
579 | \anchor api-msg-disc-ev-prop-cs-end | |
580 | \bt_dt_opt End default \bt_cs | |
581 | </dt> | |
582 | <dd> | |
583 | Snapshot of the message's \bt_stream's default clock which indicates | |
584 | the end of the discarded events time range. | |
585 | ||
586 | A discarded events message has an end default clock snapshot if: | |
587 | ||
588 | - Its stream's \ref api-tir-stream-cls "class" has a | |
589 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
590 | ||
591 | - For its stream's class, | |
592 | \ref api-tir-stream-cls-prop-disc-ev-cs "discarded events have default clock snapshots". | |
593 | ||
594 | If a discarded events message has both a | |
595 | \ref api-msg-disc-ev-prop-cs-beg "beginning" and an end default | |
596 | clock snapshots, the end default clock snapshot must be greater than | |
597 | or equal to the beginning default clock snapshot. | |
598 | ||
599 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
600 | the end default clock snapshot of a discarded events message must be | |
601 | greater than or equal to any clock snapshot of any previous message. | |
602 | ||
603 | Borrow a discarded events message's end default clock snapshot with | |
604 | bt_message_discarded_events_borrow_end_default_clock_snapshot_const(). | |
605 | </dd> | |
606 | ||
607 | <dt> | |
608 | \anchor api-msg-disc-ev-prop-count | |
609 | \bt_dt_opt Discarded event count | |
610 | </dt> | |
611 | <dd> | |
612 | Exact number of discarded events. | |
613 | ||
614 | If this property is missing, then the number of discarded events | |
615 | is at least one. | |
616 | ||
617 | Use bt_message_discarded_events_set_count() and | |
618 | bt_message_discarded_events_get_count(). | |
619 | </dd> | |
620 | </dl> | |
621 | ||
622 | <h2>\anchor api-msg-disc-pkt Discarded packets message</h2> | |
623 | ||
624 | A <strong><em>discarded packets message</em></strong> indicates that | |
625 | packets were discarded at <em>tracing time</em>. It does \em not | |
626 | indicate that whole packets were dropped during a trace processing | |
627 | \bt_graph run. | |
628 | ||
629 | A discarded packets message can only exist if its \bt_stream's | |
630 | \ref api-tir-stream-cls "class" | |
631 | \ref api-tir-stream-cls-prop-supports-disc-pkt "supports discarded packets". | |
632 | ||
633 | Within its \bt_stream's \ref api-msg-seq "message sequence", a discarded | |
634 | packets message can only occur: | |
635 | ||
636 | - After the \bt_sb_msg. | |
637 | - Before the \bt_se_msg. | |
638 | - One of: | |
639 | - Before any \bt_pb_msg. | |
640 | - After any \bt_pe_msg. | |
641 | - Between a packet end and a packet beginning message. | |
642 | ||
643 | To create a discarded packets message for a given stream, use: | |
644 | ||
645 | <dl> | |
646 | <dt> | |
647 | If, for this stream's class, | |
648 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots" | |
649 | </dt> | |
650 | <dd>bt_message_discarded_packets_create_with_default_clock_snapshots()</dd> | |
651 | ||
652 | <dt> | |
653 | If, for this stream's class, discarded packets do not have default | |
654 | clock snapshots | |
655 | </dt> | |
656 | <dd>bt_message_discarded_packets_create()</dd> | |
657 | </dl> | |
658 | ||
659 | A discarded packets message has the following properties: | |
660 | ||
661 | <dl> | |
662 | <dt>\anchor api-msg-disc-pkt-prop-stream Stream</dt> | |
663 | <dd> | |
664 | \bt_c_stream into which packets were discarded. | |
665 | ||
666 | You cannot change the stream once the message is created. | |
667 | ||
668 | Borrow a discarded packets message's stream with | |
669 | bt_message_discarded_packets_borrow_stream() and | |
670 | bt_message_discarded_packets_borrow_stream_const(). | |
671 | </dd> | |
672 | ||
673 | <dt> | |
674 | \anchor api-msg-disc-pkt-prop-cs-beg | |
675 | \bt_dt_opt Beginning default \bt_cs | |
676 | </dt> | |
677 | <dd> | |
678 | Snapshot of the message's \bt_stream's default clock which indicates | |
679 | the beginning of the discarded packets time range. | |
680 | ||
681 | A discarded packets message has a beginning default clock snapshot | |
682 | if: | |
683 | ||
684 | - Its stream's \ref api-tir-stream-cls "class" has a | |
685 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
686 | ||
687 | - For its stream's class, | |
688 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots". | |
689 | ||
690 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
691 | the beginning default clock snapshot of a discarded packets message | |
692 | must be greater than or equal to any clock snapshot of any previous | |
693 | message. | |
694 | ||
695 | Borrow a discarded packets message's beginning default clock snapshot | |
696 | with | |
697 | bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(). | |
698 | </dd> | |
699 | ||
700 | <dt> | |
701 | \anchor api-msg-disc-pkt-prop-cs-end | |
702 | \bt_dt_opt End default \bt_cs | |
703 | </dt> | |
704 | <dd> | |
705 | Snapshot of the message's \bt_stream's default clock which indicates | |
706 | the end of the discarded packets time range. | |
707 | ||
708 | A discarded packets message has an end default clock snapshot if: | |
709 | ||
710 | - Its stream's \ref api-tir-stream-cls "class" has a | |
711 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
712 | ||
713 | - For its stream's class, | |
714 | \ref api-tir-stream-cls-prop-disc-pkt-cs "discarded packets have default clock snapshots". | |
715 | ||
716 | If a discarded packets message has both a | |
717 | \ref api-msg-disc-pkt-prop-cs-beg "beginning" and an end default | |
718 | clock snapshots, the end default clock snapshot must be greater than | |
719 | or equal to the beginning default clock snapshot. | |
720 | ||
721 | Within its \bt_msg_iter's \ref api-msg-seq "message sequence", | |
722 | the end default clock snapshot of a discarded packets message must | |
723 | be greater than or equal to any clock snapshot of any previous | |
724 | message. | |
725 | ||
726 | Borrow a discarded packets message's end default clock snapshot with | |
727 | bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(). | |
728 | </dd> | |
729 | ||
730 | <dt> | |
731 | \anchor api-msg-disc-pkt-prop-count | |
732 | \bt_dt_opt Discarded packet count | |
733 | </dt> | |
734 | <dd> | |
735 | Exact number of discarded packets. | |
736 | ||
737 | If this property is missing, then the number of discarded packets | |
738 | is at least one. | |
739 | ||
740 | Use bt_message_discarded_packets_set_count() and | |
741 | bt_message_discarded_packets_get_count(). | |
742 | </dd> | |
743 | </dl> | |
744 | ||
745 | <h2>\anchor api-msg-inac Message iterator inactivity</h2> | |
746 | ||
747 | A <strong><em>message iterator inactivity message</em></strong> | |
748 | indicates that, within the \ref api-msg-seq "message sequence" of a | |
749 | given \bt_msg_iter, there's no messages since the last message (if any) | |
750 | until a given point in time. | |
751 | ||
752 | A message iterator inactivity message is the only type of message that's | |
753 | not related to a \bt_stream: it targets the whole message sequence of a | |
754 | message iterator, and can occur at any position within the sequence. | |
755 | ||
756 | This message is mostly significant for real-time message iterators: if a | |
757 | message iterator A indicates that there's no messages until a given | |
758 | point in time T, then a downstream filter message iterator B which | |
759 | relies on multiple upstream message iterators does not have to wait for | |
760 | new messages from A until T. | |
761 | ||
762 | In other words, a message iterator inactivity message can help | |
763 | downstream message iterators or \bt_p_sink_comp <em>progress</em>. | |
764 | ||
765 | Create a message iterator inactivity message with | |
766 | bt_message_message_iterator_inactivity_create(). You must pass a | |
767 | \bt_clock_cls and the value of a fictitious (clock) instance to this | |
768 | function so that it creates a \bt_cs. | |
769 | ||
770 | A message iterator inactivity message has the following property: | |
771 | ||
772 | <dl> | |
773 | <dt> | |
774 | \anchor api-msg-inac-prop-cs | |
775 | \bt_dt_opt \bt_c_cs | |
776 | </dt> | |
777 | <dd> | |
778 | Snapshot of a fictitious instance of the message's \bt_clock_cls | |
779 | which indicates the point in time until when there's no messages | |
780 | in the message iterator's \ref api-msg-seq "message sequence". | |
781 | ||
782 | Within its \bt_msg_iter's message sequence, the clock snapshot of a | |
783 | message iterator inactivity message must be greater than or equal to | |
784 | any clock snapshot of any previous message. | |
785 | ||
786 | Borrow a message iterator inactivity message's clock snapshot | |
787 | with | |
788 | bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(). | |
789 | </dd> | |
790 | </dl> | |
791 | ||
792 | <h1>\anchor api-msg-mip Message Interchange Protocol</h1> | |
793 | ||
794 | The <em>Message Interchange Protocol</em> (MIP) is the system of rules | |
795 | used by \bt_p_comp and \bt_p_msg_iter to exchance messages within a | |
796 | trace processing graph. | |
797 | ||
798 | The MIP covers everything related to messages and what they contain, as | |
799 | well as how they are ordered within the \ref api-msg-seq "sequence" that | |
800 | a message iterator produces. | |
801 | ||
802 | For example: | |
803 | ||
804 | - A valid message sequence for a given \bt_stream starts with a | |
805 | \bt_sb_msg and ends with a \bt_se_msg. | |
806 | ||
807 | - The maximum | |
808 | \ref api-tir-fc-int-prop-size "field value range" for an \bt_uint_fc | |
1eca514c | 809 | is [0, 2<sup>64</sup> − 1]. |
43c59509 PP |
810 | |
811 | - The available message types are stream beginning and end, event, | |
812 | packet beginning and end, discarded events and packets, and message | |
813 | iterator inactivity. | |
814 | ||
815 | The MIP has a version which is a single major number, independent from | |
816 | the \bt_name project's version. As of \bt_name_version_min_maj, the only | |
817 | available MIP version is 0. | |
818 | ||
819 | If what the MIP covers changes in a breaking or semantical way in the | |
820 | future, the MIP and \bt_name's minor versions will be bumped. | |
821 | ||
822 | When you create a trace processing \bt_graph with bt_graph_create(), you | |
823 | must pass the effective MIP version to use. Then, the components you | |
824 | \ref api-graph-lc-add "add" to this graph can access this configured MIP | |
825 | version with bt_self_component_get_graph_mip_version() and behave | |
826 | accordingly. In other words, if the configured MIP version is 0, then a | |
827 | component cannot use features introduced by MIP version 1. For | |
828 | example, should the project introduce a new type of \bt_fc, the MIP | |
829 | version would be bumped. | |
830 | ||
831 | A component which cannot honor a given MIP can fail at | |
832 | initialization time, making the corresponding | |
833 | <code>bt_graph_add_*_component*()</code> call fail too. To avoid any | |
834 | surprise, you can create a \bt_comp_descr_set with descriptors of the | |
835 | components you intend to add to a trace processing graph and call | |
836 | bt_get_greatest_operative_mip_version() to get the greatest (most | |
837 | recent) MIP version you can use. | |
838 | ||
839 | To get the library's latest MIP version, use | |
840 | bt_get_maximal_mip_version(). | |
841 | ||
842 | The ultimate goal of the MIP version feature is for the \bt_name project | |
843 | to be able to introduce new features or even major breaking changes | |
844 | without breaking existing \bt_p_comp_cls. This is especially important | |
845 | considering that \bt_name supports \bt_p_plugin written by different | |
846 | authors. Of course one of the project's objectives is to bump the MIP | |
847 | version as rarely as possible. When it is required, though, it's a | |
848 | welcome tool to make the project evolve gracefully. | |
849 | ||
850 | The Message Interchange Protocol has no dedicated documentation as this | |
851 | very message module (and its submodules, like \ref api-tir) | |
852 | documentation is enough. You can consider that all the | |
853 | functions of the message and trace IR objects have an implicit MIP | |
854 | version \ref api-fund-pre-post "precondition". When a given | |
855 | function documentation does not explicitly document a MIP version | |
856 | precondition, it means that the effective MIP version has no effect on | |
857 | said function's behaviour. | |
858 | ||
859 | <h2>\anchor api-msg-seq Message sequence rules</h2> | |
860 | ||
861 | The purpose of a \bt_msg_iter is to iterate a sequence of messages. | |
862 | ||
863 | Those messages can be related to different \bt_p_stream: | |
864 | ||
865 | @image html trace-structure-msg-seq.png "Messages of multiple streams as a single message sequence for a given message iterator." | |
866 | ||
867 | However, for such a message sequence, the current \bt_mip | |
868 | (version \bt_max_mip_version) dictates that: | |
869 | ||
870 | <ul> | |
871 | <li> | |
872 | For a given \bt_stream: | |
873 | ||
874 | - The sequence must begin with a \bt_sb_msg. | |
875 | - The sequence must end with a \bt_se_msg. | |
876 | - <strong>If the stream's \ref api-tir-stream-cls "class" | |
877 | \ref api-tir-stream-cls-prop-supports-pkt "supports packets"</strong>: | |
878 | - Any \bt_pb_msg must be followed with a \bt_pe_msg. | |
879 | - All \bt_p_ev_msg must be between a packet beginning and a | |
880 | packet end message. | |
881 | - A \bt_disc_pkt_msg must be (one of): | |
882 | - Before the first packet beginning message. | |
883 | - Between a packet end message and a packet beginning message. | |
884 | - After the last packet end message. | |
885 | ||
886 | The rules above can be summarized by the following regular | |
887 | expressions: | |
888 | ||
889 | <dl> | |
890 | <dt>Without packets</dt> | |
891 | <dd> | |
892 | @code{.unparsed} | |
893 | SB (E | DE)* SE | |
894 | @endcode | |
895 | </dd> | |
896 | ||
897 | <dt>With packets</dt> | |
898 | <dd> | |
899 | @code{.unparsed} | |
900 | SB ((PB (E | DE)* PE) | DE | DP)* SE | |
901 | @endcode | |
902 | </dd> | |
903 | </dl> | |
904 | ||
905 | With this alphabet: | |
906 | ||
907 | <dl> | |
908 | <dt>SB</dt> | |
909 | <dd>\bt_c_sb_msg</dd> | |
910 | ||
911 | <dt>SE</dt> | |
912 | <dd>\bt_c_se_msg</dd> | |
913 | ||
914 | <dt>E</dt> | |
915 | <dd>\bt_c_ev_msg</dd> | |
916 | ||
917 | <dt>PB</dt> | |
918 | <dd>\bt_c_pb_msg</dd> | |
919 | ||
920 | <dt>PE</dt> | |
921 | <dd>\bt_c_pe_msg</dd> | |
922 | ||
923 | <dt>DE</dt> | |
924 | <dd>\bt_c_disc_ev_msg</dd> | |
925 | ||
926 | <dt>DP</dt> | |
927 | <dd>\bt_c_disc_pkt_msg</dd> | |
928 | </dl> | |
929 | <li> | |
930 | For a given message iterator, for any message with a \bt_cs, its | |
931 | clock snapshot must be greater than or equal to any clock snapshot | |
932 | of any previous message. | |
933 | ||
934 | For the scope of this rule, the clock snapshot of a \bt_disc_ev_msg | |
935 | or of a \bt_disc_pkt_msg is its beginning default clock snapshot. | |
936 | <li> | |
937 | For a given message iterator, the \bt_p_cs of all the messages of | |
938 | the sequence with a clock snapshot must be correlatable | |
939 | (see \ref api-tir-clock-cls-origin "Clock value vs. clock class origin"). | |
940 | </ul> | |
941 | */ | |
942 | ||
943 | /*! @{ */ | |
944 | ||
945 | /*! | |
946 | @name Type | |
947 | @{ | |
948 | ||
949 | @typedef struct bt_message bt_message; | |
950 | ||
951 | @brief | |
952 | Message. | |
953 | ||
954 | @} | |
955 | */ | |
956 | ||
957 | /*! | |
958 | @name Type query | |
959 | @{ | |
960 | */ | |
961 | ||
962 | /*! | |
963 | @brief | |
964 | Message type enumerators. | |
965 | */ | |
966 | typedef enum bt_message_type { | |
967 | /*! | |
968 | @brief | |
969 | \bt_c_sb_msg. | |
970 | */ | |
971 | BT_MESSAGE_TYPE_STREAM_BEGINNING = 1 << 0, | |
972 | ||
973 | /*! | |
974 | @brief | |
975 | \bt_c_se_msg. | |
976 | */ | |
977 | BT_MESSAGE_TYPE_STREAM_END = 1 << 1, | |
978 | ||
979 | /*! | |
980 | @brief | |
981 | \bt_c_ev_msg. | |
982 | */ | |
983 | BT_MESSAGE_TYPE_EVENT = 1 << 2, | |
984 | ||
985 | /*! | |
986 | @brief | |
987 | \bt_c_pb_msg. | |
988 | */ | |
989 | BT_MESSAGE_TYPE_PACKET_BEGINNING = 1 << 3, | |
990 | ||
991 | /*! | |
992 | @brief | |
993 | \bt_c_pe_msg. | |
994 | */ | |
995 | BT_MESSAGE_TYPE_PACKET_END = 1 << 4, | |
996 | ||
997 | /*! | |
998 | @brief | |
999 | \bt_c_disc_ev_msg. | |
1000 | */ | |
1001 | BT_MESSAGE_TYPE_DISCARDED_EVENTS = 1 << 5, | |
1002 | ||
1003 | /*! | |
1004 | @brief | |
1005 | \bt_c_disc_pkt_msg. | |
1006 | */ | |
1007 | BT_MESSAGE_TYPE_DISCARDED_PACKETS = 1 << 6, | |
1008 | ||
1009 | /*! | |
1010 | @brief | |
1011 | \bt_c_inac_msg. | |
1012 | */ | |
1013 | BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY = 1 << 7, | |
1014 | } bt_message_type; | |
1015 | ||
1016 | /*! | |
1017 | @brief | |
1018 | Returns the type enumerator of the message \bt_p{message}. | |
1019 | ||
1020 | @param[in] message | |
1021 | Message of which to get the type enumerator | |
1022 | ||
1023 | @returns | |
1024 | Type enumerator of \bt_p{message}. | |
1025 | ||
1026 | @bt_pre_not_null{message} | |
1027 | */ | |
1028 | extern bt_message_type bt_message_get_type(const bt_message *message); | |
1029 | ||
1030 | /*! @} */ | |
1031 | ||
1032 | /*! | |
1033 | @name Common stream message | |
1034 | @{ | |
1035 | */ | |
1036 | ||
1037 | /*! | |
1038 | @brief | |
1039 | Return type of | |
1040 | bt_message_stream_beginning_borrow_default_clock_snapshot_const() | |
1041 | and | |
1042 | bt_message_stream_end_borrow_default_clock_snapshot_const(). | |
1043 | */ | |
1044 | typedef enum bt_message_stream_clock_snapshot_state { | |
1045 | /*! | |
1046 | @brief | |
1047 | Known \bt_cs. | |
1048 | */ | |
1049 | BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN = 1, | |
1050 | ||
1051 | /*! | |
1052 | @brief | |
1053 | Unknown (no) \bt_cs. | |
1054 | */ | |
1055 | BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN = 0, | |
1056 | } bt_message_stream_clock_snapshot_state; | |
1057 | ||
1058 | /*! @} */ | |
1059 | ||
1060 | /*! | |
1061 | @name Stream beginning message | |
1062 | @{ | |
1063 | */ | |
1064 | ||
1065 | /*! | |
1066 | @brief | |
1067 | Creates a \bt_sb_msg for the \bt_stream \bt_p{stream} from the | |
1068 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1069 | ||
1070 | On success, the returned stream beginning message has the following | |
1071 | property values: | |
1072 | ||
1073 | <table> | |
1074 | <tr> | |
1075 | <th>Property | |
1076 | <th>Value | |
1077 | <tr> | |
1078 | <td>\ref api-msg-sb-prop-stream "Stream" | |
1079 | <td>\bt_p{stream} | |
1080 | <tr> | |
1081 | <td>\ref api-msg-sb-prop-cs "Default clock snapshot" | |
1082 | <td>\em None | |
1083 | </table> | |
1084 | ||
1085 | @param[in] self_message_iterator | |
1086 | Self message iterator from which to create the stream beginning | |
1087 | message. | |
1088 | @param[in] stream | |
1089 | Stream of which the message to create indicates the beginning. | |
1090 | ||
1091 | @returns | |
1092 | New stream beginning message reference, or \c NULL on memory error. | |
1093 | ||
1094 | @bt_pre_not_null{self_message_iterator} | |
1095 | @bt_pre_not_null{stream} | |
1096 | ||
1097 | @bt_post_success_frozen{stream} | |
1098 | */ | |
1099 | extern | |
1100 | bt_message *bt_message_stream_beginning_create( | |
1101 | bt_self_message_iterator *self_message_iterator, | |
1102 | const bt_stream *stream); | |
1103 | ||
1104 | /*! | |
1105 | @brief | |
1106 | Borrows the \bt_stream of the \bt_sb_msg \bt_p{message}. | |
1107 | ||
1108 | See the \ref api-msg-sb-prop-stream "stream" property. | |
1109 | ||
1110 | @param[in] message | |
1111 | Stream beginning message from which to borrow the stream. | |
1112 | ||
1113 | @returns | |
1114 | @parblock | |
1115 | \em Borrowed reference of the stream of \bt_p{message}. | |
1116 | ||
1117 | The returned pointer remains valid as long as \bt_p{message} exists. | |
1118 | @endparblock | |
1119 | ||
1120 | @bt_pre_not_null{message} | |
1121 | @bt_pre_is_sb_msg{message} | |
1122 | ||
1123 | @sa bt_message_stream_beginning_borrow_stream_const() — | |
1124 | \c const version of this function. | |
1125 | */ | |
1126 | extern bt_stream *bt_message_stream_beginning_borrow_stream( | |
1127 | bt_message *message); | |
1128 | ||
1129 | /*! | |
1130 | @brief | |
1131 | Borrows the \bt_stream of the \bt_sb_msg \bt_p{message} | |
1132 | (\c const version). | |
1133 | ||
1134 | See bt_message_stream_beginning_borrow_stream(). | |
1135 | */ | |
1136 | extern const bt_stream *bt_message_stream_beginning_borrow_stream_const( | |
1137 | const bt_message *message); | |
1138 | ||
1139 | /*! | |
1140 | @brief | |
1141 | Sets the value, in clock cycles, of the default \bt_cs of the | |
1142 | \bt_sb_msg \bt_p{message} to \bt_p{value}. | |
1143 | ||
1144 | See the \ref api-msg-sb-prop-cs "default clock snapshot" property. | |
1145 | ||
1146 | @param[in] message | |
1147 | Stream beginning message of which to set the default clock snapshot | |
1148 | value to \bt_p{value}. | |
1149 | @param[in] value | |
1150 | New value (clock cycles) of the default clock snapshot of | |
1151 | \bt_p{message}. | |
1152 | ||
1153 | @bt_pre_not_null{message} | |
1154 | @bt_pre_hot{message} | |
1155 | @bt_pre_is_sb_msg{message} | |
1156 | @pre | |
1157 | The \bt_stream_cls of \bt_p{message} has a | |
1158 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
1159 | ||
1160 | @sa bt_message_stream_beginning_borrow_default_clock_snapshot_const() — | |
1161 | Borrows the default clock snapshot of a stream beginning message. | |
1162 | */ | |
1163 | extern | |
1164 | void bt_message_stream_beginning_set_default_clock_snapshot( | |
1165 | bt_message *message, uint64_t value); | |
1166 | ||
1167 | /*! | |
1168 | @brief | |
1169 | Borrows the default \bt_cs of the \bt_sb_msg \bt_p{message}. | |
1170 | ||
1171 | See the \ref api-msg-sb-prop-cs "default clock snapshot" property. | |
1172 | ||
1173 | @param[in] message | |
1174 | Stream beginning message from which to borrow the default clock | |
1175 | snapshot. | |
1176 | @param[out] clock_snapshot | |
1177 | <strong>If this function returns | |
1178 | #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN</strong>, | |
1179 | \bt_p{*clock_snapshot} is a \em borrowed reference of the default | |
1180 | clock snapshot of \bt_p{message}. | |
1181 | ||
1182 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN | |
1183 | The default clock snapshot of \bt_p{message} is known and returned | |
1184 | as \bt_p{*clock_snapshot}. | |
1185 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN | |
1186 | \bt_p{message} has no default clock snapshot: its time is unknown. | |
1187 | ||
1188 | @bt_pre_not_null{message} | |
1189 | @bt_pre_is_sb_msg{message} | |
1190 | @pre | |
1191 | The \bt_stream_cls of \bt_p{message} has a | |
1192 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
1193 | @bt_pre_not_null{clock_snapshot} | |
1194 | ||
1195 | @sa bt_message_stream_beginning_set_default_clock_snapshot() — | |
1196 | Sets the default clock snapshot of a stream beginning message. | |
1197 | */ | |
1198 | extern bt_message_stream_clock_snapshot_state | |
1199 | bt_message_stream_beginning_borrow_default_clock_snapshot_const( | |
1200 | const bt_message *message, | |
1201 | const bt_clock_snapshot **clock_snapshot); | |
1202 | ||
1203 | /*! | |
1204 | @brief | |
1205 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
1206 | of the \bt_sb_msg \bt_p{message}. | |
1207 | ||
1208 | See the stream class's | |
1209 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
1210 | property. | |
1211 | ||
1212 | This is a helper which is equivalent to | |
1213 | ||
1214 | @code | |
1215 | bt_stream_class_borrow_default_clock_class_const( | |
1216 | bt_stream_borrow_class_const( | |
1217 | bt_message_stream_beginning_borrow_stream_const(message))) | |
1218 | @endcode | |
1219 | ||
1220 | @param[in] message | |
1221 | Stream beginning message from which to borrow its stream's class's | |
1222 | default clock class. | |
1223 | ||
1224 | @returns | |
1225 | \em Borrowed reference of the default clock class of | |
1226 | the stream class of \bt_p{message}, or \c NULL if none. | |
1227 | ||
1228 | @bt_pre_not_null{message} | |
1229 | @bt_pre_is_sb_msg{message} | |
1230 | */ | |
1231 | extern const bt_clock_class * | |
1232 | bt_message_stream_beginning_borrow_stream_class_default_clock_class_const( | |
1233 | const bt_message *message); | |
1234 | ||
1235 | /*! @} */ | |
1236 | ||
1237 | /*! | |
1238 | @name Stream end message | |
1239 | @{ | |
1240 | */ | |
1241 | ||
1242 | /*! | |
1243 | @brief | |
1244 | Creates a \bt_se_msg for the \bt_stream \bt_p{stream} from the | |
1245 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1246 | ||
1247 | On success, the returned stream end message has the following | |
1248 | property values: | |
1249 | ||
1250 | <table> | |
1251 | <tr> | |
1252 | <th>Property | |
1253 | <th>Value | |
1254 | <tr> | |
1255 | <td>\ref api-msg-se-prop-stream "Stream" | |
1256 | <td>\bt_p{stream} | |
1257 | <tr> | |
1258 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" | |
1259 | <td>\em None | |
1260 | </table> | |
1261 | ||
1262 | @param[in] self_message_iterator | |
1263 | Self message iterator from which to create the stream end | |
1264 | message. | |
1265 | @param[in] stream | |
1266 | Stream of which the message to create indicates the end. | |
1267 | ||
1268 | @returns | |
1269 | New stream end message reference, or \c NULL on memory error. | |
1270 | ||
1271 | @bt_pre_not_null{self_message_iterator} | |
1272 | @bt_pre_not_null{stream} | |
1273 | ||
1274 | @bt_post_success_frozen{stream} | |
1275 | */ | |
1276 | extern | |
1277 | bt_message *bt_message_stream_end_create( | |
1278 | bt_self_message_iterator *self_message_iterator, | |
1279 | const bt_stream *stream); | |
1280 | ||
1281 | /*! | |
1282 | @brief | |
1283 | Borrows the \bt_stream of the \bt_se_msg \bt_p{message}. | |
1284 | ||
1285 | See the \ref api-msg-se-prop-stream "stream" property. | |
1286 | ||
1287 | @param[in] message | |
1288 | Stream end message from which to borrow the stream. | |
1289 | ||
1290 | @returns | |
1291 | @parblock | |
1292 | \em Borrowed reference of the stream of \bt_p{message}. | |
1293 | ||
1294 | The returned pointer remains valid as long as \bt_p{message} exists. | |
1295 | @endparblock | |
1296 | ||
1297 | @bt_pre_not_null{message} | |
1298 | @bt_pre_is_se_msg{message} | |
1299 | ||
1300 | @sa bt_message_stream_end_borrow_stream_const() — | |
1301 | \c const version of this function. | |
1302 | */ | |
1303 | extern bt_stream *bt_message_stream_end_borrow_stream( | |
1304 | bt_message *message); | |
1305 | ||
1306 | /*! | |
1307 | @brief | |
1308 | Borrows the \bt_stream of the \bt_se_msg \bt_p{message} | |
1309 | (\c const version). | |
1310 | ||
1311 | See bt_message_stream_end_borrow_stream(). | |
1312 | */ | |
1313 | extern const bt_stream *bt_message_stream_end_borrow_stream_const( | |
1314 | const bt_message *message); | |
1315 | ||
1316 | /*! | |
1317 | @brief | |
1318 | Sets the value, in clock cycles, of the default \bt_cs of the | |
1319 | \bt_se_msg \bt_p{message} to \bt_p{value}. | |
1320 | ||
1321 | See the \ref api-msg-se-prop-cs "default clock snapshot" property. | |
1322 | ||
1323 | @param[in] message | |
1324 | Stream end message of which to set the default clock snapshot | |
1325 | value to \bt_p{value}. | |
1326 | @param[in] value | |
1327 | New value (clock cycles) of the default clock snapshot of | |
1328 | \bt_p{message}. | |
1329 | ||
1330 | @bt_pre_not_null{message} | |
1331 | @bt_pre_hot{message} | |
1332 | @bt_pre_is_se_msg{message} | |
1333 | @pre | |
1334 | The \bt_stream_cls of \bt_p{message} has a | |
1335 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
1336 | ||
1337 | @sa bt_message_stream_end_borrow_default_clock_snapshot_const() — | |
1338 | Borrows the default clock snapshot of a stream end message. | |
1339 | */ | |
1340 | extern | |
1341 | void bt_message_stream_end_set_default_clock_snapshot( | |
1342 | bt_message *message, uint64_t value); | |
1343 | ||
1344 | /*! | |
1345 | @brief | |
1346 | Borrows the default \bt_cs of the \bt_se_msg \bt_p{message}. | |
1347 | ||
1348 | See the \ref api-msg-se-prop-cs "default clock snapshot" property. | |
1349 | ||
1350 | @param[in] message | |
1351 | Stream end message from which to borrow the default clock | |
1352 | snapshot. | |
1353 | @param[out] clock_snapshot | |
1354 | <strong>If this function returns | |
1355 | #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN</strong>, | |
1356 | \bt_p{*clock_snapshot} is a \em borrowed reference of the default | |
1357 | clock snapshot of \bt_p{message}. | |
1358 | ||
1359 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN | |
1360 | The default clock snapshot of \bt_p{message} is known and returned | |
1361 | as \bt_p{*clock_snapshot}. | |
1362 | @retval #BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_UNKNOWN | |
1363 | \bt_p{message} has no default clock snapshot: its time is unknown. | |
1364 | ||
1365 | @bt_pre_not_null{message} | |
1366 | @bt_pre_is_se_msg{message} | |
1367 | @pre | |
1368 | The \bt_stream_cls of \bt_p{message} has a | |
1369 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
1370 | @bt_pre_not_null{clock_snapshot} | |
1371 | ||
1372 | @sa bt_message_stream_end_set_default_clock_snapshot() — | |
1373 | Sets the default clock snapshot of a stream end message. | |
1374 | */ | |
1375 | extern bt_message_stream_clock_snapshot_state | |
1376 | bt_message_stream_end_borrow_default_clock_snapshot_const( | |
1377 | const bt_message *message, | |
1378 | const bt_clock_snapshot **clock_snapshot); | |
1379 | ||
1380 | /*! | |
1381 | @brief | |
1382 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
1383 | of the \bt_se_msg \bt_p{message}. | |
1384 | ||
1385 | See the stream class's | |
1386 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
1387 | property. | |
1388 | ||
1389 | This is a helper which is equivalent to | |
1390 | ||
1391 | @code | |
1392 | bt_stream_class_borrow_default_clock_class_const( | |
1393 | bt_stream_borrow_class_const( | |
1394 | bt_message_stream_end_borrow_stream_const(message))) | |
1395 | @endcode | |
1396 | ||
1397 | @param[in] message | |
1398 | Stream end message from which to borrow its stream's class's | |
1399 | default clock class. | |
1400 | ||
1401 | @returns | |
1402 | \em Borrowed reference of the default clock class of | |
1403 | the stream class of \bt_p{message}, or \c NULL if none. | |
1404 | ||
1405 | @bt_pre_not_null{message} | |
1406 | @bt_pre_is_se_msg{message} | |
1407 | */ | |
1408 | extern const bt_clock_class * | |
1409 | bt_message_stream_end_borrow_stream_class_default_clock_class_const( | |
1410 | const bt_message *message); | |
1411 | ||
1412 | /*! @} */ | |
1413 | ||
1414 | /*! | |
1415 | @name Event message | |
1416 | @{ | |
1417 | */ | |
1418 | ||
1419 | /*! | |
1420 | @brief | |
1421 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls | |
1422 | \bt_p{event_class}, for the \bt_stream \bt_p{stream} from the | |
1423 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1424 | ||
1425 | @attention | |
1426 | @parblock | |
1427 | Only use this function if | |
1428 | ||
1429 | @code | |
1430 | bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream)) | |
1431 | @endcode | |
1432 | ||
1433 | returns #BT_FALSE and | |
1434 | ||
1435 | @code | |
1436 | bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream)) | |
1437 | @endcode | |
1438 | ||
1439 | returns \c NULL. | |
1440 | ||
1441 | Otherwise, use | |
1442 | bt_message_event_create_with_default_clock_snapshot(), | |
1443 | bt_message_event_create_with_packet(), or | |
1444 | bt_message_event_create_with_packet_and_default_clock_snapshot(). | |
1445 | @endparblock | |
1446 | ||
1447 | On success, the returned event message has the following property | |
1448 | values: | |
1449 | ||
1450 | <table> | |
1451 | <tr> | |
1452 | <th>Property | |
1453 | <th>Value | |
1454 | <tr> | |
1455 | <td>\ref api-msg-ev-prop-ev "Event" | |
1456 | <td> | |
1457 | An instance (with \bt_p_field that are not set) of | |
1458 | \bt_p{event_class}. | |
1459 | <tr> | |
1460 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" | |
1461 | <td>\em None | |
1462 | </table> | |
1463 | ||
1464 | @param[in] self_message_iterator | |
1465 | Self message iterator from which to create the event message. | |
1466 | @param[in] event_class | |
1467 | Class of the \bt_ev of the message to create. | |
1468 | @param[in] stream | |
1469 | Stream conceptually containing the event of the message to create. | |
1470 | ||
1471 | @returns | |
1472 | New event message reference, or \c NULL on memory error. | |
1473 | ||
1474 | @bt_pre_not_null{self_message_iterator} | |
1475 | @pre | |
1476 | The \bt_stream_cls of \bt_p{event_class} is also the class of | |
1477 | \bt_p{stream}, that is, | |
1478 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> | |
1479 | and | |
1480 | <code>bt_stream_borrow_class_const(stream)</code> have the | |
1481 | same value. | |
1482 | @bt_pre_not_null{stream} | |
1483 | @pre | |
1484 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream))</code> | |
1485 | returns #BT_FALSE. | |
1486 | @pre | |
1487 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream))</code> | |
1488 | returns \c NULL. | |
1489 | ||
1490 | @bt_post_success_frozen{event_class} | |
1491 | @bt_post_success_frozen{stream} | |
1492 | */ | |
1493 | extern | |
1494 | bt_message *bt_message_event_create( | |
1495 | bt_self_message_iterator *self_message_iterator, | |
1496 | const bt_event_class *event_class, | |
1497 | const bt_stream *stream); | |
1498 | ||
1499 | /*! | |
1500 | @brief | |
1501 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls | |
1502 | \bt_p{event_class} and a default \bt_cs with the value | |
1503 | \bt_p{clock_snapshot_value}, for the \bt_stream \bt_p{stream} from | |
1504 | the \bt_msg_iter \bt_p{self_message_iterator}. | |
1505 | ||
1506 | @attention | |
1507 | @parblock | |
1508 | Only use this function if | |
1509 | ||
1510 | @code | |
1511 | bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream)) | |
1512 | @endcode | |
1513 | ||
1514 | returns #BT_FALSE and | |
1515 | ||
1516 | @code | |
1517 | bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream)) | |
1518 | @endcode | |
1519 | ||
1520 | does \em not return \c NULL. | |
1521 | ||
1522 | Otherwise, use | |
1523 | bt_message_event_create(), | |
1524 | bt_message_event_create_with_packet(), or | |
1525 | bt_message_event_create_with_packet_and_default_clock_snapshot(). | |
1526 | @endparblock | |
1527 | ||
1528 | On success, the returned event message has the following property | |
1529 | values: | |
1530 | ||
1531 | <table> | |
1532 | <tr> | |
1533 | <th>Property | |
1534 | <th>Value | |
1535 | <tr> | |
1536 | <td>\ref api-msg-ev-prop-ev "Event" | |
1537 | <td> | |
1538 | An instance (with \bt_p_field that are not set) of | |
1539 | \bt_p{event_class}. | |
1540 | <tr> | |
1541 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" | |
1542 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. | |
1543 | </table> | |
1544 | ||
1545 | @param[in] self_message_iterator | |
1546 | Self message iterator from which to create the event message. | |
1547 | @param[in] event_class | |
1548 | Class of the \bt_ev of the message to create. | |
1549 | @param[in] stream | |
1550 | Stream conceptually containing the event of the message to create. | |
1551 | @param[in] clock_snapshot_value | |
1552 | Value (clock cycles) of the default clock snapshot of | |
1553 | \bt_p{message}. | |
1554 | ||
1555 | @returns | |
1556 | New event message reference, or \c NULL on memory error. | |
1557 | ||
1558 | @bt_pre_not_null{self_message_iterator} | |
1559 | @pre | |
1560 | The \bt_stream_cls of \bt_p{event_class} is also the class of | |
1561 | \bt_p{stream}, that is, | |
1562 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> | |
1563 | and | |
1564 | <code>bt_stream_borrow_class_const(stream)</code> have the | |
1565 | same value. | |
1566 | @bt_pre_not_null{stream} | |
1567 | @pre | |
1568 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(stream))</code> | |
1569 | returns #BT_FALSE. | |
1570 | @pre | |
1571 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(stream))</code> | |
1572 | does \em not return \c NULL. | |
1573 | ||
1574 | @bt_post_success_frozen{event_class} | |
1575 | @bt_post_success_frozen{stream} | |
1576 | */ | |
1577 | extern | |
1578 | bt_message *bt_message_event_create_with_default_clock_snapshot( | |
1579 | bt_self_message_iterator *self_message_iterator, | |
1580 | const bt_event_class *event_class, | |
1581 | const bt_stream *stream, uint64_t clock_snapshot_value); | |
1582 | ||
1583 | /*! | |
1584 | @brief | |
1585 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls | |
1586 | \bt_p{event_class}, for the \bt_pkt \bt_p{packet} from the | |
1587 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1588 | ||
1589 | @attention | |
1590 | @parblock | |
1591 | Only use this function if | |
1592 | ||
1593 | @code | |
1594 | bt_stream_class_supports_packets( | |
1595 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1596 | @endcode | |
1597 | ||
1598 | returns #BT_TRUE and | |
1599 | ||
1600 | @code | |
1601 | bt_stream_class_borrow_default_clock_class_const( | |
1602 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1603 | @endcode | |
1604 | ||
1605 | returns \c NULL. | |
1606 | ||
1607 | Otherwise, use | |
1608 | bt_message_event_create(), | |
1609 | bt_message_event_create_with_default_clock_snapshot(), or | |
1610 | bt_message_event_create_with_packet_and_default_clock_snapshot(). | |
1611 | @endparblock | |
1612 | ||
1613 | On success, the returned event message has the following property | |
1614 | values: | |
1615 | ||
1616 | <table> | |
1617 | <tr> | |
1618 | <th>Property | |
1619 | <th>Value | |
1620 | <tr> | |
1621 | <td>\ref api-msg-ev-prop-ev "Event" | |
1622 | <td> | |
1623 | An instance (with \bt_p_field that are not set) of | |
1624 | \bt_p{event_class}. | |
1625 | <tr> | |
1626 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" | |
1627 | <td>\em None | |
1628 | </table> | |
1629 | ||
1630 | @param[in] self_message_iterator | |
1631 | Self message iterator from which to create the event message. | |
1632 | @param[in] event_class | |
1633 | Class of the \bt_ev of the message to create. | |
1634 | @param[in] packet | |
1635 | Packet conceptually containing the event of the message to create. | |
1636 | ||
1637 | @returns | |
1638 | New event message reference, or \c NULL on memory error. | |
1639 | ||
1640 | @bt_pre_not_null{self_message_iterator} | |
1641 | @pre | |
1642 | The \bt_stream_cls of \bt_p{event_class} is also the stream class of | |
1643 | \bt_p{packet}, that is, | |
1644 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> | |
1645 | and | |
1646 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code> | |
1647 | have the same value. | |
1648 | @bt_pre_not_null{packet} | |
1649 | @pre | |
1650 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> | |
1651 | returns #BT_TRUE. | |
1652 | @pre | |
1653 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> | |
1654 | returns \c NULL. | |
1655 | @pre | |
1656 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
1657 | any, and all its contained \bt_p_field, recursively, are set. | |
1658 | ||
1659 | @bt_post_success_frozen{event_class} | |
1660 | @bt_post_success_frozen{packet} | |
1661 | */ | |
1662 | extern | |
1663 | bt_message *bt_message_event_create_with_packet( | |
1664 | bt_self_message_iterator *self_message_iterator, | |
1665 | const bt_event_class *event_class, | |
1666 | const bt_packet *packet); | |
1667 | ||
1668 | /*! | |
1669 | @brief | |
1670 | Creates an \bt_ev_msg, having an instance of the \bt_ev_cls | |
1671 | \bt_p{event_class} and a default \bt_cs with the value | |
1672 | \bt_p{clock_snapshot_value}, for the \bt_pkt \bt_p{packet} from | |
1673 | the \bt_msg_iter \bt_p{self_message_iterator}. | |
1674 | ||
1675 | @attention | |
1676 | @parblock | |
1677 | Only use this function if | |
1678 | ||
1679 | @code | |
1680 | bt_stream_class_supports_packets( | |
1681 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1682 | @endcode | |
1683 | ||
1684 | returns #BT_TRUE and | |
1685 | ||
1686 | @code | |
1687 | bt_stream_class_borrow_default_clock_class_const( | |
1688 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1689 | @endcode | |
1690 | ||
1691 | does \em not return \c NULL. | |
1692 | ||
1693 | Otherwise, use | |
1694 | bt_message_event_create(), | |
1695 | bt_message_event_create_with_default_clock_snapshot(), or | |
1696 | bt_message_event_create_with_packet(). | |
1697 | @endparblock | |
1698 | ||
1699 | On success, the returned event message has the following property | |
1700 | values: | |
1701 | ||
1702 | <table> | |
1703 | <tr> | |
1704 | <th>Property | |
1705 | <th>Value | |
1706 | <tr> | |
1707 | <td>\ref api-msg-ev-prop-ev "Event" | |
1708 | <td> | |
1709 | An instance (with \bt_p_field that are not set) of | |
1710 | \bt_p{event_class}. | |
1711 | <tr> | |
1712 | <td>\ref api-msg-se-prop-cs "Default clock snapshot" | |
1713 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. | |
1714 | </table> | |
1715 | ||
1716 | @param[in] self_message_iterator | |
1717 | Self message iterator from which to create the event message. | |
1718 | @param[in] event_class | |
1719 | Class of the \bt_ev of the message to create. | |
1720 | @param[in] packet | |
1721 | Packet conceptually containing the event of the message to create. | |
1722 | @param[in] clock_snapshot_value | |
1723 | Value (clock cycles) of the default clock snapshot of | |
1724 | \bt_p{message}. | |
1725 | ||
1726 | @returns | |
1727 | New event message reference, or \c NULL on memory error. | |
1728 | ||
1729 | @bt_pre_not_null{self_message_iterator} | |
1730 | @pre | |
1731 | The \bt_stream_cls of \bt_p{event_class} is also the stream class of | |
1732 | \bt_p{packet}, that is, | |
1733 | <code>bt_event_class_borrow_stream_class_const(event_class)</code> | |
1734 | and | |
1735 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code> | |
1736 | have the same value. | |
1737 | @bt_pre_not_null{packet} | |
1738 | @pre | |
1739 | <code>bt_stream_class_supports_packets(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> | |
1740 | returns #BT_TRUE. | |
1741 | @pre | |
1742 | <code>bt_stream_class_borrow_default_clock_class_const(bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet)))</code> | |
1743 | does \em not return \c NULL. | |
1744 | @pre | |
1745 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
1746 | any, and all its contained \bt_p_field, recursively, are set. | |
1747 | ||
1748 | @bt_post_success_frozen{event_class} | |
1749 | @bt_post_success_frozen{stream} | |
1750 | */ | |
1751 | extern | |
1752 | bt_message *bt_message_event_create_with_packet_and_default_clock_snapshot( | |
1753 | bt_self_message_iterator *self_message_iterator, | |
1754 | const bt_event_class *event_class, | |
1755 | const bt_packet *packet, uint64_t clock_snapshot_value); | |
1756 | ||
1757 | /*! | |
1758 | @brief | |
1759 | Borrows the \bt_ev of the \bt_ev_msg \bt_p{message}. | |
1760 | ||
1761 | See the \ref api-msg-ev-prop-ev "event" property. | |
1762 | ||
1763 | @param[in] message | |
1764 | Event message from which to borrow the event. | |
1765 | ||
1766 | @returns | |
1767 | @parblock | |
1768 | \em Borrowed reference of the event of \bt_p{message}. | |
1769 | ||
1770 | The returned pointer remains valid as long as \bt_p{message} exists. | |
1771 | @endparblock | |
1772 | ||
1773 | @bt_pre_not_null{message} | |
1774 | @bt_pre_is_ev_msg{message} | |
1775 | ||
1776 | @sa bt_message_event_borrow_event_const() — | |
1777 | \c const version of this function. | |
1778 | */ | |
1779 | extern bt_event *bt_message_event_borrow_event( | |
1780 | bt_message *message); | |
1781 | ||
1782 | /*! | |
1783 | @brief | |
1784 | Borrows the \bt_ev of the \bt_ev_msg \bt_p{message} | |
1785 | (\c const version). | |
1786 | ||
1787 | See bt_message_event_borrow_event(). | |
1788 | */ | |
1789 | extern const bt_event *bt_message_event_borrow_event_const( | |
1790 | const bt_message *message); | |
1791 | ||
1792 | /*! | |
1793 | @brief | |
1794 | Borrows the default \bt_cs of the \bt_ev_msg \bt_p{message}. | |
1795 | ||
1796 | See the \ref api-msg-ev-prop-cs "default clock snapshot" property. | |
1797 | ||
1798 | @param[in] message | |
1799 | Event message from which to borrow the default clock snapshot. | |
1800 | ||
1801 | @returns | |
1802 | Default clock snapshot of \bt_p{message}. | |
1803 | ||
1804 | @bt_pre_not_null{message} | |
1805 | @bt_pre_is_ev_msg{message} | |
1806 | @pre | |
1807 | The \bt_stream_cls of \bt_p{message} has a | |
1808 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class". | |
1809 | */ | |
1810 | extern const bt_clock_snapshot * | |
1811 | bt_message_event_borrow_default_clock_snapshot_const(const bt_message *message); | |
1812 | ||
1813 | /*! | |
1814 | @brief | |
1815 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
1816 | of the \bt_ev_msg \bt_p{message}. | |
1817 | ||
1818 | See the stream class's | |
1819 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
1820 | property. | |
1821 | ||
1822 | This is a helper which is equivalent to | |
1823 | ||
1824 | @code | |
1825 | bt_stream_class_borrow_default_clock_class_const( | |
1826 | bt_stream_borrow_class_const( | |
1827 | bt_event_borrow_stream_const( | |
1828 | bt_message_event_borrow_event_const(message)))) | |
1829 | @endcode | |
1830 | ||
1831 | @param[in] message | |
1832 | Event message from which to borrow its stream's class's | |
1833 | default clock class. | |
1834 | ||
1835 | @returns | |
1836 | \em Borrowed reference of the default clock class of | |
1837 | the stream class of \bt_p{message}, or \c NULL if none. | |
1838 | ||
1839 | @bt_pre_not_null{message} | |
1840 | @bt_pre_is_ev_msg{message} | |
1841 | */ | |
1842 | extern const bt_clock_class * | |
1843 | bt_message_event_borrow_stream_class_default_clock_class_const( | |
1844 | const bt_message *message); | |
1845 | ||
1846 | /*! @} */ | |
1847 | ||
1848 | /*! | |
1849 | @name Packet beginning message | |
1850 | @{ | |
1851 | */ | |
1852 | ||
1853 | /*! | |
1854 | @brief | |
1855 | Creates a \bt_pb_msg for the \bt_pkt \bt_p{packet} from the | |
1856 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1857 | ||
1858 | @attention | |
1859 | @parblock | |
1860 | Only use this function if | |
1861 | ||
1862 | @code | |
1863 | bt_stream_class_packets_have_beginning_default_clock_snapshot( | |
1864 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1865 | @endcode | |
1866 | ||
1867 | returns #BT_FALSE. | |
1868 | ||
1869 | Otherwise, use | |
1870 | bt_message_packet_beginning_create_with_default_clock_snapshot(). | |
1871 | @endparblock | |
1872 | ||
1873 | On success, the returned packet beginning message has the following | |
1874 | property values: | |
1875 | ||
1876 | <table> | |
1877 | <tr> | |
1878 | <th>Property | |
1879 | <th>Value | |
1880 | <tr> | |
1881 | <td>\ref api-msg-pb-prop-pkt "Packet" | |
1882 | <td>\bt_p{packet} | |
1883 | <tr> | |
1884 | <td>\ref api-msg-pb-prop-cs "Default clock snapshot" | |
1885 | <td>\em None | |
1886 | </table> | |
1887 | ||
1888 | @param[in] self_message_iterator | |
1889 | Self message iterator from which to create the packet beginning | |
1890 | message. | |
1891 | @param[in] packet | |
1892 | Packet of which the message to create indicates the beginning. | |
1893 | ||
1894 | @returns | |
1895 | New packet beginning message reference, or \c NULL on memory error. | |
1896 | ||
1897 | @bt_pre_not_null{self_message_iterator} | |
1898 | @bt_pre_not_null{packet} | |
1899 | @pre | |
1900 | bt_stream_class_packets_have_beginning_default_clock_snapshot() | |
1901 | returns #BT_FALSE for | |
1902 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. | |
1903 | @pre | |
1904 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
1905 | any, and all its contained \bt_p_field, recursively, are set. | |
1906 | ||
1907 | @bt_post_success_frozen{packet} | |
1908 | */ | |
1909 | extern | |
1910 | bt_message *bt_message_packet_beginning_create( | |
1911 | bt_self_message_iterator *self_message_iterator, | |
1912 | const bt_packet *packet); | |
1913 | ||
1914 | /*! | |
1915 | @brief | |
1916 | Creates a \bt_pb_msg having a default \bt_cs with the value | |
1917 | \bt_p{clock_snapshot_value} for the \bt_pkt \bt_p{packet} from the | |
1918 | \bt_msg_iter \bt_p{self_message_iterator}. | |
1919 | ||
1920 | @attention | |
1921 | @parblock | |
1922 | Only use this function if | |
1923 | ||
1924 | @code | |
1925 | bt_stream_class_packets_have_beginning_default_clock_snapshot( | |
1926 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
1927 | @endcode | |
1928 | ||
1929 | returns #BT_TRUE. | |
1930 | ||
1931 | Otherwise, use | |
1932 | bt_message_packet_beginning_create(). | |
1933 | @endparblock | |
1934 | ||
1935 | On success, the returned packet beginning message has the following | |
1936 | property values: | |
1937 | ||
1938 | <table> | |
1939 | <tr> | |
1940 | <th>Property | |
1941 | <th>Value | |
1942 | <tr> | |
1943 | <td>\ref api-msg-pb-prop-pkt "Packet" | |
1944 | <td>\bt_p{packet} | |
1945 | <tr> | |
1946 | <td>\ref api-msg-pb-prop-cs "Default clock snapshot" | |
1947 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. | |
1948 | </table> | |
1949 | ||
1950 | @param[in] self_message_iterator | |
1951 | Self message iterator from which to create the packet beginning | |
1952 | message. | |
1953 | @param[in] packet | |
1954 | Packet of which the message to create indicates the beginning. | |
1955 | @param[in] clock_snapshot_value | |
1956 | Value (clock cycles) of the default clock snapshot of | |
1957 | \bt_p{message}. | |
1958 | ||
1959 | @returns | |
1960 | New packet beginning message reference, or \c NULL on memory error. | |
1961 | ||
1962 | @bt_pre_not_null{self_message_iterator} | |
1963 | @bt_pre_not_null{packet} | |
1964 | @pre | |
1965 | bt_stream_class_packets_have_beginning_default_clock_snapshot() | |
1966 | returns #BT_TRUE for | |
1967 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. | |
1968 | @pre | |
1969 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
1970 | any, and all its contained \bt_p_field, recursively, are set. | |
1971 | ||
1972 | @bt_post_success_frozen{packet} | |
1973 | */ | |
1974 | extern | |
1975 | bt_message *bt_message_packet_beginning_create_with_default_clock_snapshot( | |
1976 | bt_self_message_iterator *self_message_iterator, | |
1977 | const bt_packet *packet, uint64_t clock_snapshot_value); | |
1978 | ||
1979 | /*! | |
1980 | @brief | |
1981 | Borrows the \bt_pkt of the \bt_pb_msg \bt_p{message}. | |
1982 | ||
1983 | See the \ref api-msg-pb-prop-pkt "packet" property. | |
1984 | ||
1985 | @param[in] message | |
1986 | Packet beginning message from which to borrow the packet. | |
1987 | ||
1988 | @returns | |
1989 | @parblock | |
1990 | \em Borrowed reference of the packet of \bt_p{message}. | |
1991 | ||
1992 | The returned pointer remains valid as long as \bt_p{message} exists. | |
1993 | @endparblock | |
1994 | ||
1995 | @bt_pre_not_null{message} | |
1996 | @bt_pre_is_pb_msg{message} | |
1997 | ||
1998 | @sa bt_message_packet_beginning_borrow_packet_const() — | |
1999 | \c const version of this function. | |
2000 | */ | |
2001 | extern bt_packet *bt_message_packet_beginning_borrow_packet( | |
2002 | bt_message *message); | |
2003 | ||
2004 | /*! | |
2005 | @brief | |
2006 | Borrows the \bt_pkt of the \bt_pb_msg \bt_p{message} | |
2007 | (\c const version). | |
2008 | ||
2009 | See bt_message_packet_beginning_borrow_packet(). | |
2010 | */ | |
2011 | extern const bt_packet *bt_message_packet_beginning_borrow_packet_const( | |
2012 | const bt_message *message); | |
2013 | ||
2014 | /*! | |
2015 | @brief | |
2016 | Borrows the default \bt_cs of the \bt_pb_msg \bt_p{message}. | |
2017 | ||
2018 | See the \ref api-msg-pb-prop-cs "default clock snapshot" property. | |
2019 | ||
2020 | @param[in] message | |
2021 | Packet beginning message from which to borrow the default clock | |
2022 | snapshot. | |
2023 | ||
2024 | @returns | |
2025 | Default clock snapshot of \bt_p{message}. | |
2026 | ||
2027 | @bt_pre_not_null{message} | |
2028 | @bt_pre_is_pb_msg{message} | |
2029 | @pre | |
2030 | The packets of the \bt_stream_cls of \bt_p{message} | |
2031 | \ref api-tir-stream-cls-prop-pkt-beg-cs "have a beginning default clock snapshot". | |
2032 | */ | |
2033 | extern const bt_clock_snapshot * | |
2034 | bt_message_packet_beginning_borrow_default_clock_snapshot_const( | |
2035 | const bt_message *message); | |
2036 | ||
2037 | /*! | |
2038 | @brief | |
2039 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
2040 | of the \bt_pb_msg \bt_p{message}. | |
2041 | ||
2042 | See the stream class's | |
2043 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
2044 | property. | |
2045 | ||
2046 | This is a helper which is equivalent to | |
2047 | ||
2048 | @code | |
2049 | bt_stream_class_borrow_default_clock_class_const( | |
2050 | bt_stream_borrow_class_const( | |
2051 | bt_packet_borrow_stream_const( | |
2052 | bt_message_packet_beginning_borrow_packet_const(message)))) | |
2053 | @endcode | |
2054 | ||
2055 | @param[in] message | |
2056 | Packet beginning message from which to borrow its stream's class's | |
2057 | default clock class. | |
2058 | ||
2059 | @returns | |
2060 | \em Borrowed reference of the default clock class of | |
2061 | the stream class of \bt_p{message}, or \c NULL if none. | |
2062 | ||
2063 | @bt_pre_not_null{message} | |
2064 | @bt_pre_is_pb_msg{message} | |
2065 | */ | |
2066 | extern const bt_clock_class * | |
2067 | bt_message_packet_beginning_borrow_stream_class_default_clock_class_const( | |
2068 | const bt_message *message); | |
2069 | ||
2070 | /*! @} */ | |
2071 | ||
2072 | /*! | |
2073 | @name Packet end message | |
2074 | @{ | |
2075 | */ | |
2076 | ||
2077 | /*! | |
2078 | @brief | |
2079 | Creates a \bt_pe_msg for the \bt_pkt \bt_p{packet} from the | |
2080 | \bt_msg_iter \bt_p{self_message_iterator}. | |
2081 | ||
2082 | @attention | |
2083 | @parblock | |
2084 | Only use this function if | |
2085 | ||
2086 | @code | |
2087 | bt_stream_class_packets_have_end_default_clock_snapshot( | |
2088 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
2089 | @endcode | |
2090 | ||
2091 | returns #BT_FALSE. | |
2092 | ||
2093 | Otherwise, use | |
2094 | bt_message_packet_end_create_with_default_clock_snapshot(). | |
2095 | @endparblock | |
2096 | ||
2097 | On success, the returned packet end message has the following | |
2098 | property values: | |
2099 | ||
2100 | <table> | |
2101 | <tr> | |
2102 | <th>Property | |
2103 | <th>Value | |
2104 | <tr> | |
2105 | <td>\ref api-msg-pe-prop-pkt "Packet" | |
2106 | <td>\bt_p{packet} | |
2107 | <tr> | |
2108 | <td>\ref api-msg-pe-prop-cs "Default clock snapshot" | |
2109 | <td>\em None | |
2110 | </table> | |
2111 | ||
2112 | @param[in] self_message_iterator | |
2113 | Self message iterator from which to create the packet end message. | |
2114 | @param[in] packet | |
2115 | Packet of which the message to create indicates the end. | |
2116 | ||
2117 | @returns | |
2118 | New packet end message reference, or \c NULL on memory error. | |
2119 | ||
2120 | @bt_pre_not_null{self_message_iterator} | |
2121 | @bt_pre_not_null{packet} | |
2122 | @pre | |
2123 | bt_stream_class_packets_have_end_default_clock_snapshot() | |
2124 | returns #BT_FALSE for | |
2125 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. | |
2126 | @pre | |
2127 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
2128 | any, and all its contained \bt_p_field, recursively, are set. | |
2129 | ||
2130 | @bt_post_success_frozen{packet} | |
2131 | */ | |
2132 | extern | |
2133 | bt_message *bt_message_packet_end_create( | |
2134 | bt_self_message_iterator *self_message_iterator, | |
2135 | const bt_packet *packet); | |
2136 | ||
2137 | /*! | |
2138 | @brief | |
2139 | Creates a \bt_pe_msg having a default \bt_cs with the value | |
2140 | \bt_p{clock_snapshot_value} for the \bt_pkt \bt_p{packet} from the | |
2141 | \bt_msg_iter \bt_p{self_message_iterator}. | |
2142 | ||
2143 | @attention | |
2144 | @parblock | |
2145 | Only use this function if | |
2146 | ||
2147 | @code | |
2148 | bt_stream_class_packets_have_end_default_clock_snapshot( | |
2149 | bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))) | |
2150 | @endcode | |
2151 | ||
2152 | returns #BT_TRUE. | |
2153 | ||
2154 | Otherwise, use | |
2155 | bt_message_packet_end_create(). | |
2156 | @endparblock | |
2157 | ||
2158 | On success, the returned packet end message has the following | |
2159 | property values: | |
2160 | ||
2161 | <table> | |
2162 | <tr> | |
2163 | <th>Property | |
2164 | <th>Value | |
2165 | <tr> | |
2166 | <td>\ref api-msg-pe-prop-pkt "Packet" | |
2167 | <td>\bt_p{packet} | |
2168 | <tr> | |
2169 | <td>\ref api-msg-pe-prop-cs "Default clock snapshot" | |
2170 | <td>\bt_c_cs with the value \bt_p{clock_snapshot_value}. | |
2171 | </table> | |
2172 | ||
2173 | @param[in] self_message_iterator | |
2174 | Self message iterator from which to create the packet end | |
2175 | message. | |
2176 | @param[in] packet | |
2177 | Packet of which the message to create indicates the end. | |
2178 | @param[in] clock_snapshot_value | |
2179 | Value (clock cycles) of the default clock snapshot of | |
2180 | \bt_p{message}. | |
2181 | ||
2182 | @returns | |
2183 | New packet end message reference, or \c NULL on memory error. | |
2184 | ||
2185 | @bt_pre_not_null{self_message_iterator} | |
2186 | @bt_pre_not_null{packet} | |
2187 | @pre | |
2188 | bt_stream_class_packets_have_end_default_clock_snapshot() | |
2189 | returns #BT_TRUE for | |
2190 | <code>bt_stream_borrow_class_const(bt_packet_borrow_stream_const(packet))</code>. | |
2191 | @pre | |
2192 | The \ref api-tir-pkt-prop-ctx "context field" of \bt_p{packet}, if | |
2193 | any, and all its contained \bt_p_field, recursively, are set. | |
2194 | ||
2195 | @bt_post_success_frozen{packet} | |
2196 | */ | |
2197 | extern | |
2198 | bt_message *bt_message_packet_end_create_with_default_clock_snapshot( | |
2199 | bt_self_message_iterator *self_message_iterator, | |
2200 | const bt_packet *packet, uint64_t clock_snapshot_value); | |
2201 | ||
2202 | /*! | |
2203 | @brief | |
2204 | Borrows the \bt_pkt of the \bt_pe_msg \bt_p{message}. | |
2205 | ||
2206 | See the \ref api-msg-pe-prop-pkt "packet" property. | |
2207 | ||
2208 | @param[in] message | |
2209 | Packet end message from which to borrow the packet. | |
2210 | ||
2211 | @returns | |
2212 | @parblock | |
2213 | \em Borrowed reference of the packet of \bt_p{message}. | |
2214 | ||
2215 | The returned pointer remains valid as long as \bt_p{message} exists. | |
2216 | @endparblock | |
2217 | ||
2218 | @bt_pre_not_null{message} | |
2219 | @bt_pre_is_pe_msg{message} | |
2220 | ||
2221 | @sa bt_message_packet_end_borrow_packet_const() — | |
2222 | \c const version of this function. | |
2223 | */ | |
2224 | extern bt_packet *bt_message_packet_end_borrow_packet( | |
2225 | bt_message *message); | |
2226 | ||
2227 | /*! | |
2228 | @brief | |
2229 | Borrows the \bt_pkt of the \bt_pe_msg \bt_p{message} | |
2230 | (\c const version). | |
2231 | ||
2232 | See bt_message_packet_end_borrow_packet(). | |
2233 | */ | |
2234 | extern const bt_packet *bt_message_packet_end_borrow_packet_const( | |
2235 | const bt_message *message); | |
2236 | ||
2237 | /*! | |
2238 | @brief | |
2239 | Borrows the default \bt_cs of the \bt_pe_msg \bt_p{message}. | |
2240 | ||
2241 | See the \ref api-msg-pe-prop-cs "default clock snapshot" property. | |
2242 | ||
2243 | @param[in] message | |
2244 | Packet end message from which to borrow the default clock | |
2245 | snapshot. | |
2246 | ||
2247 | @returns | |
2248 | Default clock snapshot of \bt_p{message}. | |
2249 | ||
2250 | @bt_pre_not_null{message} | |
2251 | @bt_pre_is_pe_msg{message} | |
2252 | @pre | |
2253 | The packets of the \bt_stream_cls of \bt_p{message} | |
2254 | \ref api-tir-stream-cls-prop-pkt-end-cs "have an end default clock snapshot". | |
2255 | */ | |
2256 | extern const bt_clock_snapshot * | |
2257 | bt_message_packet_end_borrow_default_clock_snapshot_const( | |
2258 | const bt_message *message); | |
2259 | ||
2260 | /*! | |
2261 | @brief | |
2262 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
2263 | of the \bt_pe_msg \bt_p{message}. | |
2264 | ||
2265 | See the stream class's | |
2266 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
2267 | property. | |
2268 | ||
2269 | This is a helper which is equivalent to | |
2270 | ||
2271 | @code | |
2272 | bt_stream_class_borrow_default_clock_class_const( | |
2273 | bt_stream_borrow_class_const( | |
2274 | bt_packet_borrow_stream_const( | |
2275 | bt_message_packet_end_borrow_packet_const(message)))) | |
2276 | @endcode | |
2277 | ||
2278 | @param[in] message | |
2279 | Packet end message from which to borrow its stream's class's | |
2280 | default clock class. | |
2281 | ||
2282 | @returns | |
2283 | \em Borrowed reference of the default clock class of | |
2284 | the stream class of \bt_p{message}, or \c NULL if none. | |
2285 | ||
2286 | @bt_pre_not_null{message} | |
2287 | @bt_pre_is_pe_msg{message} | |
2288 | */ | |
2289 | extern const bt_clock_class * | |
2290 | bt_message_packet_end_borrow_stream_class_default_clock_class_const( | |
2291 | const bt_message *message); | |
2292 | ||
2293 | /*! @} */ | |
2294 | ||
2295 | /*! | |
2296 | @name Discarded events message | |
2297 | @{ | |
2298 | */ | |
2299 | ||
2300 | /*! | |
2301 | @brief | |
2302 | Creates a \bt_disc_ev_msg for the \bt_stream \bt_p{stream} from the | |
2303 | \bt_msg_iter \bt_p{self_message_iterator}. | |
2304 | ||
2305 | @attention | |
2306 | @parblock | |
2307 | Only use this function if | |
2308 | ||
2309 | @code | |
2310 | bt_stream_class_discarded_events_have_default_clock_snapshots( | |
2311 | bt_stream_borrow_class_const(stream)) | |
2312 | @endcode | |
2313 | ||
2314 | returns #BT_FALSE. | |
2315 | ||
2316 | Otherwise, use | |
2317 | bt_message_discarded_events_create_with_default_clock_snapshots(). | |
2318 | @endparblock | |
2319 | ||
2320 | On success, the returned discarded events message has the following | |
2321 | property values: | |
2322 | ||
2323 | <table> | |
2324 | <tr> | |
2325 | <th>Property | |
2326 | <th>Value | |
2327 | <tr> | |
2328 | <td>\ref api-msg-disc-ev-prop-stream "Stream" | |
2329 | <td>\bt_p{stream} | |
2330 | <tr> | |
2331 | <td>\ref api-msg-disc-ev-prop-cs-beg "Beginning default clock snapshot" | |
2332 | <td>\em None | |
2333 | <tr> | |
2334 | <td>\ref api-msg-disc-ev-prop-cs-end "End default clock snapshot" | |
2335 | <td>\em None | |
2336 | <tr> | |
2337 | <td>\ref api-msg-disc-ev-prop-count "Discarded event count" | |
2338 | <td>\em None | |
2339 | </table> | |
2340 | ||
2341 | @param[in] self_message_iterator | |
2342 | Self message iterator from which to create the discarded events | |
2343 | message. | |
2344 | @param[in] stream | |
2345 | Stream from which the events were discarded. | |
2346 | ||
2347 | @returns | |
2348 | New discarded events message reference, or \c NULL on memory error. | |
2349 | ||
2350 | @bt_pre_not_null{self_message_iterator} | |
2351 | @bt_pre_not_null{stream} | |
2352 | @pre | |
2353 | <code>bt_stream_class_discarded_events_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> | |
2354 | returns #BT_FALSE. | |
2355 | ||
2356 | @bt_post_success_frozen{stream} | |
2357 | */ | |
2358 | extern bt_message *bt_message_discarded_events_create( | |
2359 | bt_self_message_iterator *self_message_iterator, | |
2360 | const bt_stream *stream); | |
2361 | ||
2362 | /*! | |
2363 | @brief | |
2364 | Creates a \bt_disc_ev_msg having the beginning and end default | |
2365 | \bt_p_cs with the values \bt_p{beginning_clock_snapshot_value} and | |
2366 | \bt_p{end_clock_snapshot_value} for the \bt_stream \bt_p{stream} | |
2367 | from the \bt_msg_iter \bt_p{self_message_iterator}. | |
2368 | ||
2369 | @attention | |
2370 | @parblock | |
2371 | Only use this function if | |
2372 | ||
2373 | @code | |
2374 | bt_stream_class_discarded_events_have_default_clock_snapshots( | |
2375 | bt_stream_borrow_class_const(stream)) | |
2376 | @endcode | |
2377 | ||
2378 | returns #BT_TRUE. | |
2379 | ||
2380 | Otherwise, use | |
2381 | bt_message_discarded_events_create(). | |
2382 | @endparblock | |
2383 | ||
2384 | On success, the returned discarded events message has the following | |
2385 | property values: | |
2386 | ||
2387 | <table> | |
2388 | <tr> | |
2389 | <th>Property | |
2390 | <th>Value | |
2391 | <tr> | |
2392 | <td>\ref api-msg-disc-ev-prop-stream "Stream" | |
2393 | <td>\bt_p{stream} | |
2394 | <tr> | |
2395 | <td>\ref api-msg-disc-ev-prop-cs-beg "Beginning default clock snapshot" | |
2396 | <td>\bt_c_cs with the value \bt_p{beginning_clock_snapshot_value}. | |
2397 | <tr> | |
2398 | <td>\ref api-msg-disc-ev-prop-cs-end "End default clock snapshot" | |
2399 | <td>\bt_c_cs with the value \bt_p{end_clock_snapshot_value}. | |
2400 | <tr> | |
2401 | <td>\ref api-msg-disc-ev-prop-count "Discarded event count" | |
2402 | <td>\em None | |
2403 | </table> | |
2404 | ||
2405 | @param[in] self_message_iterator | |
2406 | Self message iterator from which to create the discarded events | |
2407 | message. | |
2408 | @param[in] stream | |
2409 | Stream from which the events were discarded. | |
2410 | @param[in] beginning_clock_snapshot_value | |
2411 | Value (clock cycles) of the beginning default clock snapshot of | |
2412 | \bt_p{message}. | |
2413 | @param[in] end_clock_snapshot_value | |
2414 | Value (clock cycles) of the end default clock snapshot of | |
2415 | \bt_p{message}. | |
2416 | ||
2417 | @returns | |
2418 | New discarded events message reference, or \c NULL on memory error. | |
2419 | ||
2420 | @bt_pre_not_null{self_message_iterator} | |
2421 | @bt_pre_not_null{stream} | |
2422 | @pre | |
2423 | <code>bt_stream_class_discarded_events_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> | |
2424 | returns #BT_TRUE. | |
5d9ef4cb | 2425 | \bt_p{beginning_clock_snapshot_value} ⩽ \bt_p{end_clock_snapshot_value} |
43c59509 PP |
2426 | |
2427 | @bt_post_success_frozen{stream} | |
2428 | */ | |
2429 | extern bt_message *bt_message_discarded_events_create_with_default_clock_snapshots( | |
2430 | bt_self_message_iterator *self_message_iterator, | |
2431 | const bt_stream *stream, | |
2432 | uint64_t beginning_clock_snapshot_value, | |
2433 | uint64_t end_clock_snapshot_value); | |
2434 | ||
2435 | /*! | |
2436 | @brief | |
2437 | Borrows the \bt_stream of the \bt_disc_ev_msg \bt_p{message}. | |
2438 | ||
2439 | See the \ref api-msg-disc-ev-prop-stream "stream" property. | |
2440 | ||
2441 | @param[in] message | |
2442 | Discarded events message from which to borrow the stream. | |
2443 | ||
2444 | @returns | |
2445 | @parblock | |
2446 | \em Borrowed reference of the stream of \bt_p{message}. | |
2447 | ||
2448 | The returned pointer remains valid as long as \bt_p{message} exists. | |
2449 | @endparblock | |
2450 | ||
2451 | @bt_pre_not_null{message} | |
2452 | @bt_pre_is_disc_ev_msg{message} | |
2453 | ||
2454 | @sa bt_message_discarded_events_borrow_stream_const() — | |
2455 | \c const version of this function. | |
2456 | */ | |
2457 | extern bt_stream *bt_message_discarded_events_borrow_stream( | |
2458 | bt_message *message); | |
2459 | ||
2460 | /*! | |
2461 | @brief | |
2462 | Borrows the \bt_stream of the \bt_disc_ev_msg \bt_p{message} | |
2463 | (\c const version). | |
2464 | ||
2465 | See bt_message_discarded_events_borrow_stream(). | |
2466 | */ | |
2467 | extern const bt_stream * | |
2468 | bt_message_discarded_events_borrow_stream_const(const bt_message *message); | |
2469 | ||
2470 | /*! | |
2471 | @brief | |
2472 | Borrows the beginning default \bt_cs of the \bt_disc_ev_msg | |
2473 | \bt_p{message}. | |
2474 | ||
2475 | See the | |
2476 | \ref api-msg-disc-ev-prop-cs-beg "beginning default clock snapshot" | |
2477 | property. | |
2478 | ||
2479 | @param[in] message | |
2480 | Discarded events message from which to borrow the beginning default | |
2481 | clock snapshot. | |
2482 | ||
2483 | @returns | |
2484 | Beginning default clock snapshot of \bt_p{message}. | |
2485 | ||
2486 | @bt_pre_not_null{message} | |
2487 | @bt_pre_is_disc_ev_msg{message} | |
2488 | @pre | |
2489 | The discarded packets messages of the \bt_stream_cls of | |
2490 | \bt_p{message} | |
2491 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". | |
2492 | */ | |
2493 | extern const bt_clock_snapshot * | |
2494 | bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const( | |
2495 | const bt_message *message); | |
2496 | ||
2497 | /*! | |
2498 | @brief | |
2499 | Borrows the end default \bt_cs of the \bt_disc_ev_msg | |
2500 | \bt_p{message}. | |
2501 | ||
2502 | See the | |
2503 | \ref api-msg-disc-ev-prop-cs-end "end default clock snapshot" | |
2504 | property. | |
2505 | ||
2506 | @param[in] message | |
2507 | Discarded events message from which to borrow the end default clock | |
2508 | snapshot. | |
2509 | ||
2510 | @returns | |
2511 | End default clock snapshot of \bt_p{message}. | |
2512 | ||
2513 | @bt_pre_not_null{message} | |
2514 | @bt_pre_is_disc_ev_msg{message} | |
2515 | @pre | |
2516 | The discarded packets messages of the \bt_stream_cls of | |
2517 | \bt_p{message} | |
2518 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". | |
2519 | */ | |
2520 | extern const bt_clock_snapshot * | |
2521 | bt_message_discarded_events_borrow_end_default_clock_snapshot_const( | |
2522 | const bt_message *message); | |
2523 | ||
2524 | /*! | |
2525 | @brief | |
2526 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
2527 | of the \bt_disc_ev_msg \bt_p{message}. | |
2528 | ||
2529 | See the stream class's | |
2530 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
2531 | property. | |
2532 | ||
2533 | This is a helper which is equivalent to | |
2534 | ||
2535 | @code | |
2536 | bt_stream_class_borrow_default_clock_class_const( | |
2537 | bt_stream_borrow_class_const( | |
2538 | bt_message_discarded_events_borrow_stream_const(message))) | |
2539 | @endcode | |
2540 | ||
2541 | @param[in] message | |
2542 | Discarded events message from which to borrow its stream's class's | |
2543 | default clock class. | |
2544 | ||
2545 | @returns | |
2546 | \em Borrowed reference of the default clock class of | |
2547 | the stream class of \bt_p{message}, or \c NULL if none. | |
2548 | ||
2549 | @bt_pre_not_null{message} | |
2550 | @bt_pre_is_disc_ev_msg{message} | |
2551 | */ | |
2552 | extern const bt_clock_class * | |
2553 | bt_message_discarded_events_borrow_stream_class_default_clock_class_const( | |
2554 | const bt_message *message); | |
2555 | ||
2556 | /*! | |
2557 | @brief | |
2558 | Sets the number of discarded events of the \bt_disc_ev_msg | |
2559 | \bt_p{message} to \bt_p{count}. | |
2560 | ||
2561 | See the \ref api-msg-disc-ev-prop-count "discarded event count" | |
2562 | property. | |
2563 | ||
2564 | @param[in] message | |
2565 | Discarded events message of which to set the number of discarded | |
2566 | events to \bt_p{count}. | |
2567 | @param[in] count | |
2568 | New number of discarded events of \bt_p{message}. | |
2569 | ||
2570 | @bt_pre_not_null{message} | |
2571 | @bt_pre_hot{message} | |
2572 | @bt_pre_is_disc_ev_msg{message} | |
e5a41ca3 SM |
2573 | @pre |
2574 | \bt_p{count} > 0 | |
43c59509 PP |
2575 | |
2576 | @sa bt_message_discarded_events_get_count() — | |
2577 | Returns the number of discarded events of a discarded events | |
2578 | message. | |
2579 | */ | |
2580 | extern void bt_message_discarded_events_set_count(bt_message *message, | |
2581 | uint64_t count); | |
2582 | ||
2583 | /*! | |
2584 | @brief | |
2585 | Returns the number of discarded events of the \bt_disc_ev_msg | |
2586 | \bt_p{message}. | |
2587 | ||
2588 | See the \ref api-msg-disc-ev-prop-count "discarded event count" | |
2589 | property. | |
2590 | ||
2591 | @param[in] message | |
2592 | Discarded events message of which to get the number of discarded | |
2593 | events. | |
2594 | @param[out] count | |
2595 | <strong>If this function returns | |
2596 | #BT_PROPERTY_AVAILABILITY_AVAILABLE</strong>, \bt_p{*count} is | |
2597 | the number of discarded events of \bt_p{message}. | |
2598 | ||
2599 | @retval #BT_PROPERTY_AVAILABILITY_AVAILABLE | |
2600 | The number of discarded events of \bt_p{message} is available. | |
2601 | @retval #BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE | |
2602 | The number of discarded events of \bt_p{message} is not available. | |
2603 | ||
2604 | @bt_pre_not_null{message} | |
2605 | @bt_pre_is_disc_ev_msg{message} | |
2606 | @bt_pre_not_null{count} | |
2607 | ||
2608 | @sa bt_message_discarded_events_set_count() — | |
2609 | Sets the number of discarded events of a discarded events message. | |
2610 | */ | |
2611 | extern bt_property_availability bt_message_discarded_events_get_count( | |
2612 | const bt_message *message, uint64_t *count); | |
2613 | ||
2614 | /*! @} */ | |
2615 | ||
2616 | /*! | |
2617 | @name Discarded packets message | |
2618 | @{ | |
2619 | */ | |
2620 | ||
2621 | /*! | |
2622 | @brief | |
2623 | Creates a \bt_disc_pkt_msg for the \bt_stream \bt_p{stream} from the | |
2624 | \bt_msg_iter \bt_p{self_message_iterator}. | |
2625 | ||
2626 | @attention | |
2627 | @parblock | |
2628 | Only use this function if | |
2629 | ||
2630 | @code | |
2631 | bt_stream_class_discarded_packets_have_default_clock_snapshots( | |
2632 | bt_stream_borrow_class_const(stream)) | |
2633 | @endcode | |
2634 | ||
2635 | returns #BT_FALSE. | |
2636 | ||
2637 | Otherwise, use | |
2638 | bt_message_discarded_packets_create_with_default_clock_snapshots(). | |
2639 | @endparblock | |
2640 | ||
2641 | On success, the returned discarded packets message has the following | |
2642 | property values: | |
2643 | ||
2644 | <table> | |
2645 | <tr> | |
2646 | <th>Property | |
2647 | <th>Value | |
2648 | <tr> | |
2649 | <td>\ref api-msg-disc-pkt-prop-stream "Stream" | |
2650 | <td>\bt_p{stream} | |
2651 | <tr> | |
2652 | <td>\ref api-msg-disc-pkt-prop-cs-beg "Beginning default clock snapshot" | |
2653 | <td>\em None | |
2654 | <tr> | |
2655 | <td>\ref api-msg-disc-pkt-prop-cs-end "End default clock snapshot" | |
2656 | <td>\em None | |
2657 | <tr> | |
2658 | <td>\ref api-msg-disc-pkt-prop-count "Discarded packet count" | |
2659 | <td>\em None | |
2660 | </table> | |
2661 | ||
2662 | @param[in] self_message_iterator | |
2663 | Self message iterator from which to create the discarded packets | |
2664 | message. | |
2665 | @param[in] stream | |
2666 | Stream from which the packets were discarded. | |
2667 | ||
2668 | @returns | |
2669 | New discarded packets message reference, or \c NULL on memory error. | |
2670 | ||
2671 | @bt_pre_not_null{self_message_iterator} | |
2672 | @bt_pre_not_null{stream} | |
2673 | @pre | |
2674 | <code>bt_stream_class_discarded_packets_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> | |
2675 | returns #BT_FALSE. | |
2676 | ||
2677 | @bt_post_success_frozen{stream} | |
2678 | */ | |
2679 | extern bt_message *bt_message_discarded_packets_create( | |
2680 | bt_self_message_iterator *self_message_iterator, | |
2681 | const bt_stream *stream); | |
2682 | ||
2683 | /*! | |
2684 | @brief | |
2685 | Creates a \bt_disc_pkt_msg having the beginning and end default | |
2686 | \bt_p_cs with the values \bt_p{beginning_clock_snapshot_value} and | |
2687 | \bt_p{end_clock_snapshot_value} for the \bt_stream \bt_p{stream} | |
2688 | from the \bt_msg_iter \bt_p{self_message_iterator}. | |
2689 | ||
2690 | @attention | |
2691 | @parblock | |
2692 | Only use this function if | |
2693 | ||
2694 | @code | |
2695 | bt_stream_class_discarded_packets_have_default_clock_snapshots( | |
2696 | bt_stream_borrow_class_const(stream)) | |
2697 | @endcode | |
2698 | ||
2699 | returns #BT_TRUE. | |
2700 | ||
2701 | Otherwise, use | |
2702 | bt_message_discarded_packets_create(). | |
2703 | @endparblock | |
2704 | ||
2705 | On success, the returned discarded packets message has the following | |
2706 | property values: | |
2707 | ||
2708 | <table> | |
2709 | <tr> | |
2710 | <th>Property | |
2711 | <th>Value | |
2712 | <tr> | |
2713 | <td>\ref api-msg-disc-pkt-prop-stream "Stream" | |
2714 | <td>\bt_p{stream} | |
2715 | <tr> | |
2716 | <td>\ref api-msg-disc-pkt-prop-cs-beg "Beginning default clock snapshot" | |
2717 | <td>\bt_c_cs with the value \bt_p{beginning_clock_snapshot_value}. | |
2718 | <tr> | |
2719 | <td>\ref api-msg-disc-pkt-prop-cs-end "End default clock snapshot" | |
2720 | <td>\bt_c_cs with the value \bt_p{end_clock_snapshot_value}. | |
2721 | <tr> | |
2722 | <td>\ref api-msg-disc-pkt-prop-count "Discarded packet count" | |
2723 | <td>\em None | |
2724 | </table> | |
2725 | ||
2726 | @param[in] self_message_iterator | |
2727 | Self message iterator from which to create the discarded packets | |
2728 | message. | |
2729 | @param[in] stream | |
2730 | Stream from which the packets were discarded. | |
2731 | @param[in] beginning_clock_snapshot_value | |
2732 | Value (clock cycles) of the beginning default clock snapshot of | |
2733 | \bt_p{message}. | |
2734 | @param[in] end_clock_snapshot_value | |
2735 | Value (clock cycles) of the end default clock snapshot of | |
2736 | \bt_p{message}. | |
2737 | ||
2738 | @returns | |
2739 | New discarded packets message reference, or \c NULL on memory error. | |
2740 | ||
2741 | @bt_pre_not_null{self_message_iterator} | |
2742 | @bt_pre_not_null{stream} | |
2743 | @pre | |
2744 | <code>bt_stream_class_discarded_packets_have_default_clock_snapshots(bt_stream_borrow_class_const(stream))</code> | |
2745 | returns #BT_TRUE. | |
5d9ef4cb | 2746 | \bt_p{beginning_clock_snapshot_value} ⩽ \bt_p{end_clock_snapshot_value} |
43c59509 PP |
2747 | |
2748 | @bt_post_success_frozen{stream} | |
2749 | */ | |
2750 | extern bt_message *bt_message_discarded_packets_create_with_default_clock_snapshots( | |
2751 | bt_self_message_iterator *self_message_iterator, | |
2752 | const bt_stream *stream, uint64_t beginning_clock_snapshot_value, | |
2753 | uint64_t end_clock_snapshot_value); | |
2754 | ||
2755 | /*! | |
2756 | @brief | |
2757 | Borrows the \bt_stream of the \bt_disc_pkt_msg \bt_p{message}. | |
2758 | ||
2759 | See the \ref api-msg-disc-ev-prop-stream "stream" property. | |
2760 | ||
2761 | @param[in] message | |
2762 | Discarded packets message from which to borrow the stream. | |
2763 | ||
2764 | @returns | |
2765 | @parblock | |
2766 | \em Borrowed reference of the stream of \bt_p{message}. | |
2767 | ||
2768 | The returned pointer remains valid as long as \bt_p{message} exists. | |
2769 | @endparblock | |
2770 | ||
2771 | @bt_pre_not_null{message} | |
2772 | @bt_pre_is_disc_pkt_msg{message} | |
2773 | ||
2774 | @sa bt_message_discarded_packets_borrow_stream_const() — | |
2775 | \c const version of this function. | |
2776 | */ | |
2777 | extern bt_stream *bt_message_discarded_packets_borrow_stream( | |
2778 | bt_message *message); | |
2779 | ||
2780 | /*! | |
2781 | @brief | |
2782 | Borrows the \bt_stream of the \bt_disc_pkt_msg \bt_p{message} | |
2783 | (\c const version). | |
2784 | ||
2785 | See bt_message_discarded_packets_borrow_stream(). | |
2786 | */ | |
2787 | extern const bt_stream * | |
2788 | bt_message_discarded_packets_borrow_stream_const(const bt_message *message); | |
2789 | ||
2790 | /*! | |
2791 | @brief | |
2792 | Borrows the beginning default \bt_cs of the \bt_disc_pkt_msg | |
2793 | \bt_p{message}. | |
2794 | ||
2795 | See the | |
2796 | \ref api-msg-disc-pkt-prop-cs-beg "beginning default clock snapshot" | |
2797 | property. | |
2798 | ||
2799 | @param[in] message | |
2800 | Discarded packets message from which to borrow the beginning default | |
2801 | clock snapshot. | |
2802 | ||
2803 | @returns | |
2804 | Beginning default clock snapshot of \bt_p{message}. | |
2805 | ||
2806 | @bt_pre_not_null{message} | |
2807 | @bt_pre_is_disc_pkt_msg{message} | |
2808 | @pre | |
2809 | The discarded packets messages of the \bt_stream_cls of | |
2810 | \bt_p{message} | |
2811 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". | |
2812 | */ | |
2813 | extern const bt_clock_snapshot * | |
2814 | bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const( | |
2815 | const bt_message *message); | |
2816 | ||
2817 | /*! | |
2818 | @brief | |
2819 | Borrows the end default \bt_cs of the \bt_disc_pkt_msg | |
2820 | \bt_p{message}. | |
2821 | ||
2822 | See the | |
2823 | \ref api-msg-disc-pkt-prop-cs-end "end default clock snapshot" | |
2824 | property. | |
2825 | ||
2826 | @param[in] message | |
2827 | Discarded packets message from which to borrow the end default clock | |
2828 | snapshot. | |
2829 | ||
2830 | @returns | |
2831 | End default clock snapshot of \bt_p{message}. | |
2832 | ||
2833 | @bt_pre_not_null{message} | |
2834 | @bt_pre_is_disc_pkt_msg{message} | |
2835 | @pre | |
2836 | The discarded packets messages of the \bt_stream_cls of | |
2837 | \bt_p{message} | |
2838 | \ref api-tir-stream-cls-prop-disc-pkt-cs "have default clock snapshots". | |
2839 | */ | |
2840 | extern const bt_clock_snapshot * | |
2841 | bt_message_discarded_packets_borrow_end_default_clock_snapshot_const( | |
2842 | const bt_message *message); | |
2843 | ||
2844 | /*! | |
2845 | @brief | |
2846 | Borrows the default \bt_clock_cls of the \bt_stream_cls | |
2847 | of the \bt_disc_pkt_msg \bt_p{message}. | |
2848 | ||
2849 | See the stream class's | |
2850 | \ref api-tir-stream-cls-prop-def-clock-cls "default clock class" | |
2851 | property. | |
2852 | ||
2853 | This is a helper which is equivalent to | |
2854 | ||
2855 | @code | |
2856 | bt_stream_class_borrow_default_clock_class_const( | |
2857 | bt_stream_borrow_class_const( | |
2858 | bt_message_discarded_packets_borrow_stream_const(message))) | |
2859 | @endcode | |
2860 | ||
2861 | @param[in] message | |
2862 | Discarded packets message from which to borrow its stream's class's | |
2863 | default clock class. | |
2864 | ||
2865 | @returns | |
2866 | \em Borrowed reference of the default clock class of | |
2867 | the stream class of \bt_p{message}, or \c NULL if none. | |
2868 | ||
2869 | @bt_pre_not_null{message} | |
2870 | @bt_pre_is_disc_pkt_msg{message} | |
2871 | */ | |
2872 | extern const bt_clock_class * | |
2873 | bt_message_discarded_packets_borrow_stream_class_default_clock_class_const( | |
2874 | const bt_message *message); | |
2875 | ||
2876 | /*! | |
2877 | @brief | |
2878 | Sets the number of discarded packets of the \bt_disc_pkt_msg | |
2879 | \bt_p{message} to \bt_p{count}. | |
2880 | ||
2881 | See the \ref api-msg-disc-ev-prop-count "discarded packet count" | |
2882 | property. | |
2883 | ||
2884 | @param[in] message | |
2885 | Discarded packets message of which to set the number of discarded | |
2886 | packets to \bt_p{count}. | |
2887 | @param[in] count | |
2888 | New number of discarded packets of \bt_p{message}. | |
2889 | ||
2890 | @bt_pre_not_null{message} | |
2891 | @bt_pre_hot{message} | |
2892 | @bt_pre_is_disc_pkt_msg{message} | |
e5a41ca3 SM |
2893 | @pre |
2894 | \bt_p{count} > 0 | |
43c59509 PP |
2895 | |
2896 | @sa bt_message_discarded_packets_get_count() — | |
2897 | Returns the number of discarded packets of a discarded packets | |
2898 | message. | |
2899 | */ | |
2900 | extern void bt_message_discarded_packets_set_count(bt_message *message, | |
2901 | uint64_t count); | |
2902 | ||
2903 | /*! | |
2904 | @brief | |
2905 | Returns the number of discarded packets of the \bt_disc_pkt_msg | |
2906 | \bt_p{message}. | |
2907 | ||
2908 | See the \ref api-msg-disc-ev-prop-count "discarded packet count" | |
2909 | property. | |
2910 | ||
2911 | @param[in] message | |
2912 | Discarded packets message of which to get the number of discarded | |
2913 | packets. | |
2914 | @param[out] count | |
2915 | <strong>If this function returns | |
2916 | #BT_PROPERTY_AVAILABILITY_AVAILABLE</strong>, \bt_p{*count} is | |
2917 | the number of discarded packets of \bt_p{message}. | |
2918 | ||
2919 | @retval #BT_PROPERTY_AVAILABILITY_AVAILABLE | |
2920 | The number of discarded packets of \bt_p{message} is available. | |
2921 | @retval #BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE | |
2922 | The number of discarded packets of \bt_p{message} is not available. | |
2923 | ||
2924 | @bt_pre_not_null{message} | |
2925 | @bt_pre_is_disc_pkt_msg{message} | |
2926 | @bt_pre_not_null{count} | |
2927 | ||
2928 | @sa bt_message_discarded_packets_set_count() — | |
2929 | Sets the number of discarded packets of a discarded packets message. | |
2930 | */ | |
2931 | extern bt_property_availability bt_message_discarded_packets_get_count( | |
2932 | const bt_message *message, uint64_t *count); | |
2933 | ||
2934 | /*! @} */ | |
2935 | ||
2936 | /*! | |
2937 | @name Message iterator inactivity message | |
2938 | @{ | |
2939 | */ | |
2940 | ||
2941 | /*! | |
2942 | @brief | |
2943 | Creates a \bt_inac_msg having a \bt_cs of a fictitious instance of | |
2944 | the \bt_clock_cls \bt_p{clock_class} with the value | |
2945 | \bt_p{clock_snapshot_value} from the \bt_msg_iter | |
2946 | \bt_p{self_message_iterator}. | |
2947 | ||
2948 | On success, the returned message iterator inactivity message has the | |
2949 | following property values: | |
2950 | ||
2951 | <table> | |
2952 | <tr> | |
2953 | <th>Property | |
2954 | <th>Value | |
2955 | <tr> | |
2956 | <td>\ref api-msg-inac-prop-cs "Clock snapshot" | |
2957 | <td> | |
2958 | \bt_c_cs (snapshot of a fictitious instance of \bt_p{clock_class}) | |
2959 | with the value \bt_p{clock_snapshot_value}. | |
2960 | </table> | |
2961 | ||
2962 | @param[in] self_message_iterator | |
2963 | Self message iterator from which to create the message iterator | |
2964 | inactivity message. | |
2965 | @param[in] clock_class | |
2966 | Class of the fictitious instance of which | |
2967 | \bt_p{clock_snapshot_value} is the value of its snapshot. | |
2968 | @param[in] clock_snapshot_value | |
2969 | Value (clock cycles) of the clock snapshot of \bt_p{message}. | |
2970 | ||
2971 | @returns | |
2972 | New message iterator inactivity message reference, or \c NULL on | |
2973 | memory error. | |
2974 | ||
2975 | @bt_pre_not_null{self_message_iterator} | |
2976 | @bt_pre_not_null{clock_class} | |
2977 | ||
2978 | @bt_post_success_frozen{clock_class} | |
2979 | */ | |
2980 | extern | |
2981 | bt_message *bt_message_message_iterator_inactivity_create( | |
2982 | bt_self_message_iterator *self_message_iterator, | |
2983 | const bt_clock_class *clock_class, | |
2984 | uint64_t clock_snapshot_value); | |
2985 | ||
2986 | /*! | |
2987 | @brief | |
2988 | Borrows the \bt_cs of the \bt_inac_msg \bt_p{message}. | |
2989 | ||
2990 | See the \ref api-msg-inac-prop-cs "clock snapshot" property. | |
2991 | ||
2992 | @param[in] message | |
2993 | Message iterator inactivity message from which to borrow the clock | |
2994 | snapshot. | |
2995 | ||
2996 | @returns | |
2997 | Clock snapshot of \bt_p{message}. | |
2998 | ||
2999 | @bt_pre_not_null{message} | |
3000 | @bt_pre_is_inac_msg{message} | |
3001 | */ | |
3002 | extern const bt_clock_snapshot * | |
3003 | bt_message_message_iterator_inactivity_borrow_clock_snapshot_const( | |
3004 | const bt_message *message); | |
3005 | ||
3006 | /*! @} */ | |
3007 | ||
3008 | /*! | |
3009 | @name Message reference count | |
3010 | @{ | |
3011 | */ | |
3012 | ||
3013 | /*! | |
3014 | @brief | |
3015 | Increments the \ref api-fund-shared-object "reference count" of | |
3016 | the message \bt_p{message}. | |
3017 | ||
3018 | @param[in] message | |
3019 | @parblock | |
3020 | Message of which to increment the reference count. | |
3021 | ||
3022 | Can be \c NULL. | |
3023 | @endparblock | |
3024 | ||
3025 | @sa bt_message_put_ref() — | |
3026 | Decrements the reference count of a message. | |
3027 | */ | |
3028 | extern void bt_message_get_ref(const bt_message *message); | |
3029 | ||
3030 | /*! | |
3031 | @brief | |
3032 | Decrements the \ref api-fund-shared-object "reference count" of | |
3033 | the message \bt_p{message}. | |
3034 | ||
3035 | @param[in] message | |
3036 | @parblock | |
3037 | Message of which to decrement the reference count. | |
3038 | ||
3039 | Can be \c NULL. | |
3040 | @endparblock | |
3041 | ||
3042 | @sa bt_message_get_ref() — | |
3043 | Increments the reference count of a message. | |
3044 | */ | |
3045 | extern void bt_message_put_ref(const bt_message *message); | |
3046 | ||
3047 | /*! | |
3048 | @brief | |
3049 | Decrements the reference count of the message \bt_p{_message}, and | |
3050 | then sets \bt_p{_message} to \c NULL. | |
3051 | ||
3052 | @param _message | |
3053 | @parblock | |
3054 | Message of which to decrement the reference count. | |
3055 | ||
3056 | Can contain \c NULL. | |
3057 | @endparblock | |
3058 | ||
3059 | @bt_pre_assign_expr{_message} | |
3060 | */ | |
3061 | #define BT_MESSAGE_PUT_REF_AND_RESET(_message) \ | |
3062 | do { \ | |
3063 | bt_message_put_ref(_message); \ | |
3064 | (_message) = NULL; \ | |
3065 | } while (0) | |
3066 | ||
3067 | /*! | |
3068 | @brief | |
3069 | Decrements the reference count of the message \bt_p{_dst}, sets | |
3070 | \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL. | |
3071 | ||
3072 | This macro effectively moves a message reference from the expression | |
3073 | \bt_p{_src} to the expression \bt_p{_dst}, putting the existing | |
3074 | \bt_p{_dst} reference. | |
3075 | ||
3076 | @param _dst | |
3077 | @parblock | |
3078 | Destination expression. | |
3079 | ||
3080 | Can contain \c NULL. | |
3081 | @endparblock | |
3082 | @param _src | |
3083 | @parblock | |
3084 | Source expression. | |
3085 | ||
3086 | Can contain \c NULL. | |
3087 | @endparblock | |
3088 | ||
3089 | @bt_pre_assign_expr{_dst} | |
3090 | @bt_pre_assign_expr{_src} | |
3091 | */ | |
3092 | #define BT_MESSAGE_MOVE_REF(_dst, _src) \ | |
3093 | do { \ | |
3094 | bt_message_put_ref(_dst); \ | |
3095 | (_dst) = (_src); \ | |
3096 | (_src) = NULL; \ | |
3097 | } while (0) | |
3098 | ||
3099 | /*! @} */ | |
3100 | ||
43c59509 PP |
3101 | /*! |
3102 | @name Message Interchange Protocol version | |
3103 | @{ | |
3104 | */ | |
3105 | ||
3106 | /*! | |
3107 | @brief | |
3108 | Status codes for bt_get_greatest_operative_mip_version(). | |
3109 | */ | |
3110 | typedef enum bt_get_greatest_operative_mip_version_status { | |
3111 | /*! | |
3112 | @brief | |
3113 | Success. | |
3114 | */ | |
3115 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_OK = __BT_FUNC_STATUS_OK, | |
3116 | ||
3117 | /*! | |
3118 | @brief | |
3119 | No match found. | |
3120 | */ | |
3121 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH = __BT_FUNC_STATUS_NO_MATCH, | |
3122 | ||
3123 | /*! | |
3124 | @brief | |
3125 | Out of memory. | |
3126 | */ | |
3127 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
3128 | ||
3129 | /*! | |
3130 | @brief | |
3131 | Other error. | |
3132 | */ | |
3133 | BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, | |
3134 | } bt_get_greatest_operative_mip_version_status; | |
3135 | ||
3136 | /*! | |
3137 | @brief | |
3138 | Computes the greatest \bt_mip version which | |
3139 | you can use to create a trace processing \bt_graph to which you | |
3140 | intend to \ref api-graph-lc-add "add components" described by the | |
3141 | component descriptors \bt_p{component_descriptors}, and sets | |
3142 | \bt_p{*mip_version} to the result. | |
3143 | ||
3144 | This function calls the | |
3145 | \link api-comp-cls-dev-meth-mip "get supported MIP versions"\endlink | |
3146 | method for each component descriptor in \bt_p{component_descriptors}, | |
3147 | and then returns the greatest common (operative) MIP version, if any. | |
3148 | The "get supported MIP versions" method receives \bt_p{logging_level} as | |
3149 | its \bt_p{logging_level} parameter. | |
3150 | ||
3151 | If this function does not find an operative MIP version for the | |
3152 | component descriptors of \bt_p{component_descriptors}, it returns | |
3153 | #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH. | |
3154 | ||
3155 | @note | |
3156 | As of \bt_name_version_min_maj, because bt_get_maximal_mip_version() | |
3157 | returns 0, this function always sets \bt_p{*mip_version} to | |
3158 | 0 on success. | |
3159 | ||
3160 | @param[in] component_descriptors | |
3161 | Component descriptors for which to get the supported MIP versions | |
3162 | to compute the greatest operative MIP version. | |
3163 | @param[in] logging_level | |
3164 | Logging level to use when calling the "get supported MIP versions" | |
3165 | method for each component descriptor in | |
3166 | \bt_p{component_descriptors}. | |
3167 | @param[out] mip_version | |
3168 | <strong>On success</strong>, \bt_p{*mip_version} is the greatest | |
3169 | operative MIP version of all the component descriptors in | |
3170 | \bt_p{component_descriptors}. | |
3171 | ||
3172 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_OK | |
3173 | Success. | |
3174 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH | |
3175 | No operative MIP version exists for the component descriptors of | |
3176 | \bt_p{component_descriptors}. | |
3177 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_MEMORY_ERROR | |
3178 | Out of memory. | |
3179 | @retval #BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_ERROR | |
3180 | Other error. | |
3181 | ||
3182 | @bt_pre_not_null{component_descriptors} | |
3183 | @pre | |
3184 | \bt_p{component_descriptors} contains one or more component | |
3185 | descriptors. | |
3186 | @bt_pre_not_null{mip_version} | |
3187 | */ | |
3188 | extern bt_get_greatest_operative_mip_version_status | |
3189 | bt_get_greatest_operative_mip_version( | |
3190 | const bt_component_descriptor_set *component_descriptors, | |
3191 | bt_logging_level logging_level, uint64_t *mip_version); | |
3192 | ||
3193 | /*! | |
3194 | @brief | |
3195 | Returns the maximal available \bt_mip version as of | |
3196 | \bt_name_version_min_maj. | |
3197 | ||
3198 | As of \bt_name_version_min_maj, this function returns | |
3199 | \bt_max_mip_version. | |
3200 | ||
3201 | @returns | |
3202 | Maximal available MIP version (\bt_max_mip_version). | |
3203 | */ | |
3204 | extern uint64_t bt_get_maximal_mip_version(void); | |
3205 | ||
3206 | /*! @} */ | |
3207 | ||
3208 | /*! @} */ | |
3209 | ||
3210 | #ifdef __cplusplus | |
3211 | } | |
3212 | #endif | |
3213 | ||
3214 | #endif /* BABELTRACE2_GRAPH_MESSAGE_H */ |