Browse Source

added "cpu_load" measurement

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@170 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 23 years ago
parent
commit
ca1543e493
5 changed files with 21 additions and 4 deletions
  1. +6
    -0
      client.c
  2. +2
    -2
      configure.in
  3. +6
    -2
      engine.c
  4. +1
    -0
      jack/internal.h
  5. +6
    -0
      jack/jack.h

+ 6
- 0
client.c View File

@@ -1790,3 +1790,9 @@ jack_get_mhz (void)
} }
} }
} }

float
jack_cpu_load (jack_client_t *client)
{
return client->engine->cpu_load;
}

+ 2
- 2
configure.in View File

@@ -4,8 +4,8 @@ AC_INIT(client.c)
AC_CONFIG_AUX_DIR(.) AC_CONFIG_AUX_DIR(.)


JACK_MAJOR_VERSION=0 JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=25
JACK_MICRO_VERSION=1
JACK_MINOR_VERSION=26
JACK_MICRO_VERSION=0


BETA= BETA=




+ 6
- 2
engine.c View File

@@ -586,8 +586,11 @@ jack_process (jack_engine_t *engine, nframes_t nframes)
engine->spare_usecs = 0; engine->spare_usecs = 0;
} }


engine->control->cpu_load = (1.0f - (engine->spare_usecs / engine->driver->period_usecs)) * 100.0f;

if (engine->verbose) { if (engine->verbose) {
fprintf (stderr, "average usecs: %.3f, spare = %.3f\n", average_usecs, engine->spare_usecs);
fprintf (stderr, "load = %.4f average usecs: %.3f, spare = %.3f\n",
engine->control->cpu_load, average_usecs, engine->spare_usecs);
} }
} }
} }
@@ -1205,7 +1208,7 @@ jack_engine_new (int realtime, int rtpriority, int verbose)
engine->verbose = verbose; engine->verbose = verbose;
engine->asio_mode = FALSE; engine->asio_mode = FALSE;
engine->cpu_mhz = jack_get_mhz(); engine->cpu_mhz = jack_get_mhz();
jack_engine_reset_rolling_usecs (engine); jack_engine_reset_rolling_usecs (engine);


pthread_mutex_init (&engine->client_lock, 0); pthread_mutex_init (&engine->client_lock, 0);
@@ -1278,6 +1281,7 @@ jack_engine_new (int realtime, int rtpriority, int verbose)
engine->control->port_max = engine->port_max; engine->control->port_max = engine->port_max;
engine->control->real_time = realtime; engine->control->real_time = realtime;
engine->control->client_priority = engine->rtpriority - 1; engine->control->client_priority = engine->rtpriority - 1;
engine->control->cpu_load = 0;
engine->control->buffer_size = 0; engine->control->buffer_size = 0;
engine->control->time.frame_rate = 0; engine->control->time.frame_rate = 0;


+ 1
- 0
jack/internal.h View File

@@ -80,6 +80,7 @@ typedef struct {
unsigned long buffer_size; unsigned long buffer_size;
char real_time; char real_time;
int client_priority; int client_priority;
float cpu_load;
unsigned long port_max; unsigned long port_max;
jack_port_shared_t ports[0]; jack_port_shared_t ports[0];




+ 6
- 0
jack/jack.h View File

@@ -517,6 +517,12 @@ void jack_update_time (jack_client_t *, nframes_t);


nframes_t jack_frames_since_cycle_start (jack_client_t *); nframes_t jack_frames_since_cycle_start (jack_client_t *);


/**
* This returns the current CPU load estimated by JACK
* as a percentage.
*/
float jack_cpu_load (jack_client_t *client);

#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif


Loading…
Cancel
Save