Commit ea209427 authored by Teng Qin's avatar Teng Qin Committed by Facebook Github Bot

Add optional Tracepoint for RequestContext switch

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
parent f972b1ee
...@@ -363,6 +363,7 @@ nobase_follyinclude_HEADERS = \ ...@@ -363,6 +363,7 @@ nobase_follyinclude_HEADERS = \
ThreadName.h \ ThreadName.h \
TimeoutQueue.h \ TimeoutQueue.h \
TokenBucket.h \ TokenBucket.h \
tracing/StaticTracepoint.h \
Traits.h \ Traits.h \
Try-inl.h \ Try-inl.h \
Try.h \ Try.h \
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <folly/io/async/Request.h> #include <folly/io/async/Request.h>
#include <folly/tracing/StaticTracepoint.h>
#include <glog/logging.h> #include <glog/logging.h>
...@@ -94,6 +95,7 @@ std::shared_ptr<RequestContext> RequestContext::setContext( ...@@ -94,6 +95,7 @@ std::shared_ptr<RequestContext> RequestContext::setContext(
std::shared_ptr<RequestContext> ctx) { std::shared_ptr<RequestContext> ctx) {
auto& curCtx = getStaticContext(); auto& curCtx = getStaticContext();
if (ctx != curCtx) { if (ctx != curCtx) {
FOLLY_SDT(folly, request_context_switch_before, curCtx.get(), ctx.get());
using std::swap; using std::swap;
if (curCtx) { if (curCtx) {
curCtx->onUnset(); curCtx->onUnset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment