Better memory setting and reporting, updated example models.

- Memory heuristic rounds up to the nearest MB.
- `simulate` reports total memory currently allocated in the info box.
- All example models use `<size memory/>` rather than legacy attributes.
- Regenerated `example_saved.xml` and reformatted original model in [overview chapter](https://mujoco.readthedocs.io/en/latest/overview.html?#examples).
- `<size>` top-level section does not get written if empty.

PiperOrigin-RevId: 486702670
Change-Id: I0306e335f32344c59562ba606664ec9d2101f8a8
This commit is contained in:
Yuval Tassa
2022-11-07 10:35:50 -08:00
committed by Copybara-Service
parent 9370039015
commit 5004a4c8c5
18 changed files with 107 additions and 101 deletions
+4 -2
View File
@@ -29,6 +29,7 @@
#include <mujoco/mjtnum.h>
#include <mujoco/mjvisualize.h>
#include <mujoco/mjxmacro.h>
#include <mujoco/mujoco.h>
#include "glfw_dispatch.h"
#include "uitools.h"
#include "array_safety.h"
@@ -478,7 +479,7 @@ void infotext(mj::Simulate* sim,
// prepare info text
mju::strcpy_arr(title, "Time\nSize\nCPU\nSolver \nFPS\nMemory");
mju::sprintf_arr(content,
"%-9.3f\n%d (%d con)\n%.3f\n%.1f (%d it)\n%.0f\n%.3f",
"%-9.3f\n%d (%d con)\n%.3f\n%.1f (%d it)\n%.0f\n%.2g of %s",
d->time,
d->nefc, d->ncon,
sim->run ?
@@ -486,7 +487,8 @@ void infotext(mj::Simulate* sim,
d->timer[mjTIMER_FORWARD].duration / mjMAX(1, d->timer[mjTIMER_FORWARD].number),
solerr, d->solver_iter,
1/interval,
d->maxuse_arena/(double)(d->nstack * sizeof(mjtNum)));
d->maxuse_arena/(double)(d->nstack * sizeof(mjtNum)),
mju_writeNumBytes(d->nstack * sizeof(mjtNum)));
// add Energy if enabled
{