[optimize]shrink repository size
This commit is contained in:
@@ -459,73 +459,6 @@ TEST_F(IPPortPluginTable, WITH_256SAME_IP) {
|
||||
scan_per_second);
|
||||
}
|
||||
|
||||
TEST_F(IPPortPluginTable, TSG_DYN_IPPORT_MAPPING) {
|
||||
char redis_ip[32] = "127.0.0.1";
|
||||
int redis_port = 6379;
|
||||
int redis_db = 0;
|
||||
struct log_handle *logger = IPPortPluginTable::logger;
|
||||
|
||||
int ret = write_config_to_redis(redis_ip, redis_port, redis_db, logger);
|
||||
assert(ret == 0);
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_logger(opts, log_file, LOG_LEVEL_INFO);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_rule_update_checking_interval_ms(opts, 100);
|
||||
|
||||
struct maat *maat_inst = maat_new(opts, table_info_path);
|
||||
assert(maat_inst);
|
||||
maat_options_free(opts);
|
||||
|
||||
int ex_data_counter = 0;
|
||||
const char *table_name = "TSG_DYN_IPPORT_SUBSCRIBER_MAPPING";
|
||||
|
||||
int table_id = maat_get_table_id(maat_inst, table_name);
|
||||
ASSERT_GT(table_id, 0);
|
||||
|
||||
ret = maat_plugin_table_ex_schema_register(maat_inst, table_name,
|
||||
ipport_plugin_ex_new_cb,
|
||||
ipport_plugin_ex_free_cb,
|
||||
ipport_plugin_ex_dup_cb,
|
||||
0, &ex_data_counter);
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
int i = 0;
|
||||
pthread_t threads[2];
|
||||
struct thread_param thread_params[2];
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
thread_params[i].maat_inst = maat_inst;
|
||||
thread_params[i].thread_id = i;
|
||||
thread_params[i].table_name = table_name;
|
||||
thread_params[i].port = 45568;
|
||||
thread_params[i].test_count = PERF_SCAN_COUNT;
|
||||
thread_params[i].time_elapse_ms = 0;
|
||||
thread_params[i].logger = logger;
|
||||
}
|
||||
|
||||
pthread_create(&threads[0], NULL, ipport_plugin_scan_thread, thread_params);
|
||||
pthread_create(&threads[1], NULL, ipport_plugin_update_thread, thread_params + 1);
|
||||
|
||||
int *is_all_hit = NULL;
|
||||
long long time_elapse_ms = 0;
|
||||
long long scan_per_second = 0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
pthread_join(threads[i], (void **)&is_all_hit);
|
||||
time_elapse_ms += thread_params[i].time_elapse_ms;
|
||||
EXPECT_EQ(*is_all_hit, 1);
|
||||
*is_all_hit = 0;
|
||||
free(is_all_hit);
|
||||
}
|
||||
maat_free(maat_inst);
|
||||
|
||||
scan_per_second = PERF_SCAN_COUNT * 1000 / time_elapse_ms;
|
||||
log_info(maat_inst->logger, MODULE_IPPORT_PLUGIN_GTEST,
|
||||
"IpportPluginScan TSG_DYN_IPPORT_SUBSCRIBER_MAPPING match rate speed %lld lookups/s/thread",
|
||||
scan_per_second);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
Reference in New Issue
Block a user