适配fieldstat3新接口(节约10%); 减少strlen的调用(节约2%); 优化栈变量的初始化(节约1%),累计节约13%CPU

This commit is contained in:
liuxueli
2023-06-14 15:01:51 +08:00
parent db8ec7078f
commit 5b3ae38b3f
13 changed files with 261 additions and 154 deletions

View File

@@ -757,6 +757,8 @@ TEST(TSG_Table, TSG_SECURITY_SOURCE_LOCATION)
struct location_info location = {0};
location.country_full = (char *)"country_full_test";
location.city_full = (char *)"city_full_test";
location.full_location=(char *)"country_full_test..city_full_test.";
location.full_location_len=strlen(location.full_location);
struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum);
struct maat_rule results[MAX_RESULT_NUM] = {0};
EXPECT_EQ(tsg_scan_ip_location((const struct streaminfo *)&a_stream, g_tsg_maat_feather, &location, MAAT_SCAN_SRC_LOCATION, mid, results, MAX_RESULT_NUM), 1);
@@ -772,6 +774,8 @@ TEST(TSG_Table, TSG_SECURITY_DESTINATION_LOCATION)
struct location_info location = {0};
location.country_full = (char *)"country_full_test";
location.city_full = (char *)"city_full_test";
location.full_location=(char *)"country_full_test..city_full_test.";
location.full_location_len=strlen(location.full_location);
struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum);
struct maat_rule results[MAX_RESULT_NUM] = {0};
EXPECT_EQ(tsg_scan_ip_location((const struct streaminfo *)&a_stream, g_tsg_maat_feather, &location, MAAT_SCAN_DST_LOCATION, mid, results, MAX_RESULT_NUM), 1);