version 1.1.1.1, 2014/07/30 07:55:27
|
version 1.1.1.2, 2019/10/21 14:58:35
|
Line 111 int attr_def_add(const char *name, const char *desc, s
|
Line 111 int attr_def_add(const char *name, const char *desc, s
|
return def->ad_id; |
return def->ad_id; |
} |
} |
|
|
void attr_def_free(struct attr_def *def) | static void attr_def_free(struct attr_def *def) |
{ |
{ |
if (!def) |
if (!def) |
return; |
return; |
Line 524 static float __calc_usage(double rate, uint64_t max)
|
Line 524 static float __calc_usage(double rate, uint64_t max)
|
return 100.0f / ((double) max / (rate * cfg_rate_interval)); |
return 100.0f / ((double) max / (rate * cfg_rate_interval)); |
} |
} |
|
|
|
uint64_t rate_get_total(struct rate *r) |
|
{ |
|
return r->r_total - r->r_reset; |
|
} |
|
|
void attr_calc_usage(struct attr *a, float *rx, float *tx, |
void attr_calc_usage(struct attr *a, float *rx, float *tx, |
uint64_t rxmax, uint64_t txmax) |
uint64_t rxmax, uint64_t txmax) |
{ |
{ |
Line 623 void attr_notify_update(struct attr *a, timestamp_t *t
|
Line 628 void attr_notify_update(struct attr *a, timestamp_t *t
|
|
|
list_for_each_entry(h, &a->a_history_list, h_list) |
list_for_each_entry(h, &a->a_history_list, h_list) |
history_update(a, h, ts); |
history_update(a, h, ts); |
|
} |
|
} |
|
|
|
void attr_reset_counter(struct attr *a) |
|
{ |
|
if (a->a_def->ad_type == ATTR_TYPE_COUNTER) { |
|
a->a_rx_rate.r_reset = a->a_rx_rate.r_total; |
|
a->a_tx_rate.r_reset = a->a_tx_rate.r_total; |
} |
} |
} |
} |
|
|