Use batch mode in step_benchmark_test.
d8880e9a12 introduced measuring performance of a fixed batch of 50 steps, with a fixed starting state.
The Google Benchmark library has a more direct API for doing this, which ends up with nicer looking reported numbers.
PiperOrigin-RevId: 454133316
Change-Id: I368b985dc871084b9ed8c41a87016408719b53ad
This commit is contained in:
committed by
Copybara-Service
parent
d90d50629b
commit
5ac797965c
@@ -84,7 +84,7 @@ static void run_step_benchmark(const mjModel* model, benchmark::State& state) {
|
|||||||
std::vector<mjtNum> warmstart = AsVector(data->qacc_warmstart, model->nv);
|
std::vector<mjtNum> warmstart = AsVector(data->qacc_warmstart, model->nv);
|
||||||
|
|
||||||
// reset state, benchmark subsequent kNumBenchmarkSteps steps
|
// reset state, benchmark subsequent kNumBenchmarkSteps steps
|
||||||
for (auto s : state) {
|
while (state.KeepRunningBatch(kNumBenchmarkSteps)) {
|
||||||
mju_copy(data->qpos, qpos.data(), model->nq);
|
mju_copy(data->qpos, qpos.data(), model->nq);
|
||||||
mju_copy(data->qvel, qvel.data(), model->nv);
|
mju_copy(data->qvel, qvel.data(), model->nv);
|
||||||
mju_copy(data->act, act.data(), model->na);
|
mju_copy(data->act, act.data(), model->na);
|
||||||
@@ -98,7 +98,7 @@ static void run_step_benchmark(const mjModel* model, benchmark::State& state) {
|
|||||||
|
|
||||||
// finalize
|
// finalize
|
||||||
mj_deleteData(data);
|
mj_deleteData(data);
|
||||||
state.SetItemsProcessed(kNumBenchmarkSteps * state.iterations());
|
state.SetItemsProcessed(state.iterations());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use ABSL_ATTRIBUTE_NO_TAIL_CALL to make sure the benchmark functions appear
|
// Use ABSL_ATTRIBUTE_NO_TAIL_CALL to make sure the benchmark functions appear
|
||||||
|
|||||||
Reference in New Issue
Block a user