perf: throughput_metrics_inc禁用原子操作,并改为inline

This commit is contained in:
luwenpeng
2023-06-01 17:24:05 +08:00
parent 8afad45a40
commit f00ef65963
2 changed files with 5 additions and 7 deletions

View File

@@ -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_destory(struct packet_io_fs *handle);
void packet_io_fs_dump(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 #ifdef __cpluscplus
} }

View File

@@ -136,12 +136,6 @@ static const char *stat_map[] =
* throughput_metrics * 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) struct packet_io_fs *packet_io_fs_create(const char *profile)
{ {
int value=0; int value=0;