13
0

Add API to report I/O Latency

This commit is contained in:
Robin Gareus 2021-09-08 21:45:16 +02:00
parent f301e692a7
commit 6199d08f71
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 8 additions and 0 deletions

View File

@ -542,6 +542,7 @@ public:
samplecnt_t worst_output_latency () const { return _worst_output_latency; }
samplecnt_t worst_input_latency () const { return _worst_input_latency; }
samplecnt_t worst_route_latency () const { return _worst_route_latency; }
samplecnt_t io_latency () const { return _io_latency; }
samplecnt_t worst_latency_preroll () const;
samplecnt_t worst_latency_preroll_buffer_size_ceil () const;
@ -1409,6 +1410,7 @@ private:
samplecnt_t _worst_output_latency;
samplecnt_t _worst_input_latency;
samplecnt_t _worst_route_latency;
samplecnt_t _io_latency;
uint32_t _send_latency_changes;
bool _have_captured;
samplecnt_t _capture_duration;

View File

@ -2524,7 +2524,9 @@ LuaBindings::common (lua_State* L)
.addFunction ("worst_output_latency", &Session::worst_output_latency)
.addFunction ("worst_input_latency", &Session::worst_input_latency)
.addFunction ("worst_route_latency", &Session::worst_route_latency)
.addFunction ("io_latency", &Session::io_latency)
.addFunction ("worst_latency_preroll", &Session::worst_latency_preroll)
.addFunction ("worst_latency_preroll_buffer_size_ceil", &Session::worst_latency_preroll_buffer_size_ceil)
.addFunction ("cfg", &Session::cfg)
.addFunction ("route_groups", &Session::route_groups)
.addFunction ("new_route_group", &Session::new_route_group)

View File

@ -201,6 +201,7 @@ Session::Session (AudioEngine &eng,
, _worst_output_latency (0)
, _worst_input_latency (0)
, _worst_route_latency (0)
, _io_latency (0)
, _send_latency_changes (0)
, _have_captured (false)
, _capture_duration (0)
@ -6820,6 +6821,7 @@ Session::set_worst_output_latency ()
}
_worst_output_latency = 0;
_io_latency = 0;
if (!_engine.running()) {
return;
@ -6829,6 +6831,7 @@ Session::set_worst_output_latency ()
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
_worst_output_latency = max (_worst_output_latency, (*i)->output()->latency());
_io_latency = max (_io_latency, (*i)->output()->latency() + (*i)->input()->latency());
}
_worst_output_latency = max (_worst_output_latency, _click_io->latency());

View File

@ -12,6 +12,7 @@ function factory () return function ()
print ("Worst Input Latency: ", Session:worst_input_latency ())
print ("Worst Track Latency: ", Session:worst_route_latency ())
print ("Worst Latency Preroll: ", Session:worst_latency_preroll ())
print ("I/O Latency: ", Session:io_latency ())
print (" -- Routes --")
for t in Session:get_routes ():iter () do