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:05:00 UTC

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

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

 ##########
 File path: src/brpc/builtin/hotspots_service.cpp
 ##########
 @@ -43,6 +45,73 @@ void ContentionProfilerStop();
 
 
 namespace brpc {
+enum class DisplayType{
+#if defined(OS_LINUX)
+    kFlameGraph,
+#endif
+    kDot,
+    kText
+};
+
+static std::string DisplayTypeToString(DisplayType type) {
+    switch (type) {
+#if defined(OS_LINUX)
+        case DisplayType::kFlameGraph: return "flame";
+#endif
+        case DisplayType::kDot: return "dot";
+        case DisplayType::kText: return "text";
+    }
+    CHECK(NULL) << "impossible";
 
 Review comment:
   这里不存在非法请求的可能性,除非是代码本身的bug。
   这里的参数是 DisplayType,所有的 DisplayType 都是由 Get Query 的字符串解析得到的,解析后一定是一个合法的 DisplayType。所以如果这里传入了一个非法值,直接 crash 也没问题吧?

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