Add stat of inject packet and drop packet

This commit is contained in:
luwenpeng
2024-04-30 15:25:34 +08:00
parent 611fda598f
commit e418c84b85
4 changed files with 37 additions and 0 deletions

View File

@@ -29,6 +29,14 @@ struct stat_id
int raw_tx_pkts;
int raw_tx_bytes;
// drop packet
int drop_pkts;
int drop_bytes;
// inject packet
int inject_pkts;
int inject_bytes;
// ctrl packet
int ctrl_rx_pkts;
int ctrl_rx_bytes;
@@ -130,6 +138,12 @@ struct stellar_stat *stellar_stat_new(uint16_t nr_thread)
stat->ids.raw_rx_bytes = fieldstat_easy_register_counter(stat->fs, "raw_rx_bytes");
stat->ids.raw_tx_pkts = fieldstat_easy_register_counter(stat->fs, "raw_tx_pkts");
stat->ids.raw_tx_bytes = fieldstat_easy_register_counter(stat->fs, "raw_tx_bytes");
// drop packet
stat->ids.drop_pkts = fieldstat_easy_register_counter(stat->fs, "drop_pkts");
stat->ids.drop_bytes = fieldstat_easy_register_counter(stat->fs, "drop_bytes");
// inject packet
stat->ids.inject_pkts = fieldstat_easy_register_counter(stat->fs, "inject_pkts");
stat->ids.inject_bytes = fieldstat_easy_register_counter(stat->fs, "inject_bytes");
// ctrl packet
stat->ids.ctrl_rx_pkts = fieldstat_easy_register_counter(stat->fs, "ctrl_rx_pkts");
stat->ids.ctrl_rx_bytes = fieldstat_easy_register_counter(stat->fs, "ctrl_rx_bytes");
@@ -213,6 +227,12 @@ void stellar_stat_output(struct stellar_stat *stat)
stat->io_stat.raw_tx_pkts += stat->thr_io_stat[i].raw_tx_pkts;
stat->io_stat.raw_tx_bytes += stat->thr_io_stat[i].raw_tx_bytes;
stat->io_stat.drop_pkts += stat->thr_io_stat[i].drop_pkts;
stat->io_stat.drop_bytes += stat->thr_io_stat[i].drop_bytes;
stat->io_stat.inject_pkts += stat->thr_io_stat[i].inject_pkts;
stat->io_stat.inject_bytes += stat->thr_io_stat[i].inject_bytes;
stat->io_stat.ctrl_rx_pkts += stat->thr_io_stat[i].ctrl_rx_pkts;
stat->io_stat.ctrl_rx_bytes += stat->thr_io_stat[i].ctrl_rx_bytes;
@@ -299,6 +319,12 @@ void stellar_stat_output(struct stellar_stat *stat)
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.raw_rx_bytes, NULL, 0, stat->io_stat.raw_rx_bytes);
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.raw_tx_pkts, NULL, 0, stat->io_stat.raw_tx_pkts);
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.raw_tx_bytes, NULL, 0, stat->io_stat.raw_tx_bytes);
// drop packet
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.drop_pkts, NULL, 0, stat->io_stat.drop_pkts);
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.drop_bytes, NULL, 0, stat->io_stat.drop_bytes);
// inject packet
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.inject_pkts, NULL, 0, stat->io_stat.inject_pkts);
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.inject_bytes, NULL, 0, stat->io_stat.inject_bytes);
// ctrl packet
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.ctrl_rx_pkts, NULL, 0, stat->io_stat.ctrl_rx_pkts);
fieldstat_easy_counter_set(stat->fs, 0, stat->ids.ctrl_rx_bytes, NULL, 0, stat->io_stat.ctrl_rx_bytes);