stdpain commented on code in PR #3384:
URL: https://github.com/apache/brpc/pull/3384#discussion_r3578017511


##########
src/bthread/timer_thread.h:
##########
@@ -84,7 +84,22 @@ class TimerThread {
     // Get identifier of internal pthread.
     // Returns (pthread_t)0 if start() is not called yet.
     pthread_t thread_id() const { return _thread; }
-    
+
+    // Number of tasks currently buffered in the timer thread's internal
+    // min-heap (pulled out of buckets but not run yet). Exposed mainly for
+    // tests and observability. Note that tasks unscheduled after being pulled
+    // into the heap are counted until the timer thread sweeps them away.
+    int64_t pending_task_count() const {
+        return _npending.load(butil::memory_order_relaxed);
+    }
+
+    // Total number of internal Task objects the process-wide pool has ever
+    // constructed (a high-water mark that never shrinks). Shared by all
+    // TimerThread instances. Exposed for tests/observability: if unscheduled
+    // tasks are reclaimed promptly, freed slots get reused and this stays
+    // bounded instead of growing with the number of scheduled tasks.
+    static size_t allocated_task_count();

Review Comment:
   fixed



##########
src/bthread/timer_thread.h:
##########
@@ -84,7 +84,22 @@ class TimerThread {
     // Get identifier of internal pthread.
     // Returns (pthread_t)0 if start() is not called yet.
     pthread_t thread_id() const { return _thread; }
-    
+
+    // Number of tasks currently buffered in the timer thread's internal
+    // min-heap (pulled out of buckets but not run yet). Exposed mainly for
+    // tests and observability. Note that tasks unscheduled after being pulled
+    // into the heap are counted until the timer thread sweeps them away.
+    int64_t pending_task_count() const {

Review Comment:
   fixed



-- 
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