Add optional Tracepoint for RequestContext switch
authorTeng Qin <qinteng@fb.com>
Wed, 30 Nov 2016 19:07:23 +0000 (11:07 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 30 Nov 2016 19:08:38 +0000 (11:08 -0800)
Summary: Using newly added `StaticTracepoint.h`, add a Tracepoint for `RequestContext` switch that could be enabled by compiler flag.

Reviewed By: drarmstr

Differential Revision: D4238658

fbshipit-source-id: 043a035ba8251b48d7b29d63a2219ad2edda164f

folly/Makefile.am
folly/io/async/Request.cpp

index 768fdf6fed599566ce89b8d5a645ffa36ae8ddf4..6aea6dd12cc6a3ac525bc79863a1dcfc0ba2fa1c 100644 (file)
@@ -363,6 +363,7 @@ nobase_follyinclude_HEADERS = \
        ThreadName.h \
        TimeoutQueue.h \
        TokenBucket.h \
+       tracing/StaticTracepoint.h \
        Traits.h \
        Try-inl.h \
        Try.h \
index 3babeea69bad670f7e8597e23ba3aeff733377a3..1c9e071cac593e4aff63630a4d75818a8517934f 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <folly/io/async/Request.h>
+#include <folly/tracing/StaticTracepoint.h>
 
 #include <glog/logging.h>
 
@@ -94,6 +95,7 @@ std::shared_ptr<RequestContext> RequestContext::setContext(
     std::shared_ptr<RequestContext> ctx) {
   auto& curCtx = getStaticContext();
   if (ctx != curCtx) {
+    FOLLY_SDT(folly, request_context_switch_before, curCtx.get(), ctx.get());
     using std::swap;
     if (curCtx) {
       curCtx->onUnset();