{
enum lttng_action_type action_type;
enum lttng_action_status action_status;
+ const struct lttng_rate_policy *policy = NULL;
const char *value;
action_type = lttng_action_get_type(action);
switch (action_type) {
case LTTNG_ACTION_TYPE_NOTIFY:
- MSG("notify");
+ _MSG("notify");
+
+ action_status = lttng_action_notify_get_rate_policy(
+ action, &policy);
+ if (action_status != LTTNG_ACTION_STATUS_OK) {
+ ERR("Failed to retrieve rate policy.");
+ goto end;
+ }
break;
case LTTNG_ACTION_TYPE_START_SESSION:
action_status = lttng_action_start_session_get_session_name(
action, &value);
assert(action_status == LTTNG_ACTION_STATUS_OK);
- MSG("start session `%s`", value);
+ _MSG("start session `%s`", value);
+
+ action_status = lttng_action_start_session_get_rate_policy(
+ action, &policy);
+ if (action_status != LTTNG_ACTION_STATUS_OK) {
+ ERR("Failed to retrieve rate policy.");
+ goto end;
+ }
break;
case LTTNG_ACTION_TYPE_STOP_SESSION:
action_status = lttng_action_stop_session_get_session_name(
action, &value);
assert(action_status == LTTNG_ACTION_STATUS_OK);
- MSG("stop session `%s`", value);
+ _MSG("stop session `%s`", value);
+
+ action_status = lttng_action_stop_session_get_rate_policy(
+ action, &policy);
+ if (action_status != LTTNG_ACTION_STATUS_OK) {
+ ERR("Failed to retrieve rate policy.");
+ goto end;
+ }
break;
case LTTNG_ACTION_TYPE_ROTATE_SESSION:
action_status = lttng_action_rotate_session_get_session_name(
action, &value);
assert(action_status == LTTNG_ACTION_STATUS_OK);
- MSG("rotate session `%s`", value);
+ _MSG("rotate session `%s`", value);
+
+ action_status = lttng_action_rotate_session_get_rate_policy(
+ action, &policy);
+ if (action_status != LTTNG_ACTION_STATUS_OK) {
+ ERR("Failed to retrieve rate policy.");
+ goto end;
+ }
break;
case LTTNG_ACTION_TYPE_SNAPSHOT_SESSION:
{
}
}
- MSG("");
+ action_status = lttng_action_snapshot_session_get_rate_policy(
+ action, &policy);
+ if (action_status != LTTNG_ACTION_STATUS_OK) {
+ ERR("Failed to retrieve rate policy.");
+ goto end;
+ }
break;
}
-
default:
abort();
}
+
+ if (policy) {
+ enum lttng_rate_policy_type policy_type;
+ enum lttng_rate_policy_status policy_status;
+ uint64_t policy_value = 0;
+
+ policy_type = lttng_rate_policy_get_type(policy);
+
+ switch (policy_type) {
+ case LTTNG_RATE_POLICY_TYPE_EVERY_N:
+ policy_status = lttng_rate_policy_every_n_get_interval(
+ policy, &policy_value);
+ if (policy_status != LTTNG_RATE_POLICY_STATUS_OK) {
+ ERR("Failed to get action rate policy interval");
+ goto end;
+ }
+ if (policy_value > 1) {
+ /* The default is 1 so print only when it is a
+ * special case.
+ */
+ _MSG(", rate policy: after every %" PRIu64
+ " occurrences",
+ policy_value);
+ }
+ break;
+ case LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N:
+ policy_status = lttng_rate_policy_once_after_n_get_threshold(
+ policy, &policy_value);
+ if (policy_status != LTTNG_RATE_POLICY_STATUS_OK) {
+ ERR("Failed to get action rate policy interval");
+ goto end;
+ }
+ _MSG(", rate policy: once after %" PRIu64
+ " occurrences",
+ policy_value);
+ break;
+ default:
+ abort();
+ }
+ }
+
+ MSG("");
+end:
+ return;
}
static
enum lttng_action_type action_type;
enum lttng_trigger_status trigger_status;
const char *name;
- enum lttng_trigger_firing_policy firing_policy_type;
- uint64_t threshold;
uid_t trigger_uid;
trigger_status = lttng_trigger_get_name(trigger, &name);
MSG("- id: %s", name);
MSG(" user id: %d", trigger_uid);
- trigger_status = lttng_trigger_get_firing_policy(
- trigger, &firing_policy_type, &threshold);
- if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
- ERR("Failed to get trigger's policy.");
- goto end;
- }
-
- switch (firing_policy_type) {
- case LTTNG_TRIGGER_FIRING_POLICY_EVERY_N:
- if (threshold > 1) {
- MSG(" firing policy: after every %" PRIu64 " occurences", threshold);
- }
- break;
- case LTTNG_TRIGGER_FIRING_POLICY_ONCE_AFTER_N:
- MSG(" firing policy: once after %" PRIu64 " occurences", threshold);
- break;
- default:
- abort();
- }
-
condition = lttng_trigger_get_const_condition(trigger);
condition_type = lttng_condition_get_type(condition);
MSG(" condition: %s", lttng_condition_type_str(condition_type));
print_one_action(action);
}
-end:
- return;
}
static