diff options
author | Javi Merino <javi.merino@arm.com> | 2016-07-13 14:07:11 +0100 |
---|---|---|
committer | Juri Lelli <juri.lelli@gmail.com> | 2016-10-31 10:06:46 +0000 |
commit | fa353e15a8b01196a8aee3a7e909004862a20f6f (patch) | |
tree | fe43366a20eb1b42a24ac15eca1a107ce0abd9f6 /src | |
parent | b194839fb9271d47c8100f98352789c8ba4e4d3a (diff) |
rt-app: add a runtime event
The runtime event emulates the execution of a load for a specific amount
of time irrespective of the compute capacity of the CPU it is run on or
the frequency.
Signed-off-by: Javi Merino <javi.merino@arm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/rt-app.c | 20 | ||||
-rw-r--r-- | src/rt-app_parse_config.c | 3 | ||||
-rw-r--r-- | src/rt-app_types.h | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index 679d39a..5283ac7 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -274,6 +274,26 @@ static int run_event(event_data_t *event, int dry_run, *duration += timespec_to_usec(&t_end); } break; + case rtapp_runtime: + { + struct timespec t_start, t_end; + int64_t diff_ns; + + log_debug("runtime %d ", event->duration); + clock_gettime(CLOCK_MONOTONIC, &t_start); + + do { + /* Do work for 32usec */ + *perf += loadwait(32); + + clock_gettime(CLOCK_MONOTONIC, &t_end); + diff_ns = timespec_sub_to_ns(&t_end, &t_start); + } while ((diff_ns / 1000) < event->duration); + + t_end = timespec_sub(&t_end, &t_start); + *duration += timespec_to_usec(&t_end); + } + break; case rtapp_timer: { struct timespec t_period, t_now; diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index 99b0e5e..c59b562 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -348,6 +348,8 @@ parse_thread_event_data(char *name, struct json_object *obj, if (!strncmp(name, "sleep", strlen("sleep"))) data->type = rtapp_sleep; + else if (!strncmp(name, "runtime", strlen("runtime"))) + data->type = rtapp_runtime; else data->type = rtapp_run; @@ -558,6 +560,7 @@ static char *events[] = { "broad", "sync", "sleep", + "runtime", "run", "timer", "suspend", diff --git a/src/rt-app_types.h b/src/rt-app_types.h index 2ce9c9d..57fb80d 100644 --- a/src/rt-app_types.h +++ b/src/rt-app_types.h @@ -67,6 +67,7 @@ typedef enum resource_t rtapp_resume, rtapp_mem, rtapp_iorun, + rtapp_runtime, } resource_t; struct _rtapp_mutex { |