MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / dTimerReport

Function dTimerReport

3rd_party/Src/ode/ode/src/timer.cpp:343–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341
342#if 0//def _DEBUG
343void dTimerReport (FILE *fout, int average)
344{
345 int i;
346 size_t maxl;
347 double ccunit = 1.0/dTimerTicksPerSecond();
348 fprintf (fout,"\nTimer Report (");
349 fprintDoubleWithPrefix (fout,ccunit,"%.2f ");
350 fprintf (fout,"s resolution)\n------------\n");
351 if (num < 1) return;
352
353 // get maximum description length
354 maxl = 0;
355 for (i=0; i<num; i++) {
356 size_t l = strlen (event[i].description);
357 if (l > maxl) maxl = l;
358 }
359
360 // calculate total time
361 double t1 = loadClockCount (event[0].cc);
362 double t2 = loadClockCount (event[num-1].cc);
363 double total = t2 - t1;
364 if (total <= 0) total = 1;
365
366 // compute time difference for all slots except the last one. update totals
367 double *times = (double*) ALLOCA (num * sizeof(double));
368 for (i=0; i < (num-1); i++) {
369 double t1 = loadClockCount (event[i].cc);
370 double t2 = loadClockCount (event[i+1].cc);
371 times[i] = t2 - t1;
372 event[i].count++;
373 event[i].total_t += times[i];
374 event[i].total_p += times[i]/total * 100.0;
375 }
376
377 // print report (with optional averages)
378 for (i=0; i<num; i++) {
379 double t,p;
380 if (i < (num-1)) {
381 t = times[i];
382 p = t/total * 100.0;
383 }
384 else {
385 t = total;
386 p = 100.0;
387 }
388 fprintf (fout,"%-*s %7.2fms %6.2f%%",maxl,event[i].description,
389 t*ccunit * 1000.0, p);
390 if (average && i < (num-1)) {
391 fprintf (fout," (avg %7.2fms %6.2f%%)",
392 (event[i].total_t / event[i].count)*ccunit * 1000.0,
393 event[i].total_p / event[i].count);
394 }
395 fprintf (fout,"\n");
396 }
397 fprintf (fout,"\n");
398}
399#endif

Callers 5

dxQuickStepperFunction · 0.85
dInternalStepIsland_x1Function · 0.85
dInternalStepIsland_x2Function · 0.85
processIslandsFastFunction · 0.85
dxProcessIslandsFunction · 0.85

Calls 3

dTimerTicksPerSecondFunction · 0.85
fprintDoubleWithPrefixFunction · 0.85
loadClockCountFunction · 0.85

Tested by

no test coverage detected