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