aboutsummaryrefslogtreecommitdiff
path: root/src/dj_trace.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/dj_trace.py')
-rw-r--r--src/dj_trace.py70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/dj_trace.py b/src/dj_trace.py
index f4265ea..784b16f 100644
--- a/src/dj_trace.py
+++ b/src/dj_trace.py
@@ -1,12 +1,9 @@
import matplotlib.pyplot as plt
-import matplotlib.ticker as ticker
-import multiprocessing
import numpy as np
import os
from urllib.request import urlretrieve
import sys
import re
-import shutil
from src.benchmark import Benchmark
@@ -24,21 +21,22 @@ calloc_re = re.compile("^Avg calloc time:\s*{} in.*calls$".format(time_re))
realloc_re = re.compile("^Avg realloc time:\s*{} in.*calls$".format(time_re))
free_re = re.compile("^Avg free time:\s*{} in.*calls$".format(time_re))
-class Benchmark_DJ_Trace( Benchmark ):
+
+class Benchmark_DJ_Trace(Benchmark):
def __init__(self):
self.name = "dj_trace"
self.descrition = """This benchmark uses the workload simulator written
- by DJ Delorie to simulate workloads provided by him
- under https://delorie.com/malloc. Those workloads
- are generated from traces of real aaplications and are
- also used by delorie to measure improvements in the
- glibc allocator.""",
+ by DJ Delorie to simulate workloads provided by
+ him under https://delorie.com/malloc. Those
+ workloads are generated from traces of real
+ aplications and are also used by delorie to
+ measure improvements in the glibc allocator."""
self.cmd = "trace_run{binary_suffix} dj_workloads/{workload}.wl"
self.measure_cmd = ""
self.args = {
- "workload" : [
+ "workload": [
"389-ds-2",
"dj",
"dj2",
@@ -53,31 +51,33 @@ class Benchmark_DJ_Trace( Benchmark ):
self.results = {
"389-ds-2": {
"malloc": 170500018, "calloc": 161787184,
- "realloc": 404134, "free": 314856324, "threads": 41},
+ "realloc": 404134, "free": 314856324,
+ "threads": 41},
"dj": {
"malloc": 2000000, "calloc": 200, "realloc": 0,
"free": 2003140, "threads": 201},
"dj2": {
- "malloc":29263321, "calloc": 3798404, "realloc":122956,
- "free": 32709054, "threads":36},
+ "malloc": 29263321, "calloc": 3798404,
+ "realloc": 122956, "free": 32709054,
+ "threads": 36},
"mt_test_one_alloc": {
- "malloc":524290, "calloc": 1, "realloc":0,
- "free":594788, "threads":2},
+ "malloc": 524290, "calloc": 1, "realloc": 0,
+ "free": 594788, "threads": 2},
"oocalc": {
- "malloc":6731734, "calloc": 38421, "realloc":14108,
- "free":6826686, "threads":88},
+ "malloc": 6731734, "calloc": 38421,
+ "realloc": 14108, "free": 6826686, "threads": 88},
"qemu-virtio": {
- "malloc":1772163, "calloc": 146634,
- "realloc":59813, "free":1954732, "threads":3},
+ "malloc": 1772163, "calloc": 146634,
+ "realloc": 59813, "free": 1954732, "threads": 3},
"qemu-win7": {
- "malloc":980904, "calloc": 225420,
- "realloc":89880, "free":1347825, "threads":6},
+ "malloc": 980904, "calloc": 225420,
+ "realloc": 89880, "free": 1347825, "threads": 6},
"proprietary-1": {
- "malloc":316032131, "calloc": 5642, "realloc":84,
- "free":319919727, "threads":20},
+ "malloc": 316032131, "calloc": 5642, "realloc": 84,
+ "free": 319919727, "threads": 20},
"proprietary-2": {
- "malloc":9753948, "calloc": 4693,
- "realloc":117, "free":10099261, "threads": 19},
+ "malloc": 9753948, "calloc": 4693,
+ "realloc": 117, "free": 10099261, "threads": 19},
}
self.requirements = ["trace_run"]
@@ -91,9 +91,9 @@ class Benchmark_DJ_Trace( Benchmark ):
if totalsize > 0:
percent = readsofar * 1e2 / totalsize
s = "\r%5.1f%% %*d / %d" % (
- percent, len(str(totalsize)), readsofar, totalsize)
+ percent, len(str(totalsize)), readsofar, totalsize)
sys.stderr.write(s)
- else: # total size is unknown
+ else: # total size is unknown
sys.stderr.write("\rdownloaded %d" % (readsofar,))
if not os.path.isdir("dj_workloads"):
@@ -113,8 +113,8 @@ class Benchmark_DJ_Trace( Benchmark ):
def to_int(s):
return int(s.replace(',', ""))
- regexs = {7:malloc_re ,8:calloc_re, 9:realloc_re, 10:free_re}
- functions = {7:"malloc", 8:"calloc", 9:"realloc", 10:"free"}
+ regexs = {7: malloc_re, 8: calloc_re, 9: realloc_re, 10: free_re}
+ functions = {7: "malloc", 8: "calloc", 9: "realloc", 10: "free"}
for i, l in enumerate(stdout.splitlines()):
if i == 2:
result["cputime"] = to_int(cpu_time_re.match(l).group("time"))
@@ -161,10 +161,11 @@ class Benchmark_DJ_Trace( Benchmark ):
label=target, color=targets[target]["color"])
plt.legend(loc="best")
- plt.xticks(xa + 1/len(targets)*2, ["malloc\n" + str(self.results[perm.workload]["malloc"]) + "\ncalls",
- "calloc\n" + str(self.results[perm.workload]["calloc"]) + "\ncalls",
- "realloc\n" + str(self.results[perm.workload]["realloc"]) + "\ncalls",
- "free\n" + str(self.results[perm.workload]["free"]) + "\ncalls"])
+ plt.xticks(xa + 1/len(targets)*2,
+ ["malloc\n" + str(self.results[perm.workload]["malloc"]) + "\ncalls",
+ "calloc\n" + str(self.results[perm.workload]["calloc"]) + "\ncalls",
+ "realloc\n" + str(self.results[perm.workload]["realloc"]) + "\ncalls",
+ "free\n" + str(self.results[perm.workload]["free"]) + "\ncalls"])
plt.ylabel("Durchschnittliche Zeit in cycles")
plt.title("Durchscnittliche Laufzeiten der API Funktionen")
plt.savefig(".".join([self.name, perm.workload, "apitimes", "png"]))
@@ -208,7 +209,7 @@ class Benchmark_DJ_Trace( Benchmark ):
fname = ".".join([self.name, perm.workload, "table.tex"])
with open(fname, "w") as f:
- print("\\begin{tabular}{| l | l | l |}" , file=f)
+ print("\\begin{tabular}{| l | l | l |}", file=f)
print("& Zeit (ms) / $\\sigma$ (\\%) & VmHWM (KB) / $\\sigma$ (\\%) \\\\", file=f)
print("\\hline", file=f)
@@ -238,4 +239,5 @@ class Benchmark_DJ_Trace( Benchmark ):
print("\end{tabular}", file=f)
+
dj_trace = Benchmark_DJ_Trace()