Allow to profile session-state save (again)
This was removed inbf0a525647
2316df357b
"SaveState" was chosen because "State" prefix overlaps with "Stateful", and "SessionState" overlaps with "SessionEvent" debug names. `-DState` or `-DSession` overlap respectively with unrelated debug output.
This commit is contained in:
parent
dac8feb98b
commit
1434789103
@ -93,6 +93,7 @@ namespace PBD {
|
||||
LIBARDOUR_API extern DebugBits Slave;
|
||||
LIBARDOUR_API extern DebugBits Solo;
|
||||
LIBARDOUR_API extern DebugBits Soundcloud;
|
||||
LIBARDOUR_API extern DebugBits SaveState;
|
||||
LIBARDOUR_API extern DebugBits TFSMEvents;
|
||||
LIBARDOUR_API extern DebugBits TFSMState;
|
||||
LIBARDOUR_API extern DebugBits TXLTC;
|
||||
|
@ -87,6 +87,7 @@ PBD::DebugBits PBD::DEBUG::Selection = PBD::new_debug_bit ("selection");
|
||||
PBD::DebugBits PBD::DEBUG::SessionEvents = PBD::new_debug_bit ("sessionevents");
|
||||
PBD::DebugBits PBD::DEBUG::Slave = PBD::new_debug_bit ("slave");
|
||||
PBD::DebugBits PBD::DEBUG::Solo = PBD::new_debug_bit ("solo");
|
||||
PBD::DebugBits PBD::DEBUG::SaveState = PBD::new_debug_bit ("savestate");
|
||||
PBD::DebugBits PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud");
|
||||
PBD::DebugBits PBD::DEBUG::TFSMEvents = PBD::new_debug_bit ("tfsmevents");
|
||||
PBD::DebugBits PBD::DEBUG::TFSMState = PBD::new_debug_bit ("tfsmstate");
|
||||
|
@ -100,6 +100,7 @@
|
||||
#include "ardour/boost_debug.h"
|
||||
#include "ardour/butler.h"
|
||||
#include "ardour/control_protocol_manager.h"
|
||||
#include "ardour/debug.h"
|
||||
#include "ardour/directory_names.h"
|
||||
#include "ardour/disk_reader.h"
|
||||
#include "ardour/filename_extensions.h"
|
||||
@ -810,6 +811,10 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||
fork_state = switch_to_snapshot ? SwitchToSnapshot : SnapshotKeep;
|
||||
}
|
||||
|
||||
#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) {
|
||||
@ -866,6 +871,8 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||
std::string tmp_path(_session_dir->root_path());
|
||||
tmp_path = Glib::build_filename (tmp_path, legalize_for_path (snapshot_name) + temp_suffix);
|
||||
|
||||
DEBUG_TRACE (DEBUG::SaveState, string_compose ("writing state to '%1'\n", tmp_path));
|
||||
|
||||
if (!tree.write (tmp_path)) {
|
||||
error << string_compose (_("state could not be saved to %1"), tmp_path) << endmsg;
|
||||
if (g_remove (tmp_path.c_str()) != 0) {
|
||||
@ -876,6 +883,8 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||
|
||||
} else {
|
||||
|
||||
DEBUG_TRACE (DEBUG::SaveState, string_compose ("renaming state to '%1'\n", xml_path));
|
||||
|
||||
if (::g_rename (tmp_path.c_str(), xml_path.c_str()) != 0) {
|
||||
error << string_compose (_("could not rename temporary session file %1 to %2 (%3)"),
|
||||
tmp_path, xml_path, g_strerror(errno)) << endmsg;
|
||||
@ -923,6 +932,13 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||
StateSaved (snapshot_name); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (DEBUG_ENABLED (DEBUG::SaveState)) {
|
||||
const int64_t elapsed_time_us = g_get_monotonic_time() - save_start_time;
|
||||
DEBUG_TRACE (DEBUG::SaveState, string_compose ("saved in %1%2%3 ms\n", fixed, setprecision (1), elapsed_time_us / 1000.));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pending && !for_archive && ! template_only) {
|
||||
remove_pending_capture_state ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user