perf: 优化session_ctx减少内存占用; 优化global metrics的结构

This commit is contained in:
luwenpeng
2023-11-24 15:17:18 +08:00
parent bda50d79af
commit eedd18183e
12 changed files with 331 additions and 439 deletions

View File

@@ -52,49 +52,6 @@ int mutable_array_count_elem(struct mutable_array *array);
int mutable_array_exist_elem(struct mutable_array *array, uint64_t elem);
int mutable_array_index_elem(struct mutable_array *array, int index);
/******************************************************************************
* sids
******************************************************************************/
typedef uint16_t sid_t;
#define MR_SID_LIST_MAXLEN 8
struct sids
{
int num;
sid_t elems[MR_SID_LIST_MAXLEN];
};
void sids_copy(struct sids *dst, struct sids *src);
/******************************************************************************
* route_ctx
******************************************************************************/
struct route_ctx
{
char data[64];
int len;
};
void route_ctx_copy(struct route_ctx *dst, struct route_ctx *src);
/******************************************************************************
* throughput_metrics
******************************************************************************/
struct throughput_metrics
{
uint64_t n_pkts;
uint64_t n_bytes;
};
static inline void 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;
}
/******************************************************************************
* device
******************************************************************************/