1 // Copyright 2023 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Auto generated by tools/codegen/core/gen_experiments.py
16 //
17 // This file contains the autogenerated parts of the experiments API.
18 //
19 // It generates two symbols for each experiment.
20 //
21 // For the experiment named new_car_project, it generates:
22 //
23 // - a function IsNewCarProjectEnabled() that returns true if the experiment
24 // should be enabled at runtime.
25 //
26 // - a macro GRPC_EXPERIMENT_IS_INCLUDED_NEW_CAR_PROJECT that is defined if the
27 // experiment *could* be enabled at runtime.
28 //
29 // The function is used to determine whether to run the experiment or
30 // non-experiment code path.
31 //
32 // If the experiment brings significant bloat, the macro can be used to avoid
33 // including the experiment code path in the binary for binaries that are size
34 // sensitive.
35 //
36 // By default that includes our iOS and Android builds.
37 //
38 // Finally, a small array is included that contains the metadata for each
39 // experiment.
40 //
41 // A macro, GRPC_EXPERIMENTS_ARE_FINAL, controls whether we fix experiment
42 // configuration at build time (if it's defined) or allow it to be tuned at
43 // runtime (if it's disabled).
44 //
45 // If you are using the Bazel build system, that macro can be configured with
46 // --define=grpc_experiments_are_final=true
47
48 #ifndef GRPC_TEST_CORE_EXPERIMENTS_FIXTURES_EXPERIMENTS_H
49 #define GRPC_TEST_CORE_EXPERIMENTS_FIXTURES_EXPERIMENTS_H
50
51 #include <grpc/support/port_platform.h>
52
53 #include "src/core/lib/experiments/config.h"
54
55 namespace grpc_core {
56
57 #ifdef GRPC_EXPERIMENTS_ARE_FINAL
58
59 #if defined(GRPC_CFSTREAM)
IsTestExperiment1Enabled()60 inline bool IsTestExperiment1Enabled() { return false; }
61 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_2
IsTestExperiment2Enabled()62 inline bool IsTestExperiment2Enabled() { return true; }
63 #ifndef NDEBUG
64 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_3
65 #endif
IsTestExperiment3Enabled()66 inline bool IsTestExperiment3Enabled() {
67 #ifdef NDEBUG
68 return false;
69 #else
70 return true;
71 #endif
72 }
73 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_4
IsTestExperiment4Enabled()74 inline bool IsTestExperiment4Enabled() { return true; }
75
76 #elif defined(GPR_WINDOWS)
77 inline bool IsTestExperiment1Enabled() { return false; }
78 inline bool IsTestExperiment2Enabled() { return false; }
79 #ifndef NDEBUG
80 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_3
81 #endif
82 inline bool IsTestExperiment3Enabled() {
83 #ifdef NDEBUG
84 return false;
85 #else
86 return true;
87 #endif
88 }
89 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_4
90 inline bool IsTestExperiment4Enabled() { return true; }
91
92 #else
93 #ifndef NDEBUG
94 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_1
95 #endif
96 inline bool IsTestExperiment1Enabled() {
97 #ifdef NDEBUG
98 return false;
99 #else
100 return true;
101 #endif
102 }
103 #ifndef NDEBUG
104 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_2
105 #endif
106 inline bool IsTestExperiment2Enabled() {
107 #ifdef NDEBUG
108 return false;
109 #else
110 return true;
111 #endif
112 }
113 #ifndef NDEBUG
114 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_3
115 #endif
116 inline bool IsTestExperiment3Enabled() {
117 #ifdef NDEBUG
118 return false;
119 #else
120 return true;
121 #endif
122 }
123 inline bool IsTestExperiment4Enabled() { return false; }
124 #endif
125
126 #else
127 enum ExperimentIds {
128 kExperimentIdTestExperiment1,
129 kExperimentIdTestExperiment2,
130 kExperimentIdTestExperiment3,
131 kExperimentIdTestExperiment4,
132 kNumTestExperiments
133 };
134 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_1
135 inline bool IsTestExperiment1Enabled() {
136 return IsTestExperimentEnabled(kExperimentIdTestExperiment1);
137 }
138 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_2
139 inline bool IsTestExperiment2Enabled() {
140 return IsTestExperimentEnabled(kExperimentIdTestExperiment2);
141 }
142 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_3
143 inline bool IsTestExperiment3Enabled() {
144 return IsTestExperimentEnabled(kExperimentIdTestExperiment3);
145 }
146 #define GRPC_EXPERIMENT_IS_INCLUDED_TEST_EXPERIMENT_4
147 inline bool IsTestExperiment4Enabled() {
148 return IsTestExperimentEnabled(kExperimentIdTestExperiment4);
149 }
150
151 extern const ExperimentMetadata g_test_experiment_metadata[kNumTestExperiments];
152
153 #endif
154 } // namespace grpc_core
155
156 #endif // GRPC_TEST_CORE_EXPERIMENTS_FIXTURES_EXPERIMENTS_H
157