在进行snprintf之前,进行缓冲区的判满,提高处理效率。去掉无意义的goto语句
This commit is contained in:
@@ -524,7 +524,7 @@ int main(int argc, char **argv)
|
|||||||
if(g_care_pid == CONSUMER_CARE_PID_SPEC){
|
if(g_care_pid == CONSUMER_CARE_PID_SPEC){
|
||||||
if(!producer_pid_is_cared(tmp_ovw->producer_pid)){
|
if(!producer_pid_is_cared(tmp_ovw->producer_pid)){
|
||||||
MESA_shm_ring_queue_set_empty(ring_queue_head[i]);
|
MESA_shm_ring_queue_set_empty(ring_queue_head[i]);
|
||||||
goto next;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(g_output_mode == CONSUMER_OUTPUT_MODE_FILE){
|
if(g_output_mode == CONSUMER_OUTPUT_MODE_FILE){
|
||||||
@@ -534,7 +534,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next:
|
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -346,6 +346,9 @@ void MESA_handle_runtime_log(void *handle, int level, const char *module, const
|
|||||||
}
|
}
|
||||||
pthread_setspecific(MESA_pthread_key,(void*)pri);
|
pthread_setspecific(MESA_pthread_key,(void*)pri);
|
||||||
}
|
}
|
||||||
|
if(MESA_shm_ring_queue_is_full(pri->ring_queue_head)){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
portable_vsnprintf(handle, pri->cache_buf, pri->cache_buf_len, fmt, ap);
|
portable_vsnprintf(handle, pri->cache_buf, pri->cache_buf_len, fmt, ap);
|
||||||
MESA_shm_copy_buf_to_ring_queue(pri->cache_buf, pri->cache_buf_len, pri->ring_queue_head, p_handle->real_log_file,p_handle->real_log_file_len);
|
MESA_shm_copy_buf_to_ring_queue(pri->cache_buf, pri->cache_buf_len, pri->ring_queue_head, p_handle->real_log_file,p_handle->real_log_file_len);
|
||||||
zlog(p_handle->zc, p_handle->runtime_log_file, strlen(p_handle->runtime_log_file), module, strlen(module), __LINE__, level, "%s", pri->cache_buf);
|
zlog(p_handle->zc, p_handle->runtime_log_file, strlen(p_handle->runtime_log_file), module, strlen(module), __LINE__, level, "%s", pri->cache_buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user