Remove cycle based storing timer, prefer TimerRAII

..besides with dummy backend one can measure performance
on instruction level granularity with valgrind.
This commit is contained in:
Robin Gareus
2025-11-09 16:32:24 +01:00
parent b3bf623c4b
commit 289f7b10d2
6 changed files with 0 additions and 102 deletions

View File

@@ -63,34 +63,3 @@ class LIBARDOUR_API CycleTimer {
#endif
}
};
class LIBARDOUR_API StoringTimer
{
public:
StoringTimer (int);
void ref ();
void check (int);
#ifndef NDEBUG
void dump (std::string const &);
#endif
private:
cycles_t _current_ref;
int* _point;
cycles_t* _value;
cycles_t* _ref;
int _points;
int _max_points;
};
#ifdef PT_TIMING
extern StoringTimer ST;
#define PT_TIMING_REF ST.ref();
#define PT_TIMING_CHECK(x) ST.check(x);
#endif
#ifndef PT_TIMING
#define PT_TIMING_REF
#define PT_TIMING_CHECK(x)
#endif

View File

@@ -238,9 +238,6 @@ AudioEngine::process_callback (pframes_t nframes)
Glib::Threads::Mutex::Lock tm (_process_lock, Glib::Threads::TRY_LOCK);
Port::set_varispeed_ratio (1.0);
PT_TIMING_REF;
PT_TIMING_CHECK (1);
/// The number of samples that will have been processed when we've finished
pframes_t next_processed_samples;
@@ -636,8 +633,6 @@ AudioEngine::process_callback (pframes_t nframes)
_processed_samples = next_processed_samples;
PT_TIMING_CHECK (2);
return 0;
}

View File

@@ -77,55 +77,3 @@ get_mhz()
abort(); /*NOTREACHED*/
return 0.0f;
}
StoringTimer::StoringTimer (int N)
{
_point = new int[N];
_value = new cycles_t[N];
_ref = new cycles_t[N];
_max_points = N;
_points = 0;
}
#ifndef NDEBUG
void
StoringTimer::dump (string const & file)
{
ofstream f (file.c_str ());
f << min (_points, _max_points) << "\n";
f << get_mhz () << "\n";
for (int i = 0; i < min (_points, _max_points); ++i) {
f << _point[i] << " " << _ref[i] << " " << _value[i] << "\n";
}
}
#endif
void
StoringTimer::ref ()
{
_current_ref = get_cycles ();
}
void
StoringTimer::check (int p)
{
if (_points == _max_points) {
++_points;
return;
} else if (_points > _max_points) {
return;
}
_point[_points] = p;
_value[_points] = get_cycles ();
_ref[_points] = _current_ref;
++_points;
}
#ifdef PT_TIMING
StoringTimer ST (64 * 1024);
#endif

View File

@@ -578,9 +578,6 @@ Session::Session (AudioEngine &eng,
Session::~Session ()
{
#ifdef PT_TIMING
ST.dump ("ST.dump");
#endif
destroy ();
}

View File

@@ -198,7 +198,6 @@ Session::fail_roll (pframes_t nframes)
int
Session::no_roll (pframes_t nframes)
{
PT_TIMING_CHECK (4);
TimerRAII tr (dsp_stats[NoRoll]);
samplepos_t end_sample = _transport_sample + floor (nframes * _transport_fsm->transport_speed());
@@ -221,7 +220,6 @@ Session::no_roll (pframes_t nframes)
DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n");
_process_graph->routes_no_roll(graph_chain, nframes, _transport_sample, end_sample, non_realtime_work_pending());
} else {
PT_TIMING_CHECK (10);
for (auto const& i : *r) {
if (i->is_auditioner()) {
@@ -234,10 +232,8 @@ Session::no_roll (pframes_t nframes)
break;
}
}
PT_TIMING_CHECK (11);
}
PT_TIMING_CHECK (5);
return ret;
}
@@ -371,7 +367,6 @@ Session::calc_preroll_subcycle (samplecnt_t ns) const
void
Session::process_with_events (pframes_t nframes)
{
PT_TIMING_CHECK (3);
TimerRAII tr (dsp_stats[ProcessFunction]);
SessionEvent* ev;

View File

@@ -881,8 +881,6 @@ def options(opt):
help='Build with debugging for the STL')
opt.add_option('--rt-alloc-debug', action='store_true', default=False, dest='rt_alloc_debug',
help='Build with debugging for memory allocation in the real-time thread')
opt.add_option('--pt-timing', action='store_true', default=False, dest='pt_timing',
help='Build with logging of timing in the process thread(s)')
opt.add_option('--denormal-exception', action='store_true', default=False, dest='denormal_exception',
help='Raise a floating point exception if a denormal is detected')
opt.add_option('--test', action='store_true', default=False, dest='build_tests',
@@ -1354,9 +1352,6 @@ int main () { __int128 x = 0; return 0; }
if opts.rt_alloc_debug:
conf.define('DEBUG_RT_ALLOC', 1)
conf.env['DEBUG_RT_ALLOC'] = True
if opts.pt_timing:
conf.define('PT_TIMING', 1)
conf.env['PT_TIMING'] = True
if opts.denormal_exception:
conf.define('DEBUG_DENORMAL_EXCEPTION', 1)
conf.env['DEBUG_DENORMAL_EXCEPTION'] = True
@@ -1532,7 +1527,6 @@ const char* const ardour_config_info = "\\n\\
write_config_text('NI-Maschine', opts.maschine)
write_config_text('OGG', conf.is_defined('HAVE_OGG'))
write_config_text('Phone home', conf.is_defined('PHONE_HOME'))
write_config_text('Process thread timing', conf.is_defined('PT_TIMING'))
write_config_text('Program name', opts.program_name)
write_config_text('Samplerate', conf.is_defined('HAVE_SAMPLERATE'))
write_config_text('PT format', conf.is_defined('PTFORMAT'))