empiredan commented on code in PR #1351:
URL: 
https://github.com/apache/incubator-pegasus/pull/1351#discussion_r1115278575


##########
src/server/pegasus_write_service.cpp:
##########
@@ -296,15 +307,23 @@ void pegasus_write_service::set_default_ttl(uint32_t ttl) 
{ _impl->set_default_t
 
 void pegasus_write_service::clear_up_batch_states()
 {
-    uint64_t latency = dsn_now_ns() - _batch_start_time;
-    for (dsn::perf_counter *pfc : _batch_qps_perfcounters)
-        pfc->increment();
-    for (dsn::perf_counter *pfc : _batch_latency_perfcounters)
-        pfc->set(latency);
-
-    _batch_qps_perfcounters.clear();
-    _batch_latency_perfcounters.clear();
+#define PROCESS_WRITE_BATCH(op)                                                
                    \
+    do {                                                                       
                    \
+        
_##op##_counter->increment_by(static_cast<int64_t>(_##op##_batch_size));        
           \
+        for (uint32_t i = 0; i < _##op##_batch_size; ++i) {                    
                    \
+            _##op##_latency_ns->set(latency_ns);                               
                    \

Review Comment:
   Good idea, I'll encapsulate this interface which is actually needed by 
unit-tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to