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

@@ -36,34 +36,6 @@ TEST(UTILS, FIXED_NUM_ARRAY)
EXPECT_TRUE(mutable_array_count_elem(&array) == 0);
}
TEST(UTILS, SIDS)
{
struct sids src;
struct sids dst;
for (int i = 0; i < MR_SID_LIST_MAXLEN; i++)
{
src.elems[i] = i;
}
src.num = MR_SID_LIST_MAXLEN;
sids_copy(&dst, &src);
EXPECT_TRUE(dst.num == src.num);
for (int i = 0; i < MR_SID_LIST_MAXLEN; i++)
{
EXPECT_TRUE(dst.elems[i] == i);
}
}
TEST(UTILS, THROUGHPUT_METRICS)
{
struct throughput_metrics iterm = {.n_pkts = 0, .n_bytes = 0};
throughput_metrics_inc(&iterm, 1, 2);
EXPECT_TRUE(iterm.n_pkts == 1);
EXPECT_TRUE(iterm.n_bytes == 2);
}
TEST(UTILS, DEVICE)
{
const char *dev_name = "lo";