refactor stellar stat

This commit is contained in:
luwenpeng
2024-06-25 14:08:33 +08:00
parent 076b3c7b0b
commit 276bdd1b99
11 changed files with 331 additions and 520 deletions

View File

@@ -32,7 +32,7 @@ struct dumpfile_io
pcap_t *pcap;
struct lock_free_queue *queue[MAX_THREAD_NUM];
struct io_stat stat[MAX_THREAD_NUM];
struct packet_io_stat stat[MAX_THREAD_NUM];
uint64_t io_thread_need_exit;
uint64_t io_thread_is_runing;
uint64_t io_thread_wait_exit;
@@ -385,7 +385,7 @@ int dumpfile_io_init(struct dumpfile_io *handle, uint16_t thr_idx)
int dumpfile_io_ingress(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts)
{
struct lock_free_queue *queue = handle->queue[thr_idx];
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
struct pcap_pkt *pcap_pkt = NULL;
struct packet *pkt;
int nr_parsed = 0;
@@ -421,7 +421,7 @@ void dumpfile_io_egress(struct dumpfile_io *handle, uint16_t thr_idx, struct pac
{
int len;
struct packet *pkt = NULL;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -446,7 +446,7 @@ void dumpfile_io_egress(struct dumpfile_io *handle, uint16_t thr_idx, struct pac
void dumpfile_io_drop(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts)
{
struct packet *pkt = NULL;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -466,7 +466,7 @@ int dumpfile_io_inject(struct dumpfile_io *handle, uint16_t thr_idx, struct pack
{
int len;
struct packet *pkt = NULL;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -495,7 +495,7 @@ void dumpfile_io_yield(struct dumpfile_io *handle, uint16_t thr_idx, uint64_t ti
return;
}
struct io_stat *dumpfile_io_stat(struct dumpfile_io *handle, uint16_t thr_idx)
struct packet_io_stat *dumpfile_io_stat(struct dumpfile_io *handle, uint16_t thr_idx)
{
return &handle->stat[thr_idx];
}

View File

@@ -18,7 +18,7 @@ void dumpfile_io_egress(struct dumpfile_io *handle, uint16_t thr_idx, struct pac
void dumpfile_io_drop(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
int dumpfile_io_inject(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
void dumpfile_io_yield(struct dumpfile_io *handle, uint16_t thr_idx, uint64_t timeout_ms);
struct io_stat *dumpfile_io_stat(struct dumpfile_io *handle, uint16_t thr_idx);
struct packet_io_stat *dumpfile_io_stat(struct dumpfile_io *handle, uint16_t thr_idx);
#ifdef __cplusplus
}

View File

@@ -19,7 +19,7 @@ struct marsio_io
struct mr_vdev *mr_dev;
struct mr_sendpath *mr_path;
struct io_stat stat[MAX_THREAD_NUM];
struct packet_io_stat stat[MAX_THREAD_NUM];
};
/******************************************************************************
@@ -263,7 +263,7 @@ int marsio_io_ingress(struct marsio_io *handle, uint16_t thr_idx, struct packet
struct packet *pkt;
marsio_buff_t *mbuff;
marsio_buff_t *rx_buffs[RX_BURST_MAX];
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
int nr_recv;
int nr_parsed = 0;
int len;
@@ -321,7 +321,7 @@ void marsio_io_egress(struct marsio_io *handle, uint16_t thr_idx, struct packet
{
struct packet *pkt;
marsio_buff_t *mbuff;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
int len;
for (int i = 0; i < nr_pkts; i++)
@@ -356,7 +356,7 @@ void marsio_io_drop(struct marsio_io *handle, uint16_t thr_idx, struct packet *p
{
struct packet *pkt;
marsio_buff_t *mbuff;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -379,7 +379,7 @@ int marsio_io_inject(struct marsio_io *handle, uint16_t thr_idx, struct packet *
char *ptr;
struct packet *pkt;
marsio_buff_t *mbuff;
struct io_stat *stat = &handle->stat[thr_idx];
struct packet_io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -423,7 +423,7 @@ void marsio_io_yield(struct marsio_io *handle, uint16_t thr_idx, uint64_t timeou
marsio_poll_wait(handle->mr_ins, vdevs, 1, thr_idx, timeout_ms);
}
struct io_stat *marsio_io_stat(struct marsio_io *handle, uint16_t thr_idx)
struct packet_io_stat *marsio_io_stat(struct marsio_io *handle, uint16_t thr_idx)
{
return &handle->stat[thr_idx];
}

View File

@@ -17,7 +17,7 @@ void marsio_io_egress(struct marsio_io *handle, uint16_t thr_idx, struct packet
void marsio_io_drop(struct marsio_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
int marsio_io_inject(struct marsio_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
void marsio_io_yield(struct marsio_io *handle, uint16_t thr_idx, uint64_t timeout_ms);
struct io_stat *marsio_io_stat(struct marsio_io *handle, uint16_t thr_idx);
struct packet_io_stat *marsio_io_stat(struct marsio_io *handle, uint16_t thr_idx);
#ifdef __cplusplus
}

View File

@@ -141,7 +141,7 @@ void packet_io_yield(struct packet_io *packet_io, uint16_t thr_idx, uint64_t tim
}
}
struct io_stat *packet_io_stat(struct packet_io *packet_io, uint16_t thr_idx)
struct packet_io_stat *packet_io_stat(struct packet_io *packet_io, uint16_t thr_idx)
{
if (likely(packet_io->mode == PACKET_IO_MARSIO))
{

View File

@@ -9,7 +9,7 @@ extern "C"
#include "macro.h"
struct io_stat
struct packet_io_stat
{
// device packet
uint64_t dev_rx_pkts;
@@ -77,7 +77,7 @@ void packet_io_egress(struct packet_io *packet_io, uint16_t thr_idx, struct pack
void packet_io_drop(struct packet_io *packet_io, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
int packet_io_inject(struct packet_io *packet_io, uint16_t thr_idx, struct packet *pkts, int nr_pkts);
void packet_io_yield(struct packet_io *packet_io, uint16_t thr_idx, uint64_t timeout_ms);
struct io_stat *packet_io_stat(struct packet_io *packet_io, uint16_t thr_idx);
struct packet_io_stat *packet_io_stat(struct packet_io *packet_io, uint16_t thr_idx);
#ifdef __cplusplus
}