- now = steady_clock::now();
- double elapsed = duration<double>(now - start).count();
-
- metric_frames_output_total = frame_num;
- metric_frames_output_dropped = stats_dropped_frames;
-
- if (frame_num % 100 == 0) {
- printf("%d frames (%d dropped) in %.3f seconds = %.1f fps (%.1f ms/frame)",
- frame_num, stats_dropped_frames, elapsed, frame_num / elapsed,
- 1e3 * elapsed / frame_num);
- // chain->print_phase_timing();
-
- // Check our memory usage, to see if we are close to our mlockall()
- // limit (if at all set).
- rusage used;
- if (getrusage(RUSAGE_SELF, &used) == -1) {
- perror("getrusage(RUSAGE_SELF)");
- assert(false);
- }
-
- if (uses_mlock) {
- rlimit limit;
- if (getrlimit(RLIMIT_MEMLOCK, &limit) == -1) {
- perror("getrlimit(RLIMIT_MEMLOCK)");
- assert(false);
- }
-
- if (limit.rlim_cur == 0) {
- printf(", using %ld MB memory (locked)",
- long(used.ru_maxrss / 1024));
- } else {
- printf(", using %ld / %ld MB lockable memory (%.1f%%)",
- long(used.ru_maxrss / 1024),
- long(limit.rlim_cur / 1048576),
- float(100.0 * (used.ru_maxrss * 1024.0) / limit.rlim_cur));
- }
- metrics_memory_locked_limit_bytes = limit.rlim_cur;
- } else {
- printf(", using %ld MB memory (not locked)",
- long(used.ru_maxrss / 1024));
- metrics_memory_locked_limit_bytes = 0.0 / 0.0;
- }
-
- printf("\n");
-
- metrics_memory_used_bytes = used.ru_maxrss * 1024;
- }
-