From: Alison Tsai Date: Wed, 23 Aug 2017 23:50:28 +0000 (-0700) Subject: macro to enable scoped trace section functionality X-Git-Tag: v2017.08.28.00~14 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=f74bfffc3b1934e00ceb3dc9132924a0efaafdc0 macro to enable scoped trace section functionality Summary: Add a macro to enable optional scoped trace section functionality (user-defined). This macro will have no effect unless configured to do so. This change means that if proxygen is being upgraded, folly must also be updated. Reviewed By: mzlee Differential Revision: D5635123 fbshipit-source-id: 7db17f6ae8c0d1484cf9fad043eb42717279bd0a --- diff --git a/folly/Makefile.am b/folly/Makefile.am index 40f9d7fd..d2ed843e 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -428,6 +428,7 @@ nobase_follyinclude_HEADERS = \ TimeoutQueue.h \ TokenBucket.h \ tracing/StaticTracepoint.h \ + tracing/ScopedTraceSection.h \ Traits.h \ Try-inl.h \ Try.h \ diff --git a/folly/tracing/ScopedTraceSection.h b/folly/tracing/ScopedTraceSection.h new file mode 100644 index 00000000..07aa77c6 --- /dev/null +++ b/folly/tracing/ScopedTraceSection.h @@ -0,0 +1,31 @@ +/* + * Copyright 2017-present Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * This macro enables FbSystrace usage in production for fb4a. When + * FOLLY_SCOPED_TRACE_SECTION_HEADER is defined then a trace section is started + * and later automatically terminated at the close of the scope it is called in. + * In all other cases no action is taken. + */ + +#pragma once + +#if defined(FOLLY_SCOPED_TRACE_SECTION_HEADER) +#include FOLLY_SCOPED_TRACE_SECTION_HEADER +#else +#define FOLLY_SCOPED_TRACE_SECTION(arg, ...) \ + do { \ + } while (0) +#endif