diff options
author | Mac Mollison <mollison@cs.unc.edu> | 2010-02-10 01:51:18 -0500 |
---|---|---|
committer | Mac Mollison <mollison@cs.unc.edu> | 2010-02-10 01:51:18 -0500 |
commit | 29e745481c6d4fc59a2c6e4c81f8d49777d8230b (patch) | |
tree | 0791df38847b8d35a397722aafcbbca65dda1049 | |
parent | cfb9db951084524ca8bb66ce05583a4eaa3383a6 (diff) |
Bugfix in sanitizer
-rw-r--r-- | sanitizer.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sanitizer.py b/sanitizer.py index d1764dd..c9f79bf 100644 --- a/sanitizer.py +++ b/sanitizer.py | |||
@@ -10,7 +10,10 @@ | |||
10 | ############################################################################### | 10 | ############################################################################### |
11 | 11 | ||
12 | def sanitizer(stream): | 12 | def sanitizer(stream): |
13 | jobs_released = [] | 13 | |
14 | job_2s_released = [] # list of tasks which have released their job 2s | ||
15 | jobs_switched_to = [] | ||
16 | |||
14 | for record in stream: | 17 | for record in stream: |
15 | 18 | ||
16 | # All records with job < 2 are garbage | 19 | # All records with job < 2 are garbage |
@@ -22,25 +25,24 @@ def sanitizer(stream): | |||
22 | 25 | ||
23 | # There is a duplicate release of every job 2 | 26 | # There is a duplicate release of every job 2 |
24 | # This will throw away the second one | 27 | # This will throw away the second one |
25 | if (record.type_name == 'release' and | 28 | if record.type_name == 'release': |
26 | (record.pid,record.job) in jobs_released): | 29 | if record.pid in job_2s_released: |
27 | continue | 30 | continue |
31 | else: | ||
32 | job_2s_released.append(record.pid) | ||
28 | 33 | ||
29 | # Job 2 has a resume that is garbage | 34 | # Job 2 has a resume that is garbage |
30 | if record.type_name == 'resume': | 35 | if record.type_name == 'resume': |
31 | continue | 36 | continue |
32 | 37 | ||
33 | # Record job releases. This helps with filtering out | ||
34 | # the second release of job 2 and renumbering final switch_aways | ||
35 | # (see below). | ||
36 | if record.type_name == 'release': | ||
37 | jobs_released.append((record.pid,record.job)) | ||
38 | |||
39 | # By default, the switch_away for a job (after it has completed) | 38 | # By default, the switch_away for a job (after it has completed) |
40 | # is maked as being for job+1, which has not been released. | 39 | # is maked as being for job+1, which has never been switched to. |
41 | # Correct this. | 40 | # We can correct this if we note which jobs really |
41 | # have been switched to. | ||
42 | if record.type_name == 'switch_to': | ||
43 | jobs_switched_to.append((record.pid,record.job)) | ||
42 | if record.type_name == 'switch_away': | 44 | if record.type_name == 'switch_away': |
43 | if (record.pid,record.job) not in jobs_released: | 45 | if (record.pid,record.job) not in jobs_switched_to: |
44 | record.job -= 1 | 46 | record.job -= 1 |
45 | 47 | ||
46 | yield record | 48 | yield record |