summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamir Shaykhutdinov <damir@altlinux.org>2016-12-26 19:17:37 +0300
committervingu-linaro <vincent.guittot@linaro.org>2017-01-04 15:16:37 +0100
commitd15c5f394b957d370157046fbcaa010dec2a559e (patch)
treedb65f72d400f164d0f60189ebb25b0e0a156dbfb
parent793cc89c77f3d7586f6dbbfea7eb88c30db38868 (diff)
downloadrt-app-d15c5f394b957d370157046fbcaa010dec2a559e.tar.gz
rt-app: added support for "yield" event
"yield" event simply calls pthread_yield() This has a special meaning for SCHED_DEADLINE tasks
-rw-r--r--doc/tutorial.txt2
-rw-r--r--src/rt-app.c6
-rw-r--r--src/rt-app_parse_config.c6
-rw-r--r--src/rt-app_types.h1
4 files changed, 15 insertions, 0 deletions
diff --git a/doc/tutorial.txt b/doc/tutorial.txt
index 54488a0..b39666d 100644
--- a/doc/tutorial.txt
+++ b/doc/tutorial.txt
@@ -431,6 +431,8 @@ the right thread's name before starting the use case.
taskA ...|run 5|suspend |----------------|run 5|suspend |----------------
taskB ...-------------------|resume taskA|run 10 |--------------------
+* yield: String. Calls pthread_yield(), freeing the CPU for other tasks. This has a
+special meaning for SCHED_DEADLINE tasks. String can be empty.
**** Trace and Log ****
diff --git a/src/rt-app.c b/src/rt-app.c
index 2a96169..0f992f5 100644
--- a/src/rt-app.c
+++ b/src/rt-app.c
@@ -376,6 +376,12 @@ static int run_event(event_data_t *event, int dry_run,
ioload(event->count, &rdata->res.buf, ddata->res.dev.fd);
}
break;
+ case rtapp_yield:
+ {
+ log_debug("yield %d", event->count);
+ pthread_yield();
+ }
+ break;
}
return lock;
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c
index 2b27f64..83794f3 100644
--- a/src/rt-app_parse_config.c
+++ b/src/rt-app_parse_config.c
@@ -546,6 +546,11 @@ parse_thread_event_data(char *name, struct json_object *obj,
log_info(PIN2 "type %d target %s [%d] mutex %s [%d]", data->type, rdata->name, rdata->index, ddata->name, ddata->index);
return;
}
+ if (!strncmp(name, "yield", strlen("yield"))) {
+ data->type = rtapp_yield;
+ log_info(PIN2 "type %d", data->type);
+ return;
+ }
unknown_resource:
log_error(PIN2 "Resource %s not found in the resource section !!!", ref);
@@ -573,6 +578,7 @@ static char *events[] = {
"resume",
"mem",
"iorun",
+ "yield",
NULL
};
diff --git a/src/rt-app_types.h b/src/rt-app_types.h
index 1eb9467..5b8345f 100644
--- a/src/rt-app_types.h
+++ b/src/rt-app_types.h
@@ -68,6 +68,7 @@ typedef enum resource_t
rtapp_mem,
rtapp_iorun,
rtapp_runtime,
+ rtapp_yield
} resource_t;
struct _rtapp_mutex {