Example #1
0
#!/usr/bin/env python

import sys
import os
from os.path import join as pjoin

assert os.environ.has_key("ROOT")
sys.path.insert(0, pjoin(os.environ["ROOT"], "benchmark"))

from properties import *
import text

assert len(sys.argv) == 2
app_path = sys.argv[1]
assert os.path.isdir(app_path)

platform = os.environ["PLATFORM"]
toolchain = os.environ["TOOLCHAIN"]
setup = Setup(platform, toolchain, app_path)

native = setup.native_properties("native.c", "native.elf")
tc = setup.tcode_properties("tc.c")
ec = setup.ecode_properties("ec.c", "pal.c", "ec.elf")
pal = setup.pal_properties("pal.c", "pal.o")
overhead = get_overhead(native, tc, ec)
normalized = get_normalized(native, ec, pal)

f = open("bench.%s.results" % platform, "w")
text.print_all_properties(f, [native, tc, ec, pal, overhead, normalized]) 
f.close()
Example #2
0
assert len(sys.argv) == 2
app_path = sys.argv[1]
assert os.path.isdir(app_path)

platform = "contiki"
toolchain = "schroot -c contiki -- msp430-"
setup = Setup(platform, toolchain, app_path)

def np(f):
    return os.path.join("native", f)

def gp(f):
    return os.path.join("generated", f)

def rp(f):
    return os.path.join("runtime", f)

nat = setup.native_properties(np("app.c"), np("app.sky"))
tc = setup.tcode_properties(gp("app-tc.c"), gp("app-ec.c"), gp("pal.sky"))
pal = setup.pal_properties(gp("pal.c"), gp("pal.co"))
tl = setup.tl_properties(rp("app.c"), rp("pal.sky"))

nat2tc = nat.proportion(tc)
nat2tc_pal = nat.proportion(tc.subtract(pal))
tc2tl = tc.proportion(tl)

f = open("bench.results", "w")
text.print_all_properties(f, [nat, tc, tl, pal, nat2tc, nat2tc_pal, tc2tl])
text.export_all_properties(f, os.path.basename(app_path), [nat, tc, tl, pal])
f.close()