[PATCH]add expr_matcher hit pattern statistics
This commit is contained in:
@@ -39,7 +39,7 @@ struct bool_plugin_runtime {
|
||||
|
||||
long long rule_num;
|
||||
long long update_err_cnt;
|
||||
long long *scan_cnt;
|
||||
long long *scan_times;
|
||||
};
|
||||
|
||||
/* bool plugin schema API */
|
||||
@@ -199,7 +199,7 @@ void *bool_plugin_runtime_new(void *bool_plugin_schema, size_t max_thread_num,
|
||||
bool_plugin_rt->n_worker_thread = max_thread_num;
|
||||
bool_plugin_rt->ref_garbage_bin = garbage_bin;
|
||||
bool_plugin_rt->logger = logger;
|
||||
bool_plugin_rt->scan_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||
bool_plugin_rt->scan_times = alignment_int64_array_alloc(max_thread_num);
|
||||
|
||||
return bool_plugin_rt;
|
||||
}
|
||||
@@ -221,9 +221,9 @@ void bool_plugin_runtime_free(void *bool_plugin_runtime)
|
||||
bool_plugin_rt->ex_data_rt = NULL;
|
||||
}
|
||||
|
||||
if (bool_plugin_rt->scan_cnt != NULL) {
|
||||
alignment_int64_array_free(bool_plugin_rt->scan_cnt);
|
||||
bool_plugin_rt->scan_cnt = NULL;
|
||||
if (bool_plugin_rt->scan_times != NULL) {
|
||||
alignment_int64_array_free(bool_plugin_rt->scan_times);
|
||||
bool_plugin_rt->scan_times = NULL;
|
||||
}
|
||||
|
||||
FREE(bool_plugin_rt);
|
||||
@@ -583,26 +583,26 @@ long long bool_plugin_runtime_update_err_count(void *bool_plugin_runtime)
|
||||
return bool_plugin_rt->update_err_cnt;
|
||||
}
|
||||
|
||||
void bool_plugin_runtime_scan_inc(void *bool_plugin_runtime, int thread_id)
|
||||
void bool_plugin_runtime_scan_times_inc(void *bool_plugin_runtime, int thread_id)
|
||||
{
|
||||
if (NULL == bool_plugin_runtime || thread_id < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct bool_plugin_runtime *bool_plugin_rt = (struct bool_plugin_runtime *)bool_plugin_runtime;
|
||||
alignment_int64_array_add(bool_plugin_rt->scan_cnt, thread_id, 1);
|
||||
alignment_int64_array_add(bool_plugin_rt->scan_times, thread_id, 1);
|
||||
}
|
||||
|
||||
long long bool_plugin_runtime_scan_count(void *bool_plugin_runtime)
|
||||
long long bool_plugin_runtime_scan_times(void *bool_plugin_runtime)
|
||||
{
|
||||
if (NULL == bool_plugin_runtime) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct bool_plugin_runtime *bool_plugin_rt = (struct bool_plugin_runtime *)bool_plugin_runtime;
|
||||
long long sum = alignment_int64_array_sum(bool_plugin_rt->scan_cnt,
|
||||
long long sum = alignment_int64_array_sum(bool_plugin_rt->scan_times,
|
||||
bool_plugin_rt->n_worker_thread);
|
||||
alignment_int64_array_reset(bool_plugin_rt->scan_cnt, bool_plugin_rt->n_worker_thread);
|
||||
alignment_int64_array_reset(bool_plugin_rt->scan_times, bool_plugin_rt->n_worker_thread);
|
||||
|
||||
return sum;
|
||||
}
|
||||
Reference in New Issue
Block a user