X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=lib%2Fgraph%2Fnotification%2Fevent.c;h=d466852cd26188be29708ee22eb23a336fe9bf8a;hb=862ca4ed7b3a8ef14f69529d252bccc48a33108a;hp=bd0d077b50258204051c04c1fea11bd1017113ea;hpb=28e6ca8b6e08d1cdd1af81ae819aa39baa206eaf;p=babeltrace.git diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c index bd0d077b..d466852c 100644 --- a/lib/graph/notification/event.c +++ b/lib/graph/notification/event.c @@ -33,9 +33,9 @@ #include #include #include -#include +#include +#include #include -#include #include #include #include @@ -50,7 +50,7 @@ static inline bool event_class_has_trace(struct bt_event_class *event_class) stream_class = bt_event_class_borrow_stream_class(event_class); BT_ASSERT(stream_class); - return bt_stream_class_borrow_trace(stream_class) != NULL; + return bt_stream_class_borrow_trace_class(stream_class) != NULL; } BT_HIDDEN @@ -76,32 +76,27 @@ end: return (void *) notification; } -struct bt_private_notification *bt_private_notification_event_create( - struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_private_event_class *priv_event_class, - struct bt_private_packet *priv_packet) +struct bt_notification *bt_notification_event_create( + struct bt_self_notification_iterator *self_notif_iter, + struct bt_event_class *event_class, + struct bt_packet *packet) { - struct bt_event_class *event_class = (void *) priv_event_class; - struct bt_packet *packet = (void *) priv_packet; + struct bt_self_component_port_input_notification_iterator *notif_iter = + (void *) self_notif_iter; struct bt_notification_event *notification = NULL; struct bt_event *event; - struct bt_graph *graph; BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator"); BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); BT_ASSERT_PRE_NON_NULL(packet, "Packet"); - BT_LOGD("Creating event notification object: " - "event-class-addr=%p, " - "event-class-name=\"%s\", event-class-id=%" PRId64, - event_class, - bt_event_class_get_name(event_class), - bt_event_class_get_id(event_class)); BT_ASSERT_PRE(event_class_has_trace(event_class), "Event class is not part of a trace: %!+E", event_class); + BT_LIB_LOGD("Creating event notification object: %![ec-]+E", + event_class); event = bt_event_create(event_class, packet); if (unlikely(!event)) { BT_LIB_LOGE("Cannot create event from event class: " - "%![event-class-]+E", event_class); + "%![ec-]+E", event_class); goto error; } @@ -120,10 +115,8 @@ struct bt_private_notification *bt_private_notification_event_create( * to notify the graph (pool owner) so that it removes the * notification from its notification array. */ - graph = bt_private_connection_private_notification_iterator_borrow_graph( - notif_iter); notification = (void *) bt_notification_create_from_pool( - &graph->event_notif_pool, graph); + ¬if_iter->graph->event_notif_pool, notif_iter->graph); if (unlikely(!notification)) { /* bt_notification_create_from_pool() logs errors */ goto error; @@ -133,14 +126,8 @@ struct bt_private_notification *bt_private_notification_event_create( notification->event = event; bt_packet_set_is_frozen(packet, true); bt_event_class_freeze(event_class); - BT_LOGD("Created event notification object: " - "event-addr=%p, event-class-addr=%p, " - "event-class-name=\"%s\", event-class-id=%" PRId64 ", " - "notif-addr=%p", - notification->event, event_class, - bt_event_class_get_name(event_class), - bt_event_class_get_id(event_class), - notification); + BT_LIB_LOGD("Created event notification object: " + "%![notif-]+n, %![event-]+e", notification, event); goto end; error: @@ -156,11 +143,12 @@ void bt_notification_event_destroy(struct bt_notification *notif) { struct bt_notification_event *event_notif = (void *) notif; - BT_LOGD("Destroying event notification: addr=%p", notif); + BT_LIB_LOGD("Destroying event notification: %!+n", notif); if (event_notif->event) { - BT_LOGD_STR("Recycling event."); + BT_LIB_LOGD("Recycling event: %!+e", event_notif->event); bt_event_recycle(event_notif->event); + event_notif->event = NULL; } g_free(notif); @@ -179,10 +167,10 @@ void bt_notification_event_recycle(struct bt_notification *notif) return; } - BT_LOGD("Recycling event notification: addr=%p", notif); + BT_LIB_LOGD("Recycling event notification: %![notif-]+n, %![event-]+e", + notif, event_notif->event); bt_notification_reset(notif); BT_ASSERT(event_notif->event); - BT_LOGD_STR("Recycling event."); bt_event_recycle(event_notif->event); event_notif->event = NULL; graph = notif->graph; @@ -190,8 +178,8 @@ void bt_notification_event_recycle(struct bt_notification *notif) bt_object_pool_recycle_object(&graph->event_notif_pool, notif); } -struct bt_event *bt_notification_event_borrow_event( - struct bt_notification *notification) +static inline +struct bt_event *borrow_event(struct bt_notification *notification) { struct bt_notification_event *event_notification; @@ -202,9 +190,14 @@ struct bt_event *bt_notification_event_borrow_event( return event_notification->event; } -struct bt_private_event *bt_private_notification_event_borrow_event( - struct bt_private_notification *notification) +struct bt_event *bt_notification_event_borrow_event( + struct bt_notification *notification) +{ + return borrow_event(notification); +} + +const struct bt_event *bt_notification_event_borrow_event_const( + const struct bt_notification *notification) { - return (void *) bt_notification_event_borrow_event( - (void *) notification); + return borrow_event((void *) notification); }