Example #1
0
 def setUp(self):
     self.ms = machinestate.MachineState()
     self.ms.generate()
     self.ms.update()
     data = self.ms.get()
     if data["OperatingSystemInfo"]["Type"] == "Linux":
         self.ci = machinestate.CpuInfo()
         self.ci.generate()
         self.ci.update()
     else:
         self.ci = machinestate.CpuInfoMacOS()
         self.ci.generate()
         self.ci.update()
def main(basepath, kernels=None):
    os.chdir(basepath)
    os.makedirs("results/", exist_ok=True)
    ms = machinestate.MachineState()
    ms.generate()
    ms.update()
    ms_dict = ms.get()
    hostname = get_hostname()

    for kernel, args in get_kernels(kernels):
        print(kernel, end=": ", flush=True)
        data = []
        filename = "results/" + hostname + "_" + kernel + ".pkl.gz"
        if os.path.exists(filename):
            print("skipping ({} already exists)".format(filename))
            continue
        build_kernel(kernel)
        with open(f'build/{kernel}.{platform.machine()}', 'rb') as f:
            kernel_bin = f.read()
        with open('kernels/' + kernel + '.c', 'r') as f:
            kernel_src = f.read()
        print("built", end=" ", flush=True)
        cache_metric_results_per_cl, global_infos, rr = run_kernel(
            kernel, args)
        for kernel_info, cmrpcl in cache_metric_results_per_cl.items():
            kernel_name, repeats, *dimensions = kernel_info.split('_')
            row = {
                'hostname': hostname,
                'kernel': kernel_name,
                'dimensions': dimensions,
                'repeats': repeats,
                'source': 'measured'
            }
            row.update(global_infos)
            for cache, metrics in sorted(
                    cache_metric_results_per_cl[kernel_info].items()):
                for k, v in sorted(metrics.items()):
                    row[cache + '_' + k] = float(v)
                    row[cache + '_' + k + '.unit'] = v.unit
            row['raw'] = rr
            row['machinestate'] = ms_dict
            row['binary'] = kernel_bin
            row['benchcode'] = kernel_src
            data.append(row)
        df = pandas.DataFrame(data)
        df.to_pickle(filename, protocol=4)
        print("saved ({})".format(filename))
    clean()
Example #3
0
import sys
#import numpy as np
import product
import machinestate

ms = machinestate.MachineState()
pr = product.Product()
ga = product.GreenteaDrinkA()
gb = product.GreenteaDrinkB()
gc = product.GreenteaDrinkC()
gd = product.GreenteaDrinkD()
rt = product.RedTeaDrink()
rb = product.RedbullDrink()
sy = product.SoyDrink()

ms.accept('10')
ga._label = 'a'
gb._label = 'b'
gc._label = 'c'
gd._label = 'd'

plist = [ga, gb, gc, gd]
ldict = dict()


def pannel(im):

    print("\ncurrent balance: {0}".format(ms.balance))
    for i in plist:
        if ((ms.balance >= i._price) and (i._balance > 0)):
            i._aoruna = 'available'
Example #4
0
 def setUp(self):
     self.ms = machinestate.MachineState()
     self.ms.generate()
     self.ms.update()
Example #5
0
 def test_repr(self):
     ms = machinestate.MachineState(extended=True)
     ms.generate()
     print("")
     print(ms)
     test_repr_sub(ms, 1)