diff options
| author | Sven Dziadek <s9svdzia@stud.uni-saarland.de> | 2012-04-14 10:19:37 -0400 |
|---|---|---|
| committer | Sven Dziadek <s9svdzia@stud.uni-saarland.de> | 2012-05-31 16:23:12 -0400 |
| commit | aae25e0770ade4083937c7443448cb3f0023b10a (patch) | |
| tree | bd579d9fadff0a1133eb6e7f156ab0f6e4aa57b1 /src | |
| parent | 8000ef44f4a82d845d5139cebfcac047ee291433 (diff) | |
P-FP: port P-FP plugin used in B. Brandenburg's
dissertation (branch bbb-diss)
I took the unchanged code but removed references
to OMLP which was and is not implemented
tests: changed so that they work for P-FP
Diffstat (limited to 'src')
| -rw-r--r-- | src/litmus.c | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/litmus.c b/src/litmus.c index d3cc6bb..9afe7a2 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
| @@ -10,6 +10,45 @@ | |||
| 10 | #include "litmus.h" | 10 | #include "litmus.h" |
| 11 | #include "internal.h" | 11 | #include "internal.h" |
| 12 | 12 | ||
| 13 | #define LP(name) {name ## _SEM, #name} | ||
| 14 | |||
| 15 | static struct { | ||
| 16 | int id; | ||
| 17 | const char* name; | ||
| 18 | } protocol[] = { | ||
| 19 | LP(FMLP), | ||
| 20 | LP(SRP), | ||
| 21 | LP(MPCP), | ||
| 22 | LP(MPCP_VS), | ||
| 23 | {MPCP_VS_SEM, "MPCP-VS"}, | ||
| 24 | LP(DPCP), | ||
| 25 | }; | ||
| 26 | |||
| 27 | #define NUM_PROTOS (sizeof(protocol)/sizeof(protocol[0])) | ||
| 28 | |||
| 29 | int lock_protocol_for_name(const char* name) | ||
| 30 | { | ||
| 31 | int i; | ||
| 32 | |||
| 33 | for (i = 0; i < NUM_PROTOS; i++) | ||
| 34 | if (strcmp(name, protocol[i].name) == 0) | ||
| 35 | return protocol[i].id; | ||
| 36 | |||
| 37 | return -1; | ||
| 38 | } | ||
| 39 | |||
| 40 | const char* name_for_lock_protocol(int id) | ||
| 41 | { | ||
| 42 | int i; | ||
| 43 | |||
| 44 | for (i = 0; i < NUM_PROTOS; i++) | ||
| 45 | if (protocol[i].id == id) | ||
| 46 | return protocol[i].name; | ||
| 47 | |||
| 48 | return "<UNKNOWN>"; | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 13 | void show_rt_param(struct rt_task* tp) | 52 | void show_rt_param(struct rt_task* tp) |
| 14 | { | 53 | { |
| 15 | printf("rt params:\n\t" | 54 | printf("rt params:\n\t" |
| @@ -42,16 +81,18 @@ int be_migrate_to(int target_cpu) | |||
| 42 | } | 81 | } |
| 43 | 82 | ||
| 44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, | 83 | int sporadic_task(lt_t e, lt_t p, lt_t phase, |
| 45 | int cpu, task_class_t cls, | 84 | int cpu, unsigned int priority, |
| 85 | task_class_t cls, | ||
| 46 | budget_policy_t budget_policy, int set_cpu_set) | 86 | budget_policy_t budget_policy, int set_cpu_set) |
| 47 | { | 87 | { |
| 48 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, | 88 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, |
| 49 | cpu, cls, budget_policy, set_cpu_set); | 89 | cpu, priority, cls, budget_policy, set_cpu_set); |
| 50 | } | 90 | } |
| 51 | 91 | ||
| 52 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | 92 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, |
| 53 | int cpu, task_class_t cls, | 93 | int cpu, unsigned int priority, |
| 54 | budget_policy_t budget_policy, int set_cpu_set) | 94 | task_class_t cls, |
| 95 | budget_policy_t budget_policy, int set_cpu_set) | ||
| 55 | { | 96 | { |
| 56 | struct rt_task param; | 97 | struct rt_task param; |
| 57 | int ret; | 98 | int ret; |
| @@ -67,6 +108,7 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | |||
| 67 | param.cls = cls; | 108 | param.cls = cls; |
| 68 | param.phase = phase; | 109 | param.phase = phase; |
| 69 | param.budget_policy = budget_policy; | 110 | param.budget_policy = budget_policy; |
| 111 | param.priority = priority; | ||
| 70 | 112 | ||
| 71 | if (set_cpu_set) { | 113 | if (set_cpu_set) { |
| 72 | ret = be_migrate_to(cpu); | 114 | ret = be_migrate_to(cpu); |
