Home | History | Annotate | Download | only in test

Lines Matching refs:state

54 static void BM_Factorial(benchmark::State& state) {
56 while (state.KeepRunning()) fac_42 = Factorial(8);
60 state.SetLabel(ss.str());
65 static void BM_CalculatePiRange(benchmark::State& state) {
67 while (state.KeepRunning()) pi = CalculatePi(state.range(0));
70 state.SetLabel(ss.str());
74 static void BM_CalculatePi(benchmark::State& state) {
76 while (state.KeepRunning()) {
84 static void BM_SetInsert(benchmark::State& state) {
85 while (state.KeepRunning()) {
86 state.PauseTiming();
87 std::set<int> data = ConstructRandomSet(state.range(0));
88 state.ResumeTiming();
89 for (int j = 0; j < state.range(1); ++j) data.insert(rand());
91 state.SetItemsProcessed(state.iterations() * state.range(1));
92 state.SetBytesProcessed(state.iterations() * state.range(1) * sizeof(int));
98 static void BM_Sequential(benchmark::State& state) {
100 while (state.KeepRunning()) {
102 for (int i = state.range(0); --i;) c.push_back(v);
104 const size_t items_processed = state.iterations() * state.range(0);
105 state.SetItemsProcessed(items_processed);
106 state.SetBytesProcessed(items_processed * sizeof(v));
116 static void BM_StringCompare(benchmark::State& state) {
117 std::string s1(state.range(0), '-');
118 std::string s2(state.range(0), '-');
119 while (state.KeepRunning()) benchmark::DoNotOptimize(s1.compare(s2));
123 static void BM_SetupTeardown(benchmark::State& state) {
124 if (state.thread_index == 0) {
129 while (state.KeepRunning()) {
137 if (state.thread_index == 0) {
143 static void BM_LongTest(benchmark::State& state) {
145 while (state.KeepRunning()) {
146 for (int i = 0; i < state.range(0); ++i)
152 static void BM_ParallelMemset(benchmark::State& state) {
153 int size = state.range(0) / static_cast<int>(sizeof(int));
154 int thread_size = size / state.threads;
155 int from = thread_size * state.thread_index;
158 if (state.thread_index == 0) {
162 while (state.KeepRunning()) {
170 if (state.thread_index == 0) {
176 static void BM_ManualTiming(benchmark::State& state) {
178 int microseconds = state.range(0);
182 while (state.KeepRunning()) {
192 state.SetIterationTime(elapsed.count());
195 state.SetItemsProcessed(slept_for);
203 void BM_with_args(benchmark::State& state, Args&&...) {
204 while (state.KeepRunning()) {
211 void BM_non_template_args(benchmark::State& state, int, double) {
212 while(state.KeepRunning()) {}
216 static void BM_UserCounter(benchmark::State& state) {
218 while (state.KeepRunning()) {
221 state.counters["Foo"] = 1;
222 state.counters["Bar"] = 2;
223 state.counters["Baz"] = 3;
224 state.counters["Bat"] = 5;
226 state.counters.insert({{"Foo", 2}, {"Bar", 3}, {"Baz", 5}, {"Bat", 6}});
235 static void BM_DenseThreadRanges(benchmark::State& st) {