Dump SessionEvent cross-thread pool when it overflows

This commit is contained in:
Robin Gareus 2022-07-07 04:44:05 +02:00
parent 1694c71cd5
commit a8a4695466
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 47 additions and 1 deletions

View File

@ -200,4 +200,6 @@ protected:
} /* namespace */
LIBARDOUR_API std::ostream& operator<<(std::ostream&, const ARDOUR::SessionEvent&);
#endif /* __ardour_session_event_h__ */

View File

@ -28,6 +28,8 @@
#include "ardour/debug.h"
#include "ardour/session_event.h"
#include "ardour/track.h"
#include "ardour/region.h"
#include "pbd/i18n.h"
@ -65,7 +67,7 @@ SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
a CrossThreadPool for use by this thread whenever events are allocated/released
from SessionEvent::pool()
*/
pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems);
pool->create_per_thread_pool (name, sizeof (SessionEvent), nitems, [](size_t i, void*p) { std::cout << i << " " << *static_cast<SessionEvent*> (p) << "\n";});
}
SessionEvent::SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn, bool yn2, bool yn3)
@ -364,3 +366,45 @@ SessionEventManager::_clear_event_type (SessionEvent::Type type)
set_next_event ();
}
std::ostream& operator<<(std::ostream& o, ARDOUR::SessionEvent const& ev) {
o << "SessionEvent"
<< " type: " << enum_2_string (ev.type)
<< " action: " << enum_2_string (ev.action)
<< " atime: " << ev.action_sample
<< " ttime: " << ev.target_sample;
switch (ev.type) {
case SessionEvent::Locate:
o << " disposition: " << ev.locate_transport_disposition;
o << " force: " << ev.yes_or_no;
break;
case SessionEvent::LocateRoll:
o << " force: " << ev.yes_or_no;
break;
case SessionEvent::SetDefaultPlaySpeed:
/* fallthrough */
case SessionEvent::SetTransportSpeed:
o << " speed: " << ev.speed;
break;
case SessionEvent::EndRoll:
o << " abort: " << ev.yes_or_no;
o << " clear: " << ev.second_yes_or_no;
break;
case SessionEvent::OverwriteAll:
o << " reason: " << ev.overwrite;
break;
case SessionEvent::Audition:
o << " region: '" << ev.region->name () << "'";
break;
case SessionEvent::Overwrite:
if (boost::shared_ptr<Track> track = ev.track.lock ()) {
o << " track: '" << track->name () << "'";
}
o << " reason: " << ev.overwrite;
break;
default:
break;
}
return o;
}