X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Factions%2Frate-policy.c;h=c47e17018debebb7a27bdb2d4371c40b188c4bbf;hb=f895927f329180ca1e6f4426e9d3c6250ae698ba;hp=8e05a3ecc59f338348528063965bff58ece8d89e;hpb=6a751b953a43c566b74818ec6325db0978e16c66;p=lttng-tools.git diff --git a/src/common/actions/rate-policy.c b/src/common/actions/rate-policy.c index 8e05a3ecc..c47e17018 100644 --- a/src/common/actions/rate-policy.c +++ b/src/common/actions/rate-policy.c @@ -5,7 +5,6 @@ * */ -#include #include #include #include @@ -89,7 +88,6 @@ static bool lttng_rate_policy_every_n_should_execute( static bool lttng_rate_policy_once_after_n_should_execute( const struct lttng_rate_policy *policy, uint64_t counter); -LTTNG_HIDDEN const char *lttng_rate_policy_type_string( enum lttng_rate_policy_type rate_policy_type) { @@ -109,7 +107,6 @@ enum lttng_rate_policy_type lttng_rate_policy_get_type( return policy ? policy->type : LTTNG_RATE_POLICY_TYPE_UNKNOWN; } -LTTNG_HIDDEN void lttng_rate_policy_init(struct lttng_rate_policy *rate_policy, enum lttng_rate_policy_type type, rate_policy_serialize_cb serialize, @@ -135,7 +132,6 @@ void lttng_rate_policy_destroy(struct lttng_rate_policy *rate_policy) rate_policy->destroy(rate_policy); } -LTTNG_HIDDEN int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy, struct lttng_payload *payload) { @@ -232,7 +228,6 @@ end: return consumed_len; } -LTTNG_HIDDEN ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view, struct lttng_rate_policy **rate_policy) { @@ -296,7 +291,7 @@ ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view, goto end; } - assert(*rate_policy); + LTTNG_ASSERT(*rate_policy); consumed_len = sizeof(struct lttng_rate_policy_comm) + specific_rate_policy_consumed_len; @@ -305,7 +300,6 @@ end: return consumed_len; } -LTTNG_HIDDEN bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a, const struct lttng_rate_policy *b) { @@ -324,13 +318,12 @@ bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a, goto end; } - assert(a->equal); + LTTNG_ASSERT(a->equal); is_equal = a->equal(a, b); end: return is_equal; } -LTTNG_HIDDEN bool lttng_rate_policy_should_execute( const struct lttng_rate_policy *policy, uint64_t counter) { @@ -351,7 +344,7 @@ bool lttng_rate_policy_should_execute( static struct lttng_rate_policy_every_n *rate_policy_every_n_from_rate_policy( struct lttng_rate_policy *policy) { - assert(policy); + LTTNG_ASSERT(policy); return container_of(policy, struct lttng_rate_policy_every_n, parent); } @@ -360,7 +353,7 @@ static const struct lttng_rate_policy_every_n * rate_policy_every_n_from_rate_policy_const( const struct lttng_rate_policy *policy) { - assert(policy); + LTTNG_ASSERT(policy); return container_of(policy, struct lttng_rate_policy_every_n, parent); } @@ -373,8 +366,8 @@ static int lttng_rate_policy_every_n_serialize( struct lttng_rate_policy_every_n *every_n_policy; struct lttng_rate_policy_every_n_comm comm = {}; - assert(policy); - assert(payload); + LTTNG_ASSERT(policy); + LTTNG_ASSERT(payload); every_n_policy = rate_policy_every_n_from_rate_policy(policy); comm.interval = every_n_policy->interval; @@ -445,9 +438,9 @@ static enum lttng_error_code lttng_rate_policy_every_n_mi_serialize( enum lttng_error_code ret_code; const struct lttng_rate_policy_every_n *every_n_policy = NULL; - assert(rate_policy); - assert(IS_EVERY_N_RATE_POLICY(rate_policy)); - assert(writer); + LTTNG_ASSERT(rate_policy); + LTTNG_ASSERT(IS_EVERY_N_RATE_POLICY(rate_policy)); + LTTNG_ASSERT(writer); every_n_policy = rate_policy_every_n_from_rate_policy_const( rate_policy); @@ -516,7 +509,6 @@ end: return _policy; } -LTTNG_HIDDEN enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval( const struct lttng_rate_policy *policy, uint64_t *interval) { @@ -540,7 +532,7 @@ static bool lttng_rate_policy_every_n_should_execute( const struct lttng_rate_policy *policy, uint64_t counter) { const struct lttng_rate_policy_every_n *every_n_policy; - assert(policy); + LTTNG_ASSERT(policy); bool execute = false; every_n_policy = rate_policy_every_n_from_rate_policy_const(policy); @@ -564,7 +556,7 @@ static bool lttng_rate_policy_every_n_should_execute( static struct lttng_rate_policy_once_after_n * rate_policy_once_after_n_from_rate_policy(struct lttng_rate_policy *policy) { - assert(policy); + LTTNG_ASSERT(policy); return container_of( policy, struct lttng_rate_policy_once_after_n, parent); @@ -574,7 +566,7 @@ static const struct lttng_rate_policy_once_after_n * rate_policy_once_after_n_from_rate_policy_const( const struct lttng_rate_policy *policy) { - assert(policy); + LTTNG_ASSERT(policy); return container_of( policy, struct lttng_rate_policy_once_after_n, parent); @@ -587,8 +579,8 @@ static int lttng_rate_policy_once_after_n_serialize( struct lttng_rate_policy_once_after_n *once_after_n_policy; struct lttng_rate_policy_once_after_n_comm comm = {}; - assert(policy); - assert(payload); + LTTNG_ASSERT(policy); + LTTNG_ASSERT(payload); once_after_n_policy = rate_policy_once_after_n_from_rate_policy(policy); comm.threshold = once_after_n_policy->threshold; @@ -662,9 +654,9 @@ static enum lttng_error_code lttng_rate_policy_once_after_n_mi_serialize( enum lttng_error_code ret_code; const struct lttng_rate_policy_once_after_n *once_after_n_policy = NULL; - assert(rate_policy); - assert(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy)); - assert(writer); + LTTNG_ASSERT(rate_policy); + LTTNG_ASSERT(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy)); + LTTNG_ASSERT(writer); once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const( rate_policy); @@ -733,7 +725,6 @@ end: return _policy; } -LTTNG_HIDDEN enum lttng_rate_policy_status lttng_rate_policy_once_after_n_get_threshold( const struct lttng_rate_policy *policy, uint64_t *threshold) { @@ -754,11 +745,10 @@ end: return status; } -LTTNG_HIDDEN struct lttng_rate_policy *lttng_rate_policy_copy( const struct lttng_rate_policy *source) { - assert(source->copy); + LTTNG_ASSERT(source->copy); return source->copy(source); } @@ -767,7 +757,7 @@ static bool lttng_rate_policy_once_after_n_should_execute( { const struct lttng_rate_policy_once_after_n *once_after_n_policy; bool execute = false; - assert(policy); + LTTNG_ASSERT(policy); once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(policy); @@ -782,7 +772,6 @@ static bool lttng_rate_policy_once_after_n_should_execute( return counter == once_after_n_policy->threshold; } -LTTNG_HIDDEN enum lttng_error_code lttng_rate_policy_mi_serialize( const struct lttng_rate_policy *rate_policy, struct mi_writer *writer) @@ -790,9 +779,9 @@ enum lttng_error_code lttng_rate_policy_mi_serialize( int ret; enum lttng_error_code ret_code; - assert(rate_policy); - assert(writer); - assert(rate_policy->mi_serialize); + LTTNG_ASSERT(rate_policy); + LTTNG_ASSERT(writer); + LTTNG_ASSERT(rate_policy->mi_serialize); /* Open rate policy element. */ ret = mi_lttng_writer_open_element(