Home | History | Annotate | Download | only in test

Lines Matching refs:state

54 static void BM_Factorial(benchmark::State& state) {
56 for (auto _ : state) fac_42 = Factorial(8);
60 state.SetLabel(ss.str());
65 static void BM_CalculatePiRange(benchmark::State& state) {
67 for (auto _ : state) pi = CalculatePi(state.range(0));
70 state.SetLabel(ss.str());
74 static void BM_CalculatePi(benchmark::State& state) {
76 for (auto _ : state) {
84 static void BM_SetInsert(benchmark::State& state) {
86 for (auto _ : state) {
87 state.PauseTiming();
88 data = ConstructRandomSet(state.range(0));
89 state.ResumeTiming();
90 for (int j = 0; j < state.range(1); ++j) data.insert(rand());
92 state.SetItemsProcessed(state.iterations() * state.range(1));
93 state.SetBytesProcessed(state.iterations() * state.range(1) * sizeof(int));
102 static void BM_Sequential(benchmark::State& state) {
104 for (auto _ : state) {
106 for (int i = state.range(0); --i;) c.push_back(v);
108 const size_t items_processed = state.iterations() * state.range(0);
109 state.SetItemsProcessed(items_processed);
110 state.SetBytesProcessed(items_processed * sizeof(v));
120 static void BM_StringCompare(benchmark::State& state) {
121 std::string s1(state.range(0), '-');
122 std::string s2(state.range(0), '-');
123 for (auto _ : state) benchmark::DoNotOptimize(s1.compare(s2));
127 static void BM_SetupTeardown(benchmark::State& state) {
128 if (state.thread_index == 0) {
133 for (auto _ : state) {
141 if (state.thread_index == 0) {
147 static void BM_LongTest(benchmark::State& state) {
149 for (auto _ : state) {
150 for (int i = 0; i < state.range(0); ++i)
156 static void BM_ParallelMemset(benchmark::State& state) {
157 int size = state.range(0) / static_cast<int>(sizeof(int));
158 int thread_size = size / state.threads;
159 int from = thread_size * state.thread_index;
162 if (state.thread_index == 0) {
166 for (auto _ : state) {
174 if (state.thread_index == 0) {
180 static void BM_ManualTiming(benchmark::State& state) {
182 int microseconds = state.range(0);
186 for (auto _ : state) {
196 state.SetIterationTime(elapsed.count());
199 state.SetItemsProcessed(slept_for);
207 void BM_with_args(benchmark::State& state, Args&&...) {
208 for (auto _ : state) {
215 void BM_non_template_args(benchmark::State& state, int, double) {
216 while(state.KeepRunning()) {}
222 static void BM_DenseThreadRanges(benchmark::State& st) {