From ea2094274b9d14757595a0677565b011e2b2573d Mon Sep 17 00:00:00 2001 From: Teng Qin Date: Wed, 30 Nov 2016 11:07:23 -0800 Subject: [PATCH] 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 --- folly/Makefile.am | 1 + folly/io/async/Request.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/folly/Makefile.am b/folly/Makefile.am index 768fdf6f..6aea6dd1 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -363,6 +363,7 @@ nobase_follyinclude_HEADERS = \ ThreadName.h \ TimeoutQueue.h \ TokenBucket.h \ + tracing/StaticTracepoint.h \ Traits.h \ Try-inl.h \ Try.h \ diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index 3babeea6..1c9e071c 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -20,6 +20,7 @@ */ #include +#include #include @@ -94,6 +95,7 @@ std::shared_ptr RequestContext::setContext( std::shared_ptr 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(); -- 2.34.1