From f7140179a9644770e2fcc3bfbb3784efa83ca2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Mon, 11 Apr 2016 17:50:07 +0000 Subject: [PATCH] Minor optimization in Query_Processor::update_query_processor_stats() --- lib/Query_Processor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Query_Processor.cpp b/lib/Query_Processor.cpp index 3c1bca9fa..8722c5ba4 100644 --- a/lib/Query_Processor.cpp +++ b/lib/Query_Processor.cpp @@ -861,8 +861,10 @@ void Query_Processor::update_query_processor_stats() { spin_rdunlock(&rwlock); for (int i=0; icounters[j],_thr_commands_counters[i]->counters[j]); - _thr_commands_counters[i]->counters[j]=0; + if (_thr_commands_counters[i]->counters[j]) { + __sync_fetch_and_add(&commands_counters[i]->counters[j],_thr_commands_counters[i]->counters[j]); + _thr_commands_counters[i]->counters[j]=0; + } } __sync_fetch_and_add(&commands_counters[i]->total_time,_thr_commands_counters[i]->total_time); _thr_commands_counters[i]->total_time=0;