diff options
| author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:02:09 -0400 |
|---|---|---|
| committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:41:53 -0400 |
| commit | fccb957780cf9685539b1d0717a5193248b30e48 (patch) | |
| tree | efeb2cfdb990b5250c6b2b76d5db68f89cd4cb3c /src | |
| parent | 0a54a84457bb8a33113c7dd2a2b63b2a837cc92e (diff) | |
Add init_rt_task_param().
Adds init_rt_task_param(). Facilitates setting up default
real-time task attributes that cannot be set by memset(0).
Diffstat (limited to 'src')
| -rw-r--r-- | src/litmus.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/litmus.c b/src/litmus.c index 1110bd4..09f9dc6 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
| @@ -77,6 +77,34 @@ void show_rt_param(struct rt_task* tp) | |||
| 77 | tp->exec_cost, tp->period, tp->cpu); | 77 | tp->exec_cost, tp->period, tp->cpu); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void init_rt_task_param(struct rt_task* tp) | ||
| 81 | { | ||
| 82 | /* Defaults: | ||
| 83 | * - implicit deadline (t->relative_deadline == 0) | ||
| 84 | * - phase = 0 | ||
| 85 | * - class = RT_CLASS_SOFT | ||
| 86 | * - budget policy = NO_ENFORCEMENT | ||
| 87 | * - fixed priority = LITMUS_LOWEST_PRIORITY | ||
| 88 | * - release policy = SPORADIC | ||
| 89 | * - cpu assignment = 0 | ||
| 90 | * | ||
| 91 | * User must still set the following fields to non-zero values: | ||
| 92 | * - tp->exec_cost | ||
| 93 | * - tp->period | ||
| 94 | * | ||
| 95 | * User must set tp->cpu to the appropriate value for non-global | ||
| 96 | * schedulers. For clusters, set tp->cpu to the first CPU in the | ||
| 97 | * assigned cluster. | ||
| 98 | */ | ||
| 99 | |||
| 100 | memset(tp, 0, sizeof(*tp)); | ||
| 101 | |||
| 102 | tp->cls = RT_CLASS_SOFT; | ||
| 103 | tp->priority = LITMUS_LOWEST_PRIORITY; | ||
| 104 | tp->budget_policy = NO_ENFORCEMENT; | ||
| 105 | tp->release_policy = SPORADIC; | ||
| 106 | } | ||
| 107 | |||
| 80 | task_class_t str2class(const char* str) | 108 | task_class_t str2class(const char* str) |
| 81 | { | 109 | { |
| 82 | if (!strcmp(str, "hrt")) | 110 | if (!strcmp(str, "hrt")) |
