enum lttng_kernel_event_enabler_type {
LTTNG_EVENT_ENABLER_TYPE_RECORDER,
LTTNG_EVENT_ENABLER_TYPE_NOTIFIER,
+ LTTNG_EVENT_ENABLER_TYPE_COUNTER,
};
enum channel_type {
struct file *file; /* File associated to channel */
unsigned int tstate:1; /* Transient enable state */
+ bool coalesce_hits;
struct lttng_kernel_syscall_table syscall_table;
};
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
{
- struct lttng_event_recorder_enabler *event_recorder_enabler =
- container_of(event_enabler, struct lttng_event_recorder_enabler, parent.parent);
- return &event_recorder_enabler->chan->parent.session->priv->events_name_ht;
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ return &event_enabler_session->chan->session->priv->events_name_ht;
}
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
{
- struct lttng_event_recorder_enabler *event_recorder_enabler =
- container_of(event_enabler, struct lttng_event_recorder_enabler, parent.parent);
- return &event_recorder_enabler->chan->parent.session->priv->events_head;
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ return &event_enabler_session->chan->session->priv->events_head;
}
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
return false;
}
}
+ //TODO: LTTNG_EVENT_ENABLER_TYPE_COUNTER
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
return true;
default:
event_recorder->priv->parent.id = chan->priv->free_event_id++;
return &event_recorder->parent;
}
+ //TODO: LTTNG_EVENT_ENABLER_TYPE_COUNTER
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
struct lttng_event_notifier_enabler *event_notifier_enabler =
return ret;
}
+static
+bool match_event_session_token(struct lttng_kernel_event_session_common_private *event_session_priv,
+ uint64_t token)
+{
+ if (event_session_priv->chan->priv->coalesce_hits)
+ return true;
+ if (event_session_priv->parent.user_token == token)
+ return true;
+ return false;
+}
+
+static
+bool lttng_event_session_enabler_match_event_session(struct lttng_event_enabler_session_common *event_enabler_session,
+ struct lttng_kernel_event_session_common_private *event_session_priv)
+{
+ if (lttng_desc_match_enabler(event_session_priv->parent.desc, &event_enabler_session->parent)
+ && event_session_priv->chan == event_enabler_session->chan
+ && match_event_session_token(event_session_priv, event_enabler_session->parent.user_token))
+ return true;
+ else
+ return false;
+}
+
+static
+int lttng_event_notifier_enabler_match_event_notifier(
+ struct lttng_event_notifier_enabler *event_notifier_enabler,
+ struct lttng_kernel_event_notifier_private *event_notifier_priv)
+{
+ int desc_matches = lttng_desc_match_enabler(event_notifier_priv->parent.desc,
+ lttng_event_notifier_enabler_as_enabler(event_notifier_enabler));
+
+ if (desc_matches && event_notifier_priv->group == event_notifier_enabler->group &&
+ event_notifier_priv->parent.user_token == event_notifier_enabler->parent.user_token)
+ return 1;
+ else
+ return 0;
+}
+
bool lttng_event_enabler_match_event(struct lttng_event_enabler_common *event_enabler,
struct lttng_kernel_event_common *event)
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
{
- struct lttng_event_recorder_enabler *event_recorder_enabler =
- container_of(event_enabler, struct lttng_event_recorder_enabler, parent.parent);
- struct lttng_kernel_event_recorder *event_recorder =
- container_of(event, struct lttng_kernel_event_recorder, parent);
-
- if (lttng_desc_match_enabler(event->priv->desc, event_enabler)
- && event_recorder->chan == event_recorder_enabler->chan)
- return true;
- else
- return false;
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ struct lttng_kernel_event_session_common_private *event_session_priv =
+ container_of(event->priv, struct lttng_kernel_event_session_common_private, parent);
+ return lttng_event_session_enabler_match_event_session(event_enabler_session, event_session_priv);
}
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
struct lttng_event_notifier_enabler *event_notifier_enabler =
container_of(event_enabler, struct lttng_event_notifier_enabler, parent);
- struct lttng_kernel_event_notifier *event_notifier =
- container_of(event, struct lttng_kernel_event_notifier, parent);
-
- if (lttng_desc_match_enabler(event->priv->desc, event_enabler)
- && event_notifier->priv->group == event_notifier_enabler->group
- && event->priv->user_token == event_enabler->user_token)
- return true;
- else
- return false;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event->priv, struct lttng_kernel_event_notifier_private, parent);
+ return lttng_event_notifier_enabler_match_event_notifier(event_notifier_enabler, event_notifier_priv);
}
default:
WARN_ON_ONCE(1);
else
return false;
}
+ //TODO: LTTNG_EVENT_ENABLER_TYPE_COUNTER
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
struct lttng_event_notifier_enabler *event_notifier_enabler =
else
return false;
}
+ //TODO: LTTNG_EVENT_ENABLER_TYPE_COUNTER
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
struct lttng_event_notifier_enabler *event_notifier_enabler =
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
break;
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
kfree(event_notifier_enabler);
break;
}
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
+ {
+ struct lttng_event_counter_enabler *event_counter_enabler =
+ container_of(event_enabler, struct lttng_event_counter_enabler, parent.parent);
+
+ kfree(event_counter_enabler);
+ break;
+ }
default:
WARN_ON_ONCE(1);
}
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
{
- struct lttng_event_recorder_enabler *event_recorder_enabler =
- container_of(event_enabler, struct lttng_event_recorder_enabler, parent.parent);
- lttng_session_lazy_sync_event_enablers(event_recorder_enabler->chan->parent.session);
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ lttng_session_lazy_sync_event_enablers(event_enabler_session->chan->session);
break;
}
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
switch (event_enabler->enabler_type) {
case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
{
- struct lttng_event_recorder_enabler *event_recorder_enabler =
- container_of(event_enabler, struct lttng_event_recorder_enabler, parent.parent);
- return &event_recorder_enabler->chan->priv->parent.syscall_table;
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ return &event_enabler_session->chan->priv->syscall_table;
}
case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
{
{
switch (event->type) {
case LTTNG_KERNEL_EVENT_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
{
- struct lttng_kernel_event_recorder *event_recorder =
- container_of(event, struct lttng_kernel_event_recorder, parent);
- return &event_recorder->chan->priv->parent.syscall_table;
+ struct lttng_kernel_event_common_private *event_priv = event->priv;
+ struct lttng_kernel_event_session_common_private *event_session_priv =
+ container_of(event_priv, struct lttng_kernel_event_session_common_private, parent);
+ return &event_session_priv->chan->priv->syscall_table;
}
case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
{