jack: implement statistics

This commit is contained in:
Wim Taymans 2019-08-22 13:25:01 +02:00
parent 33cac9932c
commit 84071d2cac
3 changed files with 21 additions and 16 deletions

View file

@ -2,7 +2,6 @@ pipewire_jack_sources = [
'pipewire-jack.c', 'pipewire-jack.c',
'metadata.c', 'metadata.c',
'ringbuffer.c', 'ringbuffer.c',
'statistics.c',
'uuid.c', 'uuid.c',
] ]

View file

@ -2246,6 +2246,8 @@ float jack_cpu_load (jack_client_t *client)
return res; return res;
} }
#include "statistics.c"
SPA_EXPORT SPA_EXPORT
jack_port_t * jack_port_register (jack_client_t *client, jack_port_t * jack_port_register (jack_client_t *client,
const char *port_name, const char *port_name,

View file

@ -17,34 +17,38 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <jack/statistics.h> #include <jack/statistics.h>
#include <pipewire/pipewire.h>
SPA_EXPORT SPA_EXPORT
float jack_get_max_delayed_usecs (jack_client_t *client) float jack_get_max_delayed_usecs (jack_client_t *client)
{ {
pw_log_warn("not implemented"); struct client *c = (struct client *) client;
return 0.0f; float res = 0.0f;
if (c->driver_activation)
res = (float)c->driver_activation->max_delay / SPA_USEC_PER_SEC;
pw_log_trace(NAME" %p: max delay %f", client, res);
return res;
} }
SPA_EXPORT SPA_EXPORT
float jack_get_xrun_delayed_usecs (jack_client_t *client) float jack_get_xrun_delayed_usecs (jack_client_t *client)
{ {
pw_log_warn("not implemented"); struct client *c = (struct client *) client;
return 0.0f; float res = 0.0f;
if (c->driver_activation)
res = (float)c->driver_activation->xrun_delay / SPA_USEC_PER_SEC;
pw_log_trace(NAME" %p: xrun delay %f", client, res);
return res;
} }
SPA_EXPORT SPA_EXPORT
void jack_reset_max_delayed_usecs (jack_client_t *client) void jack_reset_max_delayed_usecs (jack_client_t *client)
{ {
pw_log_warn("not implemented"); struct client *c = (struct client *) client;
if (c->driver_activation)
c->driver_activation->max_delay = 0;
} }