diff options
author | Jeremy Erickson <jerickso@cs.unc.edu> | 2013-11-25 15:46:02 -0500 |
---|---|---|
committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2013-11-25 15:46:02 -0500 |
commit | 470baafab47738cb7b2474b07cbd6d44851a97f7 (patch) | |
tree | 5628724728a6a0be77e474745f94028139a2faa5 | |
parent | 052203a707d0ba828c05b516a7306020a660a98c (diff) |
Fix bug in locking overhead code that used task set in place of its cardinality
-rw-r--r-- | schedcat/overheads/locking.py | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/schedcat/overheads/locking.py b/schedcat/overheads/locking.py index 36ed831..8dce8e2 100644 --- a/schedcat/overheads/locking.py +++ b/schedcat/overheads/locking.py | |||
@@ -8,10 +8,11 @@ def charge_spinlock_overheads(oheads, tasks): | |||
8 | if oheads is None or not tasks: | 8 | if oheads is None or not tasks: |
9 | return tasks | 9 | return tasks |
10 | 10 | ||
11 | ntasks = len(tasks) | ||
11 | # the individual charges | 12 | # the individual charges |
12 | rcost = oheads.read_lock(tasks) + oheads.read_unlock(tasks) | 13 | rcost = oheads.read_lock(ntasks) + oheads.read_unlock(ntasks) |
13 | wcost = oheads.lock(tasks) + oheads.unlock(tasks) | 14 | wcost = oheads.lock(ntasks) + oheads.unlock(ntasks) |
14 | scost = oheads.syscall_in(tasks) + oheads.syscall_out(tasks) | 15 | scost = oheads.syscall_in(ntasks) + oheads.syscall_out(ntasks) |
15 | 16 | ||
16 | # inflate each request and each task's exec cost | 17 | # inflate each request and each task's exec cost |
17 | for t in tasks: | 18 | for t in tasks: |
@@ -40,13 +41,14 @@ def charge_semaphore_overheads(oheads, preemptive, suspension_aware, tasks): | |||
40 | if oheads is None or not tasks: | 41 | if oheads is None or not tasks: |
41 | return tasks | 42 | return tasks |
42 | 43 | ||
43 | lock = oheads.lock(tasks) | 44 | ntasks = len(tasks) |
44 | unlock = oheads.unlock(tasks) | 45 | lock = oheads.lock(ntasks) |
45 | sysin = oheads.syscall_in(tasks) | 46 | unlock = oheads.unlock(ntasks) |
46 | sysout = oheads.syscall_out(tasks) | 47 | sysin = oheads.syscall_in(ntasks) |
47 | sched = oheads.schedule(tasks) + oheads.ctx_switch(tasks) | 48 | sysout = oheads.syscall_out(ntasks) |
48 | cpmd = oheads.cache_affinity_loss(tasks) | 49 | sched = oheads.schedule(ntasks) + oheads.ctx_switch(ntasks) |
49 | ipi = oheads.ipi_latency(tasks) | 50 | cpmd = oheads.cache_affinity_loss(ntasks) |
51 | ipi = oheads.ipi_latency(ntasks) | ||
50 | 52 | ||
51 | # per-request execution cost increase (equ 7.3) | 53 | # per-request execution cost increase (equ 7.3) |
52 | # 3 sched: wait + resume + yield | 54 | # 3 sched: wait + resume + yield |
@@ -106,13 +108,14 @@ def charge_dpcp_overheads(oheads, tasks): | |||
106 | if oheads is None or not tasks: | 108 | if oheads is None or not tasks: |
107 | return tasks | 109 | return tasks |
108 | 110 | ||
109 | lock = oheads.lock(tasks) | 111 | ntasks = len(tasks) |
110 | unlock = oheads.unlock(tasks) | 112 | lock = oheads.lock(ntasks) |
111 | sysin = oheads.syscall_in(tasks) | 113 | unlock = oheads.unlock(ntasks) |
112 | sysout = oheads.syscall_out(tasks) | 114 | sysin = oheads.syscall_in(ntasks) |
113 | sched = oheads.schedule(tasks) + oheads.ctx_switch(tasks) | 115 | sysout = oheads.syscall_out(ntasks) |
114 | cpmd = oheads.cache_affinity_loss(tasks) | 116 | sched = oheads.schedule(ntasks) + oheads.ctx_switch(ntasks) |
115 | ipi = oheads.ipi_latency(tasks) | 117 | cpmd = oheads.cache_affinity_loss(ntasks) |
118 | ipi = oheads.ipi_latency(ntasks) | ||
116 | 119 | ||
117 | 120 | ||
118 | exec_increase = sysin + sysout + 2 * sched + 2 * cpmd | 121 | exec_increase = sysin + sysout + 2 * sched + 2 * cpmd |