[2410424] | 1 | import pandas as pd
|
---|
| 2 | import numpy as np
|
---|
| 3 | import sys
|
---|
| 4 | import os
|
---|
| 5 |
|
---|
| 6 | def parseTestCorpus(dt):
|
---|
| 7 | dt[['test-slug',
|
---|
| 8 | 'sut-platform',
|
---|
| 9 | 'operation',
|
---|
| 10 | 'sut-cfa-level',
|
---|
| 11 | 'sut-cfa-sharing',
|
---|
| 12 | 'op-alloc']] = dt['test'].str.strip().str.split('-', expand=True)
|
---|
| 13 | dt['sut'] = dt[['sut-platform',
|
---|
| 14 | 'sut-cfa-level',
|
---|
| 15 | 'sut-cfa-sharing',
|
---|
| 16 | 'op-alloc']].agg('-'.join, axis=1)
|
---|
| 17 |
|
---|
| 18 | dt[['corpus-basename',
|
---|
| 19 | 'corpus-ext']] = dt['corpus'].str.strip().str.split('.', expand=True)
|
---|
| 20 | dt[['corpus-slug',
|
---|
| 21 | 'corpus-nstrs',
|
---|
| 22 | 'corpus-meanlen',
|
---|
| 23 | 'corpus-runid']] = dt['corpus-basename'].str.strip().str.split('-', expand=True)
|
---|
| 24 | dt["corpus-nstrs"] = pd.to_numeric(dt["corpus-nstrs"])
|
---|
| 25 | dt["corpus-meanlen"] = pd.to_numeric(dt["corpus-meanlen"])
|
---|
| 26 | dt["corpus-runid"] = pd.to_numeric(dt["corpus-runid"])
|
---|
| 27 |
|
---|
| 28 | def loadParseTimingData( infileLocal, xClasNames=[], xClasDtypes={}, xFactNames=[], xFactDtypes={} ):
|
---|
| 29 |
|
---|
| 30 | infile = os.path.dirname(os.path.abspath(__file__)) + '/../benchmarks/string/' + infileLocal
|
---|
| 31 |
|
---|
| 32 | timings = pd.read_csv(
|
---|
| 33 | infile,
|
---|
| 34 | names=['test', 'corpus'] + xClasNames + [ 'concatsPerReset', 'corpusItemCount', 'corpusMeanLenChars', 'concatDoneActualCount', 'execTimeActualSec'] + xFactNames,
|
---|
| 35 | dtype={**xClasDtypes, **xFactDtypes, **{
|
---|
| 36 | 'test': str,
|
---|
| 37 | 'corpus': str,
|
---|
| 38 | 'concatsPerReset': 'Int64', # allows missing; https://stackoverflow.com/a/70626154
|
---|
| 39 | 'corpusItemCount': np.int64,
|
---|
| 40 | 'corpusMeanLenChars': np.float64,
|
---|
| 41 | 'concatDoneActualCount': np.int64,
|
---|
| 42 | 'execTimeActualSec': np.float64,
|
---|
| 43 | 'Q': np.int64}},
|
---|
| 44 |
|
---|
| 45 | na_values=['xxx'],
|
---|
| 46 | )
|
---|
| 47 | # print(timings.head())
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | # project: parse executable and corpus names
|
---|
| 51 |
|
---|
| 52 | parseTestCorpus(timings)
|
---|
| 53 |
|
---|
| 54 | # project: calculate fact
|
---|
| 55 |
|
---|
| 56 | timings['op-duration-s'] = timings['execTimeActualSec'] / timings['concatDoneActualCount']
|
---|
| 57 | timings['op-duration-ns'] = timings['op-duration-s'] * 1000 * 1000 * 1000
|
---|
| 58 |
|
---|
| 59 | return timings
|
---|
| 60 |
|
---|
| 61 | def loadParseSizingData( infileLocal, xClasNames=[], xClasDtypes={}, xFactNames=[], xFactDtypes={} ):
|
---|
| 62 |
|
---|
| 63 | infile = os.path.dirname(os.path.abspath(__file__)) + '/../benchmarks/string/' + infileLocal
|
---|
| 64 |
|
---|
| 65 | sizings = pd.read_csv(
|
---|
| 66 | infile,
|
---|
| 67 | sep=' ',
|
---|
| 68 | names=['test', 'corpus'] + xClasNames + ['ppid', 'pid', 'malloc_count', 'free_count',
|
---|
| 69 | 'calloc_count', 'realloc_count',
|
---|
| 70 | 'requsted_mem(B)', 'current_req_mem(B)', 'hw_cur_req_mem(B)', 'text', 'heap', 'mmap_so', 'mmap',
|
---|
| 71 | 'stack', 'vvar', 'vdso', 'vsyscall', 'unfigured', 'total_dynamic',
|
---|
| 72 | 'epoch_timestamp(ms)'] + xFactNames,
|
---|
| 73 | dtype={**xClasDtypes, **xFactDtypes, **{
|
---|
| 74 | 'test': str,
|
---|
| 75 | 'corpus': str,
|
---|
| 76 | 'ppid': np.int64, 'pid': np.int64, 'malloc_count': np.int64, 'free_count': np.int64,
|
---|
| 77 | 'calloc_count': np.int64, 'realloc_count': np.int64,
|
---|
| 78 | 'requsted_mem(B)': np.int64, 'current_req_mem(B)': np.int64,
|
---|
| 79 | 'hw_cur_req_mem(B)': np.int64, 'text': np.int64, 'heap': np.int64,
|
---|
| 80 | 'mmap_so': np.int64, 'mmap': np.int64,
|
---|
| 81 | 'stack': np.int64, 'vvar': np.int64, 'vdso': np.int64, 'vsyscall': np.int64, 'unfigured': np.int64, 'total_dynamic': np.int64,
|
---|
| 82 | 'epoch_timestamp(ms)': np.int64}}
|
---|
| 83 | )
|
---|
| 84 |
|
---|
| 85 | parseTestCorpus(sizings)
|
---|
| 86 |
|
---|
| 87 | return sizings
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | def loadParseAttribData( infileLocal ):
|
---|
| 91 |
|
---|
| 92 | infile = os.path.dirname(os.path.abspath(__file__)) + '/../benchmarks/string/' + infileLocal
|
---|
| 93 |
|
---|
| 94 | attribs = pd.read_csv(
|
---|
| 95 | infile,
|
---|
| 96 | sep=' ',
|
---|
| 97 | names=[
|
---|
| 98 | "test", "corpus", "expansion", "category", "samples_in_category", "total_samples",
|
---|
| 99 | "fraction", "sources"],
|
---|
| 100 | dtype={
|
---|
| 101 | "test": str,
|
---|
| 102 | "corpus": str,
|
---|
| 103 | "expansion": np.float64,
|
---|
| 104 | "category": str,
|
---|
| 105 | "samples_in_category": np.int64,
|
---|
| 106 | "total_samples": np.int64,
|
---|
| 107 | "fraction": np.float64,
|
---|
| 108 | "sources": str}
|
---|
| 109 | )
|
---|
| 110 |
|
---|
| 111 | parseTestCorpus(attribs)
|
---|
| 112 |
|
---|
| 113 | return attribs
|
---|