aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-03-12 13:13:22 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-03-12 13:42:34 -0400
commit0e71f86251307a37161cf3de2704a59882e25258 (patch)
treef6f28c6c1f9ff2edc68b64c164575728aa349bba /include
parentfccb957780cf9685539b1d0717a5193248b30e48 (diff)
Change convenience API routines.
The sproadic_*() macros have become unwieldy. This patch replaces those convenience macros for global, clustered, and partitioned scheduling. A part of this API change is the explicit use of nanosecond time-values. Prior APIs have used lt_t (litmus time), which had an implied time scale of nanoseconds. /bin apps and test suite also updated to use revised API. Modifications to the test suite are mostly centered around using nanoseconds instead of milliseconds.
Diffstat (limited to 'include')
-rw-r--r--include/litmus.h57
1 files changed, 15 insertions, 42 deletions
diff --git a/include/litmus.h b/include/litmus.h
index 429e614..1009805 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -18,7 +18,6 @@ extern "C" {
18 18
19#include "migration.h" 19#include "migration.h"
20 20
21
22void init_rt_task_param(struct rt_task* param); 21void init_rt_task_param(struct rt_task* param);
23int set_rt_task_param(pid_t pid, struct rt_task* param); 22int set_rt_task_param(pid_t pid, struct rt_task* param);
24int get_rt_task_param(pid_t pid, struct rt_task* param); 23int get_rt_task_param(pid_t pid, struct rt_task* param);
@@ -30,40 +29,21 @@ int get_rt_task_param(pid_t pid, struct rt_task* param);
30int partition_to_cpu(int partition); 29int partition_to_cpu(int partition);
31int cluster_to_first_cpu(int cluster, int cluster_size); 30int cluster_to_first_cpu(int cluster, int cluster_size);
32 31
33/* setup helper */ 32/* Convenience functions for setting up real-time tasks.
34 33 * Default behaviors set by init_rt_task_params() used.
35/* Times are given in ms. The 'priority' parameter 34 * Also sets affinity masks for clustered/partitions
36 * is only relevant under fixed-priority scheduling (and 35 * functions. Time units in nanoseconds. */
37 * ignored by other plugins). The task_class_t parameter 36int sporadic_global(lt_t e_ns, lt_t p_ns);
38 * is ignored by most plugins. 37int sporadic_partitioned(lt_t e_ns, lt_t p_ns, int partition);
39 */ 38int sporadic_clustered(lt_t e_ns, lt_t p_ns, int cluster, int cluster_size);
40int sporadic_task( 39
41 lt_t e, lt_t p, lt_t phase, 40/* simple time unit conversion macros */
42 int cluster, int cluster_size, unsigned int priority, 41#define s2ns(s) ((s)*1000000000LL)
43 task_class_t cls, 42#define s2us(s) ((s)*1000000LL)
44 budget_policy_t budget_policy, int be_migrate); 43#define s2ms(s) ((s)*1000LL)
45 44#define ms2ns(ms) ((ms)*1000000LL)
46/* Times are given in ns. The 'priority' parameter 45#define ms2us(ms) ((ms)*1000LL)
47 * is only relevant under fixed-priority scheduling (and 46#define us2ns(us) ((us)*1000LL)
48 * ignored by other plugins). The task_class_t parameter
49 * is ignored by most plugins.
50 */
51int sporadic_task_ns(
52 lt_t e, lt_t p, lt_t phase,
53 int cluster, int cluster_size, unsigned int priority,
54 task_class_t cls,
55 budget_policy_t budget_policy, int be_migrate);
56
57/* Convenience macros. Budget enforcement off by default in these macros. */
58#define sporadic_global(e, p) \
59 sporadic_task(e, p, 0, 0, 0, LITMUS_LOWEST_PRIORITY, \
60 RT_CLASS_SOFT, NO_ENFORCEMENT, 0)
61#define sporadic_partitioned(e, p, partition) \
62 sporadic_task(e, p, 0, partition, 1, LITMUS_LOWEST_PRIORITY, \
63 RT_CLASS_SOFT, NO_ENFORCEMENT, 1)
64#define sporadic_clustered(e, p, cluster, cluster_size) \
65 sporadic_task(e, p, 0, cluster, cluster_size, LITMUS_LOWEST_PRIORITY, \
66 RT_CLASS_SOFT, NO_ENFORCEMENT, 1)
67 47
68/* file descriptor attached shared objects support */ 48/* file descriptor attached shared objects support */
69typedef enum { 49typedef enum {
@@ -140,13 +120,6 @@ int release_ts(lt_t *delay);
140int get_nr_ts_release_waiters(void); 120int get_nr_ts_release_waiters(void);
141int read_litmus_stats(int *ready, int *total); 121int read_litmus_stats(int *ready, int *total);
142 122
143#define __NS_PER_MS 1000000
144
145static inline lt_t ms2lt(unsigned long milliseconds)
146{
147 return __NS_PER_MS * milliseconds;
148}
149
150/* sleep for some number of nanoseconds */ 123/* sleep for some number of nanoseconds */
151int lt_sleep(lt_t timeout); 124int lt_sleep(lt_t timeout);
152 125