aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/cfrac.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-05-06 16:56:32 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-06-02 11:18:47 +0200
commit8174a918ea3b7cb216bf7ea98cfdc10661b5c37d (patch)
tree0747ec3ccb9f8d7eeccfac35977fc17855ca3bbb /src/benchmarks/cfrac.py
parent8f52e8fc02dd235582f5961941bcd564e9a681cd (diff)
downloadallocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.tar.gz
allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.zip
make the whole project more python idiomatic
* rename src directory to allocbench * make global variable names UPPERCASE * format a lot of code using yapf * use lowercase ld_preload and ld_library_path as Allocator members * name expected Errors 'err' and don't raise a new Exception * disable some pylint messages
Diffstat (limited to 'src/benchmarks/cfrac.py')
-rw-r--r--src/benchmarks/cfrac.py126
1 files changed, 0 insertions, 126 deletions
diff --git a/src/benchmarks/cfrac.py b/src/benchmarks/cfrac.py
deleted file mode 100644
index 1f495e6..0000000
--- a/src/benchmarks/cfrac.py
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de>
-#
-# This file is part of allocbench.
-#
-# allocbench is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# allocbench is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with allocbench. If not, see <http://www.gnu.org/licenses/>.
-"""cfrac is a single threaded implementation of the continued fraction factorization algorithm,
-described by Zorn and Grunwald in their paper "Empirical Measurements of Six Allocation-intensive C Programs" in 1992.
-
-It is mentioned in:
-* Dirk Grunwald et al. - 1992 - CustoMalloc: Efficient Synthesized Memory Allocators
-* Emery Berger et al. - 2001 - Composing High-Performance Memory Allocators
-* Emery Berger et al. - 2002 - Reconsidering Custom Memory Allocation
-* Jason Evans - 2006 - A Scalable Concurrent malloc(3) Implementation for FreeBSD
-* Daan Leijen et al. - 2019 - Mimalloc: Free List Sharding in Action
-
-It uses many small short-lived allocations.
-Factorizing 175451865205073170563711388363274837927895 results in
-43044885 allocator calls (malloc: 21522444, free: 21522441).
-
-Allocator portion of total cycles measured using perf record/report:
-malloc 4.33%
-free 7.74%
-
-Top 10 allocation sizes 99.95% of all allocations
-1. 18 B occurred 8172763 times
-2. 28 B occurred 3781894 times
-3. 10 B occurred 2989673 times
-4. 26 B occurred 2566937 times
-5. 20 B occurred 2420915 times
-6. 16 B occurred 1168569 times
-7. 12 B occurred 203177 times
-8. 14 B occurred 170914 times
-9. 30 B occurred 21149 times
-10. 44 B occurred 15922 times
-
-allocations <= 64 21522432 100.00%
-allocations <= 1024 21522436 100.00%
-allocations <= 4096 21522443 100.00%
-
-Histogram of sizes:
-0 - 15 3363764 15.63% *******
-16 - 31 18132778 84.25% ******************************************
-32 - 47 25888 0.12%
-...
-
-The relevant non functional allocator properties are the raw speed of the
-API function as well as memory placement strategies with good data locality.
-"""
-
-from src.benchmark import Benchmark
-import src.plots as plt
-
-
-class BenchmarkCfrac(Benchmark):
- """Definition of the cfrac benchmark"""
- def __init__(self):
- name = "cfrac"
-
- self.cmd = "cfrac{binary_suffix} {num}"
-
- self.args = {"num": [175451865205073170563711388363274837927895]}
-
- self.requirements = ["cfrac"]
- super().__init__(name)
-
- def summary(self):
- # Speed
- plt.plot(self,
- "{task-clock}/1000",
- plot_type='bar',
- fig_options={
- 'ylabel': 'cpu-second',
- 'title': 'Cfrac: runtime',
- },
- file_postfix="time")
-
- # L1 cache misses
- plt.plot(
- self,
- "({L1-dcache-load-misses}/{L1-dcache-loads})*100",
- plot_type='bar',
- fig_options={
- 'ylabel': "L1 misses in %",
- 'title': "Cfrac l1 cache misses",
- 'yerr': False
- },
- file_postfix="l1misses")
-
- # Memusage
- plt.plot(self,
- "{VmHWM}",
- plot_type='bar',
- fig_options={
- 'ylabel': "VmHWM in KB",
- 'title': "Cfrac VmHWM",
- },
- file_postfix="vmhwm")
-
- plt.write_tex_table(self, [{
- "label": "Runtime [ms]",
- "expression": "{task-clock}",
- "sort": "<"
- }, {
- "label": "Memusage [KB]",
- "expression": "{VmHWM}",
- "sort": "<"
- }],
- file_postfix="table")
-
- plt.export_stats_to_dataref(self, "task-clock")
-
- plt.export_stats_to_dataref(self, "VmHWM")
-
-
-cfrac = BenchmarkCfrac()