proxygen
StaticTracepoint.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__))
20 
22 
23 #define FOLLY_SDT(provider, name, ...) \
24  FOLLY_SDT_PROBE_N( \
25  provider, name, 0, FOLLY_SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__)
26 // Use FOLLY_SDT_DEFINE_SEMAPHORE(provider, name) to define the semaphore
27 // as global variable before using the FOLLY_SDT_WITH_SEMAPHORE macro
28 #define FOLLY_SDT_WITH_SEMAPHORE(provider, name, ...) \
29  FOLLY_SDT_PROBE_N( \
30  provider, name, 1, FOLLY_SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__)
31 #define FOLLY_SDT_IS_ENABLED(provider, name) \
32  (FOLLY_SDT_SEMAPHORE(provider, name) > 0)
33 
34 #else
35 
36 #define FOLLY_SDT(provider, name, ...) \
37  do { \
38  } while (0)
39 #define FOLLY_SDT_WITH_SEMAPHORE(provider, name, ...) \
40  do { \
41  } while (0)
42 #define FOLLY_SDT_IS_ENABLED(provider, name) (false)
43 #define FOLLY_SDT_DEFINE_SEMAPHORE(provider, name)
44 #define FOLLY_SDT_DECLARE_SEMAPHORE(provider, name)
45 #endif