wwbmmm commented on code in PR #3096:
URL: https://github.com/apache/brpc/pull/3096#discussion_r2423351089


##########
src/brpc/builtin/bthreads_service.cpp:
##########
@@ -38,30 +40,34 @@ void 
BthreadsService::default_method(::google::protobuf::RpcController* cntl_bas
     cntl->http_response().set_content_type("text/plain");
     butil::IOBufBuilder os;
     const std::string& constraint = cntl->http_request().unresolved_path();
-    
     if (constraint.empty()) {
 #ifdef BRPC_BTHREAD_TRACER
-        os << "Use /bthreads/<bthread_id> or /bthreads/<bthread_id>?st=1 for 
stack trace";
+        os << "Use /bthreads/<bthread_id> or /bthreads/<bthread_id>?st=1 for 
stack trace\n";
+        os << "To check all living bthread, use /bthreads/<all> or 
/bthreads/<all>?st=1 for stack trace\n";

Review Comment:
   `<all>` -> all



##########
src/bthread/task_group.cpp:
##########
@@ -1127,7 +1135,9 @@ void print_task(std::ostream& os, bthread_t tid) {
         }
     }
     if (!matched) {
-        os << "bthread=" << tid << " : not exist now";
+        if (!ignore_not_matched) {

Review Comment:
   I don't understand the function of ignore_not_matched here. I think when the 
tid and version_butex not match, it indicates that the bthread is not living.



##########
src/brpc/builtin/bthreads_service.cpp:
##########
@@ -38,30 +40,34 @@ void 
BthreadsService::default_method(::google::protobuf::RpcController* cntl_bas
     cntl->http_response().set_content_type("text/plain");
     butil::IOBufBuilder os;
     const std::string& constraint = cntl->http_request().unresolved_path();
-    
     if (constraint.empty()) {
 #ifdef BRPC_BTHREAD_TRACER
-        os << "Use /bthreads/<bthread_id> or /bthreads/<bthread_id>?st=1 for 
stack trace";
+        os << "Use /bthreads/<bthread_id> or /bthreads/<bthread_id>?st=1 for 
stack trace\n";
+        os << "To check all living bthread, use /bthreads/<all> or 
/bthreads/<all>?st=1 for stack trace\n";
 #else
-        os << "Use /bthreads/<bthread_id>";
+        os << "Use /bthreads/<bthread_id>\n";
+        os << "To check all living bthread, use /bthreads/<all>\n";

Review Comment:
   `<all>` -> all



##########
src/brpc/builtin/bthreads_service.cpp:
##########
@@ -23,7 +23,9 @@
 #include "brpc/builtin/bthreads_service.h"
 
 namespace bthread {
-extern void print_task(std::ostream& os, bthread_t tid);
+extern void print_task(std::ostream& os, bthread_t tid, bool enable_trace,
+    bool ignore_not_matched = false);
+extern void print_living_task(std::ostream& os, bool enable_trace);

Review Comment:
   task -> tasks



##########
src/bthread/task_meta.h:
##########
@@ -107,7 +107,8 @@ struct TaskMeta {
     // DO NOT use this field directly, use tls_bls instead.
     LocalStorage local_storage{};
 
-    // Only used when TaskTracer is enabled.
+    // Mainly used when TaskTracer is enabled. Otherwise used to just indicate
+    // if a bthread is alive.

Review Comment:
   I think the tid and version_butex can be used to judge whether the bthread 
is alive, so you don't need to use this status.



##########
src/butil/resource_pool_inl.h:
##########
@@ -307,6 +308,28 @@ class BAIDU_CACHELINE_ALIGNMENT ResourcePool {
         const size_t n = ResourcePoolFreeChunkMaxItem<T>::value();
         return n < FREE_CHUNK_NITEM ? n : FREE_CHUNK_NITEM;
     }
+
+    std::list<T*> list_resources() const {

Review Comment:
   list -> vector



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