- fprintf(stderr, "%-30s %4.1f ms\n", timer.name.c_str(), GLint64(time_end - time_start) / 1e6);
+
+ if (detailed_timing) {
+ // Look for any immediate subtimers, and see if they sum to the large one.
+ size_t num_subtimers = 0;
+ GLint64 sum_subtimers = 0;
+ for (size_t j = i + 1; j < timers.size() && timers[j].level > timers[i].level; ++j) {
+ if (timers[j].level != timers[i].level + 1) continue;
+ ++num_subtimers;
+ sum_subtimers += find_elapsed(timers[j].query);
+ }
+
+ if (num_subtimers > 0 && (time_elapsed - sum_subtimers) / 1e6 >= 0.01) {
+ fprintf(stderr, "%-30s %4.3f ms [%4.3f ms unaccounted for]\n", timers[i].name.c_str(), time_elapsed / 1e6, (time_elapsed - sum_subtimers) / 1e6);
+ } else {
+ fprintf(stderr, "%-30s %4.3f ms\n", timers[i].name.c_str(), time_elapsed / 1e6);
+ }
+ } else {
+ fprintf(stderr, "%-30s %4.1f ms\n", timers[i].name.c_str(), time_elapsed / 1e6);
+ }