Added advanced Heavy Hitter Detection example (#136)
* Added advanced Heavy Hitter Detection example * Changed directory location * Restored skeleton version * Added files for common run infra with the other tutorials * Updated readme * Autogenerate setup rules * Commends in simple_router.p4 * Fix typos * Removed commended out lines
This commit is contained in:
committed by
Antonin Bas
parent
494706bd60
commit
e7e6899d5c
21
Teaching/Stanford_CS344_2018/setup.py
Normal file
21
Teaching/Stanford_CS344_2018/setup.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
from shutil import copyfile
|
||||
|
||||
unit_duration = 20 # log_2 of unit duration (so 2**unit_duration)
|
||||
total_time_bits = 48
|
||||
log_units = 3 # log_2 of number of units
|
||||
units = 2**log_units
|
||||
threshold = 8*1000.0 # in bytes
|
||||
|
||||
copyfile('simple_router.config.template', 'simple_router.config')
|
||||
|
||||
with open('simple_router.config', 'a') as fd:
|
||||
time_mask = (2**(unit_duration+log_units)-1) - (2**unit_duration -1)
|
||||
for unit in range(units):
|
||||
time_value = unit*2**unit_duration
|
||||
if unit < units/2:
|
||||
unit_threshold = int((unit+1) * threshold / units + threshold/2 )
|
||||
else:
|
||||
unit_threshold = int((unit+1) * threshold / units)
|
||||
fd.write('table_add threshold_table set_threshold %d&&&%d => %d 0\n' % (time_value, time_mask, unit_threshold))
|
||||
|
||||
Reference in New Issue
Block a user