BulletSim: add parameter to have Bullet output performance statistics

every so many frames. Default to off.
0.7.5-pf-bulletsim
Robert Adams 2013-01-01 17:25:41 -08:00
parent b14b65ea95
commit aa236b2020
4 changed files with 11 additions and 7 deletions

View File

@ -970,7 +970,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
p.linkConstraintERP = o[0].XlinkConstraintERP;
p.linkConstraintCFM = o[0].XlinkConstraintCFM;
p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations;
p.physicsLoggingFrames = o[0].physicsLoggingFrames;
p.physicsLoggingFrames = o[0].XphysicsLoggingFrames;
DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();

View File

@ -198,7 +198,7 @@ public struct ConfigurationParameters
public float XlinkConstraintCFM;
public float XlinkConstraintSolverIterations;
public float physicsLoggingFrames;
public float XphysicsLoggingFrames;
public const float numericTrue = 1f;
public const float numericFalse = 0f;
@ -415,7 +415,7 @@ public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force);
// =====================================================================================
// btDynamicsWorld entries
// public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj, Vector3 pos, Quaternion rot);
// public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj, Vector3 pos, Quaternion rot);
public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj);
public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);

View File

@ -492,11 +492,11 @@ public static class BSParam
(s) => { return LinkConstraintSolverIterations; },
(s,p,l,v) => { LinkConstraintSolverIterations = v; } ),
new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)",
new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
0f,
(s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); },
(s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; },
(s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ),
(s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); },
(s) => { return (float)s.PhysicsMetricDumpFrames; },
(s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ),
};
// Convert a boolean to our numeric true and false values

View File

@ -161,6 +161,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
private int m_physicsLoggingFileMinutes;
private bool m_physicsLoggingDoFlush;
private bool m_physicsPhysicalDumpEnabled;
public float PhysicsMetricDumpFrames { get; set; }
// 'true' of the vehicle code is to log lots of details
public bool VehicleLoggingEnabled { get; private set; }
public bool VehiclePhysicalLoggingEnabled { get; private set; }
@ -526,6 +527,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
collidersCount = 0;
}
if ((m_simulationStep % PhysicsMetricDumpFrames) == 0)
PE.DumpPhysicsStatistics(World);
// Get a value for 'now' so all the collision and update routines don't have to get their own.
SimulationNowTime = Util.EnvironmentTickCount();