aboutsummaryrefslogtreecommitdiffstats
path: root/gen/mc_generators.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-04-25 16:43:49 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2013-04-25 16:43:49 -0400
commit15f231a79320cbc97cd88d8a4751515a47ce223e (patch)
treeb86b202cadc816a5da7b96372b9de4362da88116 /gen/mc_generators.py
parent2ceaa6c607ef85bde4f14017634d9d1621efca29 (diff)
Bug fixes from testing.
Diffstat (limited to 'gen/mc_generators.py')
-rw-r--r--gen/mc_generators.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/gen/mc_generators.py b/gen/mc_generators.py
index 8f5bd84..d8c172d 100644
--- a/gen/mc_generators.py
+++ b/gen/mc_generators.py
@@ -243,8 +243,9 @@ TP_TYPE = """#if $type != 'unmanaged'
243/proc/sys/litmus/color/preempt_cache{0} 243/proc/sys/litmus/color/preempt_cache{0}
244#end if""" 244#end if"""
245 245
246# Always add some pages 246# Now done by experiment.py
247TP_ADD = """/proc/sys/litmus/color/add_pages{1}""" 247# # Always add some pages
248# TP_ADD = """/proc/sys/litmus/color/add_pages{1}"""
248 249
249# Use special spin for color tasks 250# Use special spin for color tasks
250TP_COLOR_BASE = """colorspin -y $t.id -x $t.colorcsv -q $t.wss -l $t.loops """ 251TP_COLOR_BASE = """colorspin -y $t.id -x $t.colorcsv -q $t.wss -l $t.loops """
@@ -253,8 +254,8 @@ TP_COLOR_B = TP_BASE.format("b", TP_COLOR_BASE + "-p $t.cpu ")
253TP_COLOR_C = TP_BASE.format("c", TP_COLOR_BASE) 254TP_COLOR_C = TP_BASE.format("c", TP_COLOR_BASE)
254 255
255# Not even sure job splitting is still possible 256# Not even sure job splitting is still possible
256TP_CHUNK = """#if $chunk_size > 0 257TP_CHUNK = """#if $chunk_size_ns > 0
257/proc/sys/litmus/color/chunk_size{$chunk_size} 258/proc/sys/litmus/color/chunk_size{$chunk_size_ns}
258#end if""" 259#end if"""
259 260
260COLOR_TYPES = ['scheduling', 'locking', 'unmanaged'] 261COLOR_TYPES = ['scheduling', 'locking', 'unmanaged']
@@ -264,7 +265,7 @@ class ColorMcGenerator(McGenerator):
264 265
265 def __init__(self, params = {}): 266 def __init__(self, params = {}):
266 super(ColorMcGenerator, self).__init__("MC", 267 super(ColorMcGenerator, self).__init__("MC",
267 templates=[TP_ADD, TP_TYPE, TP_CHUNK, TP_COLOR_B, TP_COLOR_C], 268 templates=[TP_TYPE, TP_CHUNK, TP_COLOR_B, TP_COLOR_C],
268 options=self.__make_options(), 269 options=self.__make_options(),
269 params=self.__extend_params(params)) 270 params=self.__extend_params(params))
270 271
@@ -336,7 +337,7 @@ class ColorMcGenerator(McGenerator):
336 'System colors (cache size / ways).'), 337 'System colors (cache size / ways).'),
337 GenOption('page_size', int, self.cache.page, 338 GenOption('page_size', int, self.cache.page,
338 'System page size.'), 339 'System page size.'),
339 GenOption('wss', [float, int], .5, 340 GenOption('wss', [float, int], .25,
340 'Task working set sizes. Can be expressed as a fraction ' + 341 'Task working set sizes. Can be expressed as a fraction ' +
341 'of the cache.')] 342 'of the cache.')]
342 343
@@ -359,7 +360,8 @@ class ColorMcGenerator(McGenerator):
359 if pages > cache_pages: 360 if pages > cache_pages:
360 raise Exception('WSS (%d) larger than the cache!' % (wss)) 361 raise Exception('WSS (%d) larger than the cache!' % (wss))
361 362
362 return pages 363 # Divide in half for HRT, SRT divide
364 return pages / 2
363 365
364 366
365 def __make_csv(self, task): 367 def __make_csv(self, task):
@@ -410,11 +412,23 @@ class ColorMcGenerator(McGenerator):
410 hrt_colorer = EvilColorScheme(c, w) 412 hrt_colorer = EvilColorScheme(c, w)
411 srt_colorer = hrt_colorer 413 srt_colorer = hrt_colorer
412 else: 414 else:
415 # Divide cache between hrt and srt
416 c /= 2
413 srt_colorer = RandomColorScheme(c, w) 417 srt_colorer = RandomColorScheme(c, w)
414 hrt_colorer = BlockColorScheme(c, w, way_first=True) 418 hrt_colorer = BlockColorScheme(c, w, way_first=True)
415 419
416 hrt_colorer.color(task_system['lvlb'], pages_needed) 420 hrt_colorer.color(task_system['lvlb'], pages_needed)
417 srt_colorer.color(task_system['lvlc'], pages_needed) 421 srt_colorer.color(task_system['lvlc'], pages_needed)
418 422
423 # This check has saved me a lot of trouble already, leave it in
424 for t in task_system['lvlb'] + task_system['lvlc']:
425 if sum(t.colors.values()) * params['page_size'] < real_wss:
426 raise Exception("Didn't color enough pages for %s" % params)
427
428 if params['type'] != 'unmanaged':
429 # Bump srt into the second half of the cache
430 for t in task_system['lvlc']:
431 t.colors = {colors+c:w for colors, w in t.colors.iteritems()}
432
419 for t in all_tasks: 433 for t in all_tasks:
420 self.__make_csv(t) 434 self.__make_csv(t)