X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist_triggers.c;h=8be31933629a27ba8f92bd79f72d3b66da2f4c08;hb=57739a6b3247c7ded74522906e214eff0d6dc14c;hp=91ff1c06850222584bcdb9b3d721bee5f7fd101d;hpb=481c5310f698d32187c0f20bd0d1da3b8b696b06;p=lttng-tools.git diff --git a/src/bin/lttng/commands/list_triggers.c b/src/bin/lttng/commands/list_triggers.c index 91ff1c068..8be319336 100644 --- a/src/bin/lttng/commands/list_triggers.c +++ b/src/bin/lttng/commands/list_triggers.c @@ -18,6 +18,8 @@ #include "lttng/condition/on-event-internal.h" /* For lttng_domain_type_str(). */ #include "lttng/domain-internal.h" +/* For lttng_event_rule_syscall_emission_site_str() */ +#include "lttng/event-rule/syscall-internal.h" #include "../loglevel.h" #include @@ -39,6 +41,81 @@ struct argpar_opt_descr list_trigger_options[] = { ARGPAR_OPT_DESCR_SENTINEL, }; +static void print_condition_session_consumed_size( + const struct lttng_condition *condition) +{ + enum lttng_condition_status condition_status; + const char *session_name; + uint64_t threshold; + + condition_status = + lttng_condition_session_consumed_size_get_session_name( + condition, &session_name); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + lttng_condition_session_consumed_size_get_threshold( + condition, &threshold); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + MSG(" session name: %s", session_name); + MSG(" threshold: %" PRIu64 " bytes", threshold); +} + +static void print_condition_buffer_usage( + const struct lttng_condition *condition) +{ + enum lttng_condition_status condition_status; + const char *session_name, *channel_name; + enum lttng_domain_type domain_type; + uint64_t threshold; + + condition_status = lttng_condition_buffer_usage_get_session_name( + condition, &session_name); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + condition_status = lttng_condition_buffer_usage_get_channel_name( + condition, &channel_name); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + condition_status = lttng_condition_buffer_usage_get_domain_type( + condition, &domain_type); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + MSG(" session name: %s", session_name); + MSG(" channel name: %s", channel_name); + MSG(" domain: %s", lttng_domain_type_str(domain_type)); + + condition_status = lttng_condition_buffer_usage_get_threshold( + condition, &threshold); + if (condition_status == LTTNG_CONDITION_STATUS_OK) { + MSG(" threshold (bytes): %" PRIu64, threshold); + } else { + double threshold_ratio; + + assert(condition_status == LTTNG_CONDITION_STATUS_UNSET); + + condition_status = + lttng_condition_buffer_usage_get_threshold_ratio( + condition, &threshold_ratio); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + MSG(" threshold (ratio): %.2f", threshold_ratio); + } +} + +static void print_condition_session_rotation( + const struct lttng_condition *condition) +{ + enum lttng_condition_status condition_status; + const char *session_name; + + condition_status = lttng_condition_session_rotation_get_session_name( + condition, &session_name); + assert(condition_status == LTTNG_CONDITION_STATUS_OK); + + MSG(" session name: %s", session_name); +} + /* * Returns the human-readable log level name associated with a numerical value * if there is one. The Log4j and JUL domains have discontinuous log level @@ -312,14 +389,20 @@ void print_event_rule_syscall(const struct lttng_event_rule *event_rule) { const char *pattern, *filter; enum lttng_event_rule_status event_rule_status; + enum lttng_event_rule_syscall_emission_site_type emission_site_type; assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_SYSCALL); + emission_site_type = + lttng_event_rule_syscall_get_emission_site_type(event_rule); + event_rule_status = lttng_event_rule_syscall_get_pattern( event_rule, &pattern); assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK); - _MSG(" rule: %s (type: syscall", pattern); + _MSG(" rule: %s (type: syscall:%s", pattern, + lttng_event_rule_syscall_emission_site_str( + emission_site_type)); event_rule_status = lttng_event_rule_syscall_get_filter( event_rule, &filter); @@ -823,12 +906,22 @@ void print_one_trigger(const struct lttng_trigger *trigger) condition_type = lttng_condition_get_type(condition); MSG(" condition: %s", lttng_condition_type_str(condition_type)); switch (condition_type) { + case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE: + print_condition_session_consumed_size(condition); + break; + case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH: + case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW: + print_condition_buffer_usage(condition); + break; + case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING: + case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: + print_condition_session_rotation(condition); + break; case LTTNG_CONDITION_TYPE_ON_EVENT: print_condition_on_event(condition); break; default: - MSG(" (condition type not handled in %s)", __func__); - break; + abort(); } action = lttng_trigger_get_const_action(trigger);