perf: throughput_metrics_inc禁用原子操作,并改为inline
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user