lib: graph: add "self" and some "private" APIs
[babeltrace.git] / lib / trace-ir / packet.c
CommitLineData
f79cf0f0 1/*
f79cf0f0
PP
2 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
8ea705f0 23#define BT_LOG_TAG "PACKET"
be514b0c 24#include <babeltrace/lib-logging-internal.h>
8ea705f0 25
3dca2276 26#include <babeltrace/assert-pre-internal.h>
56e18c4c 27#include <babeltrace/trace-ir/fields-internal.h>
e5be10ef 28#include <babeltrace/trace-ir/private-packet.h>
56e18c4c
PP
29#include <babeltrace/trace-ir/packet.h>
30#include <babeltrace/trace-ir/packet-internal.h>
31#include <babeltrace/trace-ir/field-wrapper-internal.h>
32#include <babeltrace/trace-ir/trace.h>
33#include <babeltrace/trace-ir/stream-class-internal.h>
34#include <babeltrace/trace-ir/stream-class.h>
35#include <babeltrace/trace-ir/stream.h>
36#include <babeltrace/trace-ir/stream-internal.h>
37#include <babeltrace/trace-ir/clock-value-internal.h>
38#include <babeltrace/trace-ir/trace-internal.h>
f79cf0f0 39#include <babeltrace/object-internal.h>
65300d60 40#include <babeltrace/object.h>
f6ccaed9 41#include <babeltrace/assert-internal.h>
be514b0c 42#include <inttypes.h>
f79cf0f0 43
44c440bc
PP
44#define BT_ASSERT_PRE_PACKET_HOT(_packet) \
45 BT_ASSERT_PRE_HOT((_packet), "Packet", ": %!+a", (_packet))
46
094ff7c0 47struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet)
f79cf0f0 48{
f6ccaed9 49 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
094ff7c0 50 return packet->stream;
f79cf0f0
PP
51}
52
28e6ca8b 53struct bt_private_stream *bt_private_packet_borrow_stream(
e5be10ef
PP
54 struct bt_private_packet *packet)
55{
56 return (void *) bt_packet_borrow_stream((void *) packet);
57}
58
44c440bc 59struct bt_field *bt_packet_borrow_header_field(struct bt_packet *packet)
f79cf0f0 60{
f6ccaed9 61 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc 62 return packet->header_field ? packet->header_field->field : NULL;
f79cf0f0
PP
63}
64
28e6ca8b 65struct bt_private_field *bt_private_packet_borrow_header_field(
e5be10ef
PP
66 struct bt_private_packet *packet)
67{
68 return (void *) bt_packet_borrow_header_field((void *) packet);
69}
70
44c440bc 71struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet)
f79cf0f0 72{
312c056a 73 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc 74 return packet->context_field ? packet->context_field->field : NULL;
312c056a 75}
c5c82c6e 76
28e6ca8b 77struct bt_private_field *bt_private_packet_borrow_context_field(
e5be10ef
PP
78 struct bt_private_packet *packet)
79{
80 return (void *) bt_packet_borrow_context_field((void *) packet);
81}
82
312c056a 83BT_HIDDEN
6c677fb5 84void _bt_packet_set_is_frozen(struct bt_packet *packet, bool is_frozen)
312c056a 85{
59e3c4db 86 if (!packet) {
312c056a 87 return;
c5c82c6e
PP
88 }
89
44c440bc
PP
90 BT_LIB_LOGD("Setting packet's frozen state: %![packet-]+a, "
91 "is-frozen=%d", packet, is_frozen);
312c056a 92
44c440bc
PP
93 if (packet->header_field) {
94 BT_LOGD_STR("Setting packet's header field's frozen state.");
95 bt_field_set_is_frozen(packet->header_field->field,
6c677fb5 96 is_frozen);
f79cf0f0
PP
97 }
98
44c440bc
PP
99 if (packet->context_field) {
100 BT_LOGD_STR("Setting packet's context field's frozen state.");
101 bt_field_set_is_frozen(packet->context_field->field,
6c677fb5 102 is_frozen);
312c056a
PP
103 }
104
6c677fb5 105 packet->frozen = is_frozen;
f6ccaed9
PP
106}
107
ccf82993 108static inline
44c440bc 109void reset_counter_snapshots(struct bt_packet *packet)
ccf82993 110{
44c440bc
PP
111 packet->discarded_event_counter_snapshot.base.avail =
112 BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE;
113 packet->packet_counter_snapshot.base.avail =
114 BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE;
ccf82993
PP
115}
116
312c056a 117static inline
44c440bc 118void reset_packet(struct bt_packet *packet)
f6ccaed9 119{
312c056a 120 BT_ASSERT(packet);
44c440bc 121 BT_LIB_LOGD("Resetting packet: %!+a", packet);
6c677fb5 122 bt_packet_set_is_frozen(packet, false);
312c056a 123
44c440bc
PP
124 if (packet->header_field) {
125 bt_field_set_is_frozen(packet->header_field->field, false);
126 bt_field_reset(packet->header_field->field);
312c056a
PP
127 }
128
44c440bc
PP
129 if (packet->context_field) {
130 bt_field_set_is_frozen(packet->context_field->field, false);
131 bt_field_reset(packet->context_field->field);
312c056a 132 }
e22b45d0 133
44c440bc
PP
134 if (packet->default_beginning_cv) {
135 bt_clock_value_reset(packet->default_beginning_cv);
136 }
ccf82993 137
44c440bc
PP
138 if (packet->default_end_cv) {
139 bt_clock_value_reset(packet->default_end_cv);
ccf82993 140 }
44c440bc
PP
141
142 reset_counter_snapshots(packet);
f79cf0f0
PP
143}
144
312c056a 145static
44c440bc 146void recycle_header_field(struct bt_field_wrapper *header_field,
312c056a 147 struct bt_trace *trace)
f79cf0f0 148{
312c056a
PP
149 BT_ASSERT(header_field);
150 BT_LIB_LOGD("Recycling packet header field: "
151 "addr=%p, %![trace-]+t, %![field-]+f", header_field,
152 trace, header_field->field);
153 bt_object_pool_recycle_object(&trace->packet_header_field_pool,
154 header_field);
f79cf0f0
PP
155}
156
312c056a 157static
44c440bc 158void recycle_context_field(struct bt_field_wrapper *context_field,
312c056a 159 struct bt_stream_class *stream_class)
f79cf0f0 160{
312c056a
PP
161 BT_ASSERT(context_field);
162 BT_LIB_LOGD("Recycling packet context field: "
163 "addr=%p, %![sc-]+S, %![field-]+f", context_field,
164 stream_class, context_field->field);
165 bt_object_pool_recycle_object(&stream_class->packet_context_field_pool,
166 context_field);
f79cf0f0
PP
167}
168
169BT_HIDDEN
312c056a 170void bt_packet_recycle(struct bt_packet *packet)
f79cf0f0 171{
312c056a 172 struct bt_stream *stream;
f79cf0f0 173
312c056a
PP
174 BT_ASSERT(packet);
175 BT_LIB_LOGD("Recycling packet: %!+a", packet);
176
177 /*
178 * Those are the important ordered steps:
179 *
180 * 1. Reset the packet object (put any permanent reference it
181 * has, unfreeze it and its fields in developer mode, etc.),
182 * but do NOT put its stream's reference. This stream
183 * contains the pool to which we're about to recycle this
184 * packet object, so we must guarantee its existence thanks
185 * to this existing reference.
186 *
187 * 2. Move the stream reference to our `stream`
188 * variable so that we can set the packet's stream member
189 * to NULL before recycling it. We CANNOT do this after
65300d60 190 * we put the stream reference because this bt_object_put_ref()
312c056a
PP
191 * could destroy the stream, also destroying its
192 * packet pool, thus also destroying our packet object (this
193 * would result in an invalid write access).
194 *
195 * 3. Recycle the packet object.
196 *
197 * 4. Put our stream reference.
198 */
44c440bc 199 reset_packet(packet);
312c056a
PP
200 stream = packet->stream;
201 BT_ASSERT(stream);
202 packet->stream = NULL;
203 bt_object_pool_recycle_object(&stream->packet_pool, packet);
cb6f1f7d 204 bt_object_put_no_null_check(&stream->base);
f79cf0f0
PP
205}
206
312c056a
PP
207BT_HIDDEN
208void bt_packet_destroy(struct bt_packet *packet)
f79cf0f0 209{
44c440bc 210 BT_LIB_LOGD("Destroying packet: %!+a", packet);
312c056a 211
44c440bc 212 if (packet->header_field) {
312c056a
PP
213 if (packet->stream) {
214 BT_LOGD_STR("Recycling packet's header field.");
44c440bc
PP
215 recycle_header_field(packet->header_field,
216 bt_stream_class_borrow_trace_inline(
217 packet->stream->class));
312c056a 218 } else {
44c440bc 219 bt_field_wrapper_destroy(packet->header_field);
312c056a
PP
220 }
221 }
222
44c440bc 223 if (packet->context_field) {
312c056a
PP
224 if (packet->stream) {
225 BT_LOGD_STR("Recycling packet's context field.");
44c440bc
PP
226 recycle_context_field(packet->context_field,
227 packet->stream->class);
312c056a 228 } else {
44c440bc 229 bt_field_wrapper_destroy(packet->context_field);
312c056a
PP
230 }
231 }
232
44c440bc
PP
233 if (packet->default_beginning_cv) {
234 BT_LOGD_STR("Recycling beginning clock value.");
235 bt_clock_value_recycle(packet->default_beginning_cv);
236 }
237
238 if (packet->default_end_cv) {
239 BT_LOGD_STR("Recycling end clock value.");
240 bt_clock_value_recycle(packet->default_end_cv);
241 }
242
d409daba 243 BT_LOGD_STR("Putting packet's stream.");
65300d60 244 bt_object_put_ref(packet->stream);
f79cf0f0
PP
245 g_free(packet);
246}
247
312c056a
PP
248BT_HIDDEN
249struct bt_packet *bt_packet_new(struct bt_stream *stream)
f79cf0f0 250{
50842bdc 251 struct bt_packet *packet = NULL;
50842bdc 252 struct bt_trace *trace = NULL;
f79cf0f0 253
312c056a 254 BT_ASSERT(stream);
44c440bc 255 BT_LIB_LOGD("Creating packet object: %![stream-]+s", stream);
50842bdc 256 packet = g_new0(struct bt_packet, 1);
f79cf0f0 257 if (!packet) {
8ea705f0 258 BT_LOGE_STR("Failed to allocate one packet object.");
44c440bc 259 goto error;
f79cf0f0
PP
260 }
261
3fea54f6
PP
262 bt_object_init_shared(&packet->base,
263 (bt_object_release_func) bt_packet_recycle);
65300d60 264 packet->stream = bt_object_get_ref(stream);
44c440bc
PP
265 trace = bt_stream_class_borrow_trace_inline(stream->class);
266 BT_ASSERT(trace);
be514b0c 267
5cd6d0e5 268 if (trace->packet_header_fc) {
44c440bc
PP
269 BT_LOGD_STR("Creating initial packet header field.");
270 packet->header_field = bt_field_wrapper_create(
312c056a 271 &trace->packet_header_field_pool,
5cd6d0e5 272 trace->packet_header_fc);
44c440bc
PP
273 if (!packet->header_field) {
274 BT_LOGE_STR("Cannot create packet header field wrapper.");
275 goto error;
be514b0c 276 }
f79cf0f0
PP
277 }
278
5cd6d0e5 279 if (stream->class->packet_context_fc) {
44c440bc
PP
280 BT_LOGD_STR("Creating initial packet context field.");
281 packet->context_field = bt_field_wrapper_create(
282 &stream->class->packet_context_field_pool,
5cd6d0e5 283 stream->class->packet_context_fc);
44c440bc
PP
284 if (!packet->context_field) {
285 BT_LOGE_STR("Cannot create packet context field wrapper.");
286 goto error;
be514b0c 287 }
f79cf0f0
PP
288 }
289
44c440bc
PP
290 if (stream->class->default_clock_class) {
291 if (stream->class->packets_have_default_beginning_cv) {
292 packet->default_beginning_cv = bt_clock_value_create(
293 stream->class->default_clock_class);
294 if (!packet->default_beginning_cv) {
295 /* bt_clock_value_create() logs errors */
296 goto error;
297 }
ccf82993
PP
298 }
299
44c440bc
PP
300 if (stream->class->packets_have_default_end_cv) {
301 packet->default_end_cv = bt_clock_value_create(
302 stream->class->default_clock_class);
303 if (!packet->default_end_cv) {
304 /* bt_clock_value_create() logs errors */
305 goto error;
306 }
ccf82993
PP
307 }
308 }
309
44c440bc
PP
310 reset_counter_snapshots(packet);
311 BT_LIB_LOGD("Created packet object: %!+a", packet);
312 goto end;
ccf82993 313
44c440bc 314error:
65300d60 315 BT_OBJECT_PUT_REF_AND_RESET(packet);
ccf82993
PP
316
317end:
44c440bc 318 return packet;
ccf82993
PP
319}
320
e5be10ef
PP
321struct bt_private_packet *bt_private_packet_create(
322 struct bt_private_stream *priv_stream)
312c056a 323{
e5be10ef 324 struct bt_stream *stream = (void *) priv_stream;
312c056a
PP
325 struct bt_packet *packet = NULL;
326
327 BT_ASSERT_PRE_NON_NULL(stream, "Stream");
328 packet = bt_object_pool_create_object(&stream->packet_pool);
6c677fb5 329 if (unlikely(!packet)) {
312c056a
PP
330 BT_LIB_LOGE("Cannot allocate one packet from stream's packet pool: "
331 "%![stream-]+s", stream);
6c677fb5 332 goto end;
312c056a
PP
333 }
334
44c440bc 335 if (likely(!packet->stream)) {
6c677fb5
PP
336 packet->stream = stream;
337 bt_object_get_no_null_check_no_parent_check(
cb6f1f7d 338 &packet->stream->base);
312c056a
PP
339 }
340
312c056a 341end:
e5be10ef 342 return (void *) packet;
312c056a
PP
343}
344
28e6ca8b 345int bt_private_packet_move_header_field(
e5be10ef
PP
346 struct bt_private_packet *priv_packet,
347 struct bt_private_packet_header_field *header_field)
312c056a 348{
e5be10ef 349 struct bt_packet *packet = (void *) priv_packet;
312c056a
PP
350 struct bt_trace *trace;
351 struct bt_field_wrapper *field_wrapper = (void *) header_field;
352
44c440bc 353 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
312c056a 354 BT_ASSERT_PRE_NON_NULL(field_wrapper, "Header field");
44c440bc
PP
355 BT_ASSERT_PRE_PACKET_HOT(packet);
356 trace = bt_stream_class_borrow_trace_inline(packet->stream->class);
5cd6d0e5
PP
357 BT_ASSERT_PRE(trace->packet_header_fc,
358 "Trace has no packet header field classe: %!+t",
312c056a 359 trace);
5cd6d0e5
PP
360 BT_ASSERT_PRE(field_wrapper->field->class ==
361 trace->packet_header_fc,
362 "Unexpected packet header field's class: "
363 "%![fc-]+F, %![expected-fc-]+F", field_wrapper->field->class,
364 trace->packet_header_fc);
312c056a
PP
365
366 /* Recycle current header field: always exists */
44c440bc
PP
367 BT_ASSERT(packet->header_field);
368 recycle_header_field(packet->header_field, trace);
312c056a
PP
369
370 /* Move new field */
44c440bc 371 packet->header_field = field_wrapper;
312c056a
PP
372 return 0;
373}
374
28e6ca8b 375int bt_private_packet_move_context_field(
e5be10ef
PP
376 struct bt_private_packet *priv_packet,
377 struct bt_private_packet_context_field *context_field)
312c056a 378{
e5be10ef 379 struct bt_packet *packet = (void *) priv_packet;
312c056a
PP
380 struct bt_stream_class *stream_class;
381 struct bt_field_wrapper *field_wrapper = (void *) context_field;
382
44c440bc 383 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
312c056a 384 BT_ASSERT_PRE_NON_NULL(field_wrapper, "Context field");
e22b45d0 385 BT_ASSERT_PRE_HOT(packet, "Packet", ": %!+a", packet);
44c440bc 386 stream_class = packet->stream->class;
5cd6d0e5
PP
387 BT_ASSERT_PRE(stream_class->packet_context_fc,
388 "Stream class has no packet context field classe: %!+S",
312c056a 389 stream_class);
5cd6d0e5
PP
390 BT_ASSERT_PRE(field_wrapper->field->class ==
391 stream_class->packet_context_fc,
392 "Unexpected packet header field's class: "
393 "%![fc-]+F, %![expected-fc-]+F", field_wrapper->field->class,
394 stream_class->packet_context_fc);
312c056a
PP
395
396 /* Recycle current context field: always exists */
44c440bc
PP
397 BT_ASSERT(packet->context_field);
398 recycle_context_field(packet->context_field, stream_class);
312c056a
PP
399
400 /* Move new field */
44c440bc 401 packet->context_field = field_wrapper;
312c056a
PP
402 return 0;
403}
e22b45d0 404
e5be10ef
PP
405int bt_private_packet_set_default_beginning_clock_value(
406 struct bt_private_packet *priv_packet,
44c440bc 407 uint64_t value_cycles)
e22b45d0 408{
e5be10ef 409 struct bt_packet *packet = (void *) priv_packet;
44c440bc 410 struct bt_stream_class *sc;
ccf82993 411
e22b45d0 412 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
413 BT_ASSERT_PRE_PACKET_HOT(packet);
414 sc = packet->stream->class;
415 BT_ASSERT(sc);
416 BT_ASSERT_PRE(sc->default_clock_class,
417 "Packet's stream class has no default clock class: "
418 "%![packet-]+a, %![sc-]+S", packet, sc);
419 BT_ASSERT_PRE(sc->packets_have_default_beginning_cv,
420 "Packet's stream class indicates that its packets have "
421 "no default beginning clock value: %![packet-]+a, %![sc-]+S",
422 packet, sc);
423 BT_ASSERT(packet->default_beginning_cv);
424 bt_clock_value_set_value_inline(packet->default_beginning_cv, value_cycles);
425 BT_LIB_LOGV("Set packet's default beginning clock value: "
e5be10ef 426 "%![packet-]+a, value=%" PRIu64, packet, value_cycles);
44c440bc 427 return 0;
e22b45d0
PP
428}
429
44c440bc
PP
430enum bt_clock_value_status bt_packet_borrow_default_beginning_clock_value(
431 struct bt_packet *packet, struct bt_clock_value **clock_value)
e22b45d0 432{
e22b45d0 433 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
434 BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value (output)");
435 *clock_value = packet->default_beginning_cv;
436 return BT_CLOCK_VALUE_STATUS_KNOWN;
e22b45d0
PP
437}
438
e5be10ef
PP
439int bt_private_packet_set_default_end_clock_value(
440 struct bt_private_packet *priv_packet,
44c440bc 441 uint64_t value_cycles)
e22b45d0 442{
e5be10ef 443 struct bt_packet *packet = (void *) priv_packet;
44c440bc
PP
444 struct bt_stream_class *sc;
445
e22b45d0 446 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
447 BT_ASSERT_PRE_PACKET_HOT(packet);
448 sc = packet->stream->class;
449 BT_ASSERT(sc);
450 BT_ASSERT_PRE(sc->default_clock_class,
451 "Packet's stream class has no default clock class: "
452 "%![packet-]+a, %![sc-]+S", packet, sc);
453 BT_ASSERT_PRE(sc->packets_have_default_end_cv,
454 "Packet's stream class indicates that its packets have "
455 "no default end clock value: %![packet-]+a, %![sc-]+S",
456 packet, sc);
457 BT_ASSERT(packet->default_end_cv);
458 bt_clock_value_set_value_inline(packet->default_end_cv, value_cycles);
459 BT_LIB_LOGV("Set packet's default end clock value: "
e5be10ef 460 "%![packet-]+a, value=%" PRIu64, packet, value_cycles);
44c440bc 461 return 0;
ccf82993
PP
462}
463
44c440bc 464enum bt_clock_value_status bt_packet_borrow_default_end_clock_value(
ccf82993
PP
465 struct bt_packet *packet, struct bt_clock_value **clock_value)
466{
467 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
468 BT_ASSERT_PRE_NON_NULL(clock_value, "Clock value (output)");
469 *clock_value = packet->default_end_cv;
470 return BT_CLOCK_VALUE_STATUS_KNOWN;
e22b45d0
PP
471}
472
44c440bc
PP
473enum bt_property_availability bt_packet_get_discarded_event_counter_snapshot(
474 struct bt_packet *packet, uint64_t *value)
e22b45d0 475{
ccf82993 476 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
477 BT_ASSERT_PRE_NON_NULL(value, "Value (output)");
478 *value = packet->discarded_event_counter_snapshot.value;
479 return packet->discarded_event_counter_snapshot.base.avail;
ccf82993 480}
e22b45d0 481
e5be10ef
PP
482int bt_private_packet_set_discarded_event_counter_snapshot(
483 struct bt_private_packet *priv_packet, uint64_t value)
ccf82993 484{
e5be10ef
PP
485 struct bt_packet *packet = (void *) priv_packet;
486
e22b45d0 487 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
488 BT_ASSERT_PRE_PACKET_HOT(packet);
489 BT_ASSERT_PRE(packet->stream->class->packets_have_discarded_event_counter_snapshot,
490 "Packet's stream's discarded event counter is not enabled: "
491 "%![packet-]+a", packet);
492 bt_property_uint_set(&packet->discarded_event_counter_snapshot, value);
493 return 0;
ccf82993 494}
e22b45d0 495
44c440bc
PP
496enum bt_property_availability bt_packet_get_packet_counter_snapshot(
497 struct bt_packet *packet, uint64_t *value)
ccf82993
PP
498{
499 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
500 BT_ASSERT_PRE_NON_NULL(value, "Value (output)");
501 *value = packet->packet_counter_snapshot.value;
502 return packet->packet_counter_snapshot.base.avail;
ccf82993
PP
503}
504
e5be10ef
PP
505int bt_private_packet_set_packet_counter_snapshot(
506 struct bt_private_packet *priv_packet, uint64_t value)
ccf82993 507{
e5be10ef
PP
508 struct bt_packet *packet = (void *) priv_packet;
509
ccf82993 510 BT_ASSERT_PRE_NON_NULL(packet, "Packet");
44c440bc
PP
511 BT_ASSERT_PRE_PACKET_HOT(packet);
512 BT_ASSERT_PRE(packet->stream->class->packets_have_packet_counter_snapshot,
513 "Packet's stream's packet counter is not enabled: "
514 "%![packet-]+a", packet);
515 bt_property_uint_set(&packet->packet_counter_snapshot, value);
516 return 0;
e22b45d0 517}
This page took 0.082063 seconds and 4 git commands to generate.