TSG-23378 TFE移除平台层的FieldStat2,为适配AArch64做准备

This commit is contained in:
luwenpeng
2024-11-13 14:09:03 +08:00
parent aa98cf915e
commit 3d99178958
18 changed files with 223 additions and 336 deletions

View File

@@ -28,7 +28,8 @@ static void stat_output_cb(evutil_socket_t fd, short what, void *arg)
struct traffic_mirror_stat *handle = (struct traffic_mirror_stat *)arg;
for (int i = 0; i < TRAFFIC_MIRR_STAT_MAX; i++)
{
FS_operate(handle->fs_handle, handle->stat_idx[i], 0, FS_OP_SET, ATOMIC_READ(&(handle->stat_val[i])));
long long delta = ATOMIC_EXCHANGE(&(handle->stat_val[i]), 0);
fieldstat_easy_counter_incrby(handle->fs_handle, 0, handle->stat_idx[i], NULL, 0, delta);
}
}
@@ -40,7 +41,6 @@ struct traffic_mirror_stat *traffic_mirror_stat_new()
return NULL;
}
struct timeval gc_delay = {5, 0};
const char *stat_name[TRAFFIC_MIRR_STAT_MAX] = { 0 };
stat_name[TRAFFIC_MIRR_STAT_SUCC_BYTES] = "mirr_succ_B";
stat_name[TRAFFIC_MIRR_STAT_SUCC_PKTS] = "mirr_succ_P";
@@ -50,9 +50,10 @@ struct traffic_mirror_stat *traffic_mirror_stat_new()
handle->evbase = tfe_proxy_get_gc_evbase();
for (int i = 0; i < TRAFFIC_MIRR_STAT_MAX; i++)
{
handle->stat_idx[i] = FS_register(handle->fs_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, stat_name[i]);
handle->stat_idx[i] = fieldstat_easy_register_counter(handle->fs_handle, stat_name[i]);
}
handle->ev = event_new(handle->evbase, -1, EV_PERSIST, stat_output_cb, handle);
struct timeval gc_delay = {0, 500 * 1000}; // Microseconds, we set 500 miliseconds here.
evtimer_add(handle->ev, &gc_delay);
return handle;

View File

@@ -6,6 +6,8 @@
#include <marsio.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#define __FAVOR_BSD 1
#include <netinet/tcp.h>
struct traffic_mirror_rebuild
{