From f00ef6596352b4e39f32df1c8be55de1e1a7deec Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Thu, 1 Jun 2023 17:24:05 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20throughput=5Fmetrics=5Finc=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E5=8E=9F=E5=AD=90=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=94=B9=E4=B8=BAinline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/include/tfe_packet_io_fs.h | 6 +++++- common/src/tfe_packet_io_fs.cpp | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/common/include/tfe_packet_io_fs.h b/common/include/tfe_packet_io_fs.h index d05c992..6bea391 100644 --- a/common/include/tfe_packet_io_fs.h +++ b/common/include/tfe_packet_io_fs.h @@ -58,7 +58,11 @@ struct packet_io_fs *packet_io_fs_create(const char *profile); void packet_io_fs_destory(struct packet_io_fs *handle); void packet_io_fs_dump(struct packet_io_fs *handle); -void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes); +void inline throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes) +{ + iterm->n_bytes += n_bytes; + iterm->n_pkts += n_pkts; +} #ifdef __cpluscplus } diff --git a/common/src/tfe_packet_io_fs.cpp b/common/src/tfe_packet_io_fs.cpp index 0ac23bd..42427e5 100644 --- a/common/src/tfe_packet_io_fs.cpp +++ b/common/src/tfe_packet_io_fs.cpp @@ -136,12 +136,6 @@ static const char *stat_map[] = * throughput_metrics ******************************************************************************/ -void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes) -{ - __atomic_fetch_add(&iterm->n_bytes, n_bytes, __ATOMIC_RELAXED); - __atomic_fetch_add(&iterm->n_pkts, n_pkts, __ATOMIC_RELAXED); -} - struct packet_io_fs *packet_io_fs_create(const char *profile) { int value=0;