You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2019/07/31 05:44:48 UTC

[GitHub] [incubator-brpc] jamesge commented on a change in pull request #864: Add flamegraph view for profiling builtin service

jamesge commented on a change in pull request #864: Add flamegraph view for profiling builtin service
URL: https://github.com/apache/incubator-brpc/pull/864#discussion_r309046293
 
 

 ##########
 File path: src/brpc/builtin/hotspots_service.cpp
 ##########
 @@ -400,23 +474,30 @@ static void DisplayResult(Controller* cntl,
     }
     
     std::ostringstream cmd_builder;
-    std::string pprof_tool;
-    pprof_tool.reserve(FLAGS_rpc_profiling_dir.size() + 1 + strlen(PPROF_FILENAME));
-    pprof_tool += FLAGS_rpc_profiling_dir;
-    pprof_tool.push_back('/');
-    pprof_tool += PPROF_FILENAME;
-    
+
+    std::string pprof_tool{GeneratePerlScriptPath(PPROF_FILENAME)};
+    std::string flamegraph_tool{GeneratePerlScriptPath(FLAMEGRAPH_FILENAME)};
+
 #if defined(OS_LINUX)
     cmd_builder << "perl " << pprof_tool
-                << (use_text ? " --text " : " --dot ")
+                << DisplayTypeToPProfArgument(display_type)
                 << (show_ccount ? " --contention " : "");
     if (base_name) {
         cmd_builder << "--base " << *base_name << ' ';
     }
-    cmd_builder << GetProgramName() << " " << prof_name << " 2>&1 ";
+
+    cmd_builder << GetProgramName() << " " << prof_name;
+
+    if (display_type == DisplayType::kFlameGraph) {
+        // For flamegraph, we don't care about pprof error msg, 
+        // which will cause confusing messages in the final result.
+        cmd_builder << " 2>/dev/null " << " | " << "perl " << flamegraph_tool << " 2>&1 ";
+    } else {
+        cmd_builder << " 2>&1 ";
 
 Review comment:
   这个结尾不能和if分支里的结尾合并么?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org