Profile Session::save_state
authorRobin Gareus <robin@gareus.org>
Fri, 8 Apr 2016 19:45:32 +0000 (21:45 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 8 Apr 2016 19:45:32 +0000 (21:45 +0200)
libs/ardour/session_state.cc

index e252563dcd73ca41ddeaa969d2ffa4adc8dafeb7..db7cbf2c0a594ac2ddf47306b2f04a77e8f3af1b 100644 (file)
@@ -782,6 +782,10 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
                return 1;
        }
 
+#ifndef NDEBUG
+       const int64_t save_start_time = g_get_monotonic_time();
+#endif
+
        /* tell sources we're saving first, in case they write out to a new file
         * which should be saved with the state rather than the old one */
        for (SourceMap::const_iterator i = sources.begin(); i != sources.end(); ++i) {
@@ -879,6 +883,10 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
                StateSaved (snapshot_name); /* EMIT SIGNAL */
        }
 
+#ifndef NDEBUG
+       const int64_t elapsed_time_us = g_get_monotonic_time() - save_start_time;
+       cerr << "saved state in " << setprecision (1) << elapsed_time_us / 1000. << " ms\n";
+#endif
        return 0;
 }