diff options
Diffstat (limited to 'shaping/include/shaper_stat.h')
| -rw-r--r-- | shaping/include/shaper_stat.h | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/shaping/include/shaper_stat.h b/shaping/include/shaper_stat.h index 93183f8..30d869e 100644 --- a/shaping/include/shaper_stat.h +++ b/shaping/include/shaper_stat.h @@ -1,9 +1,9 @@ #include <netinet/in.h> #include "uthash.h" +#include <MESA/fieldstat.h> +#define SHAPER_STAT_COLUMN_NUM_MAX 20 struct shaping_stat_data_dir { - unsigned long long rx_pkts; - unsigned long long rx_bytes; unsigned long long tx_pkts; unsigned long long tx_bytes; unsigned long long drop_pkts; @@ -27,22 +27,52 @@ struct shaping_stat_data { UT_hash_handle hh; }; +#if 0 struct shaping_stat { int sock_fd; struct sockaddr_in sock_addr; struct timespec update_time; struct shaping_stat_data *stat_hashtbl; }; +#endif -void shaper_stat_send_free(struct shaping_stat *stat); -void shaper_stat_send(struct shaping_stat *stat, struct shaping_stat_data **stat_hashtbl); -struct shaping_stat* shaper_stat_new(char *telegraf_ip, short telegraf_port); - -void shaper_stat_queueing_pkt_inc(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type); -void shaper_stat_queueing_pkt_dec(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type); -void shaper_stat_forward_inc(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type); -void shaper_stat_forward_all_rule_inc(struct shaping_stat_data **stat_hashtbl, struct shaping_flow *sf, unsigned char direction, int pkt_len); -void shaper_stat_drop_inc(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len); -void shaper_stat_queueing_session_inc(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, int profile_type); -void shaper_stat_queueing_session_dec(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, int profile_type); -void shaper_stat_max_latency_update(struct shaping_stat_data **stat_hashtbl, int rule_id, int profile_id, int priority, unsigned char direction, unsigned long long latency, int profile_type);
\ No newline at end of file +enum shaping_stat_tags_index { + TAG_RULE_ID_IDX = 0, + TAG_PROFILE_ID_IDX, + TAG_PRIORITY_IDX, + TAG_PROFILE_TYPE_IDX, + TAG_IDX_MAX +}; + +enum shaping_stat_column_index { + QUEUEING_SESSIONS_IDX = 0, + IN_MAX_LATENCY_IDX, + IN_QUEUE_LEN_IDX, + OUT_MAX_LATENCY_IDX, + OUT_QUEUE_LEN_IDX, + IN_PKTS_IDX, + IN_BYTES_IDX, + IN_DROP_PKTS_IDX, + OUT_PKTS_IDX, + OUT_BYTES_IDX, + OUT_DROP_PKTS_IDX, + STAT_COLUNM_IDX_MAX +}; + +struct shaping_stat { + struct fieldstat_dynamic_instance *instance; + int table_id; + unsigned int column_ids[STAT_COLUNM_IDX_MAX]; +}; + +void shaper_stat_destroy(struct shaping_stat *stat); +struct shaping_stat* shaper_stat_init(int thread_num); + +void shaper_stat_queueing_pkt_inc(struct shaping_stat *stat, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type, int thread_id); +void shaper_stat_queueing_pkt_dec(struct shaping_stat *stat, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type, int thread_id); +void shaper_stat_forward_inc(struct shaping_stat *stat, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int profile_type, int thread_id); +void shaper_stat_forward_all_rule_inc(struct shaping_stat *stat, struct shaping_flow *sf, unsigned char direction, int pkt_len, int thread_id); +void shaper_stat_drop_inc(struct shaping_stat *stat, int rule_id, int profile_id, int priority, unsigned char direction, int pkt_len, int thread_id); +void shaper_stat_queueing_session_inc(struct shaping_stat *stat, int rule_id, int profile_id, int priority, int profile_type, int thread_id); +void shaper_stat_queueing_session_dec(struct shaping_stat *stat, int rule_id, int profile_id, int priority, int profile_type, int thread_id); +void shaper_stat_max_latency_update(struct shaping_stat *stat, int rule_id, int profile_id, int priority, unsigned char direction, unsigned long long latency, int profile_type, int thread_id);
\ No newline at end of file |
