Fix timing plots issue in simulate.
Before this change timing plots would report zeros if the render thread was faster than the physics thread, making them unreadable when slowdown was used. PiperOrigin-RevId: 557432042 Change-Id: Ie9a18fb84cab788d11dfbede4e3052f24441b4c4
This commit is contained in:
committed by
Copybara-Service
parent
8ea690ed70
commit
ac3ac0d28f
@@ -326,7 +326,8 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
|
|||||||
total = d->timer[mjTIMER_FORWARD].duration;
|
total = d->timer[mjTIMER_FORWARD].duration;
|
||||||
number = d->timer[mjTIMER_FORWARD].number;
|
number = d->timer[mjTIMER_FORWARD].number;
|
||||||
}
|
}
|
||||||
number = mjMAX(1, number);
|
|
||||||
|
if (number) { // skip update if no measurements
|
||||||
float tdata[5] = {
|
float tdata[5] = {
|
||||||
static_cast<float>(total/number),
|
static_cast<float>(total/number),
|
||||||
static_cast<float>(d->timer[mjTIMER_POS_COLLISION].duration/number),
|
static_cast<float>(d->timer[mjTIMER_POS_COLLISION].duration/number),
|
||||||
@@ -349,6 +350,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
|
|||||||
sim->figtimer.linepnt[n] = pnt;
|
sim->figtimer.linepnt[n] = pnt;
|
||||||
sim->figtimer.linedata[n][1] = tdata[n];
|
sim->figtimer.linedata[n][1] = tdata[n];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get sizes: nv, nbody, nefc, sqrt(nnz), ncont, iter
|
// get sizes: nv, nbody, nefc, sqrt(nnz), ncont, iter
|
||||||
float sdata[6] = {
|
float sdata[6] = {
|
||||||
@@ -361,7 +363,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// update figsize
|
// update figsize
|
||||||
pnt = mjMIN(201, sim->figsize.linepnt[0]+1);
|
int pnt = mjMIN(201, sim->figsize.linepnt[0]+1);
|
||||||
for (int n=0; n<6; n++) {
|
for (int n=0; n<6; n++) {
|
||||||
// shift data
|
// shift data
|
||||||
for (int i=pnt-1; i>0; i--) {
|
for (int i=pnt-1; i>0; i--) {
|
||||||
|
|||||||
Reference in New Issue
Block a user