fix maat_stat scan_cpu_time null pointer
This commit is contained in:
@@ -397,6 +397,7 @@ void *ip_runtime_new(void *ip_schema, size_t max_thread_num,
|
||||
|
||||
ip_rt->hit_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||
ip_rt->scan_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||
ip_rt->scan_cpu_time = alignment_int64_array_alloc(max_thread_num);
|
||||
|
||||
return ip_rt;
|
||||
}
|
||||
@@ -826,10 +827,6 @@ void ip_runtime_perf_stat(struct ip_runtime *ip_rt, struct timespec *start,
|
||||
alignment_int64_array_add(ip_rt->scan_cnt, thread_id, 1);
|
||||
|
||||
if (start != NULL && end != NULL) {
|
||||
if (NULL == ip_rt->scan_cpu_time) {
|
||||
ip_rt->scan_cpu_time = alignment_int64_array_alloc(ip_rt->n_worker_thread);
|
||||
}
|
||||
|
||||
long long consume_time = (end->tv_sec - start->tv_sec) * 1000000000 + end->tv_nsec - start->tv_nsec;
|
||||
alignment_int64_array_add(ip_rt->scan_cpu_time, thread_id, consume_time);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user