mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-28 17:37:41 +01:00
add DSP/processing statistics to Routes and Processors
This commit is contained in:
parent
6b07926b03
commit
76bd2a77d7
7 changed files with 64 additions and 1 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <exception>
|
||||
|
||||
#include "pbd/statefuldestructible.h"
|
||||
#include "pbd/timing.h"
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/buffer_set.h"
|
||||
|
|
@ -157,7 +158,10 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
|
|||
virtual void set_owner (SessionObject*);
|
||||
SessionObject* owner() const;
|
||||
|
||||
protected:
|
||||
PBD::TimingStats proc_stats;
|
||||
void get_dsp_stats (std::ostream&);
|
||||
|
||||
protected:
|
||||
virtual XMLNode& state ();
|
||||
virtual int set_state_2X (const XMLNode&, int version);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "pbd/xml++.h"
|
||||
#include "pbd/undo.h"
|
||||
#include "pbd/stateful.h"
|
||||
#include "pbd/timing.h"
|
||||
#include "pbd/controllable.h"
|
||||
#include "pbd/destructible.h"
|
||||
#include "pbd/g_atomic_compat.h"
|
||||
|
|
@ -589,6 +590,9 @@ public:
|
|||
|
||||
virtual void use_captured_sources (SourceList& srcs, CaptureInfos const &) {}
|
||||
|
||||
PBD::TimingStats dsp_stats;
|
||||
void get_dsp_stats (std::ostream&);
|
||||
|
||||
protected:
|
||||
friend class Session;
|
||||
|
||||
|
|
|
|||
|
|
@ -1322,6 +1322,8 @@ public:
|
|||
std::vector<struct ptflookup> ptfwavpair;
|
||||
SourceList pt_imported_sources;
|
||||
|
||||
std::string get_dsp_stats () const;
|
||||
|
||||
protected:
|
||||
friend class AudioEngine;
|
||||
void set_block_size (pframes_t nframes);
|
||||
|
|
|
|||
|
|
@ -332,3 +332,15 @@ Processor::owner() const
|
|||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
void
|
||||
Processor::get_dsp_stats (std::ostream& str)
|
||||
{
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
double avg;
|
||||
double dev;
|
||||
|
||||
proc_stats.get_stats (min, max, avg, dev);
|
||||
str << name() << ": [" << typeid(*this).name() << "] " << min << ' ' << max << ' ' << avg << ' ' << dev;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ Route::process_output_buffers (BufferSet& bufs,
|
|||
PT_TIMING_CHECK ("route-pob-in");
|
||||
/* Caller must hold process lock */
|
||||
assert (!AudioEngine::instance()->process_lock().trylock());
|
||||
TimerRAII ta (dsp_stats);
|
||||
|
||||
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
|
||||
if (!lm.locked()) {
|
||||
|
|
@ -533,11 +534,13 @@ Route::process_output_buffers (BufferSet& bufs,
|
|||
}
|
||||
}
|
||||
|
||||
(*i)->proc_stats.start();
|
||||
if (speed < 0) {
|
||||
(*i)->run (bufs, start_sample + latency, end_sample + latency, pspeed, nframes, *i != _processors.back());
|
||||
} else {
|
||||
(*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back());
|
||||
}
|
||||
(*i)->proc_stats.update();
|
||||
|
||||
bufs.set_count ((*i)->output_streams());
|
||||
|
||||
|
|
@ -6309,3 +6312,21 @@ Route::monitoring_state () const
|
|||
return MonitoringSilence;
|
||||
}
|
||||
|
||||
void
|
||||
Route::get_dsp_stats (std::ostream& str)
|
||||
{
|
||||
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
double avg;
|
||||
double dev;
|
||||
|
||||
dsp_stats.get_stats (min, max, avg, dev);
|
||||
str << name() << ": " << min << ' ' << max << ' ' << avg << ' ' << dev << endl;
|
||||
|
||||
for (ProcessorList::const_iterator p = _processors.begin(); p != _processors.end(); ++p) {
|
||||
str << '\t';
|
||||
(*p)->get_dsp_stats (str);
|
||||
str << endl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7243,3 +7243,15 @@ Session::had_destructive_tracks() const
|
|||
{
|
||||
return _had_destructive_tracks;
|
||||
}
|
||||
|
||||
std::string
|
||||
Session::get_dsp_stats () const
|
||||
{
|
||||
stringstream ss;
|
||||
|
||||
boost::shared_ptr<RouteList> r = routes.reader ();
|
||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||
(*i)->get_dsp_stats (ss);
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,6 +194,14 @@ private:
|
|||
double _vs;
|
||||
};
|
||||
|
||||
class LIBPBD_API TimerRAII
|
||||
{
|
||||
public:
|
||||
TimerRAII (TimingStats& ts) : stats (ts) { stats.start(); }
|
||||
~TimerRAII() { stats.update(); }
|
||||
TimingStats& stats;
|
||||
};
|
||||
|
||||
class LIBPBD_API TimingData
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue