From 60b860ce3619d5f165bf8eda6ad596d5d458d1e2 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 11 Feb 2020 13:23:55 +0100 Subject: move plotting code from src.benchmark to src.plots --- src/benchmarks/httpd.py | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src/benchmarks/httpd.py') diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py index 64f8e11..2a848c5 100644 --- a/src/benchmarks/httpd.py +++ b/src/benchmarks/httpd.py @@ -20,6 +20,7 @@ import re from src.benchmark import Benchmark import src.facter +import src.plots as plt class BenchmarkHTTPD(Benchmark): @@ -59,28 +60,29 @@ class BenchmarkHTTPD(Benchmark): "Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1) def summary(self): - allocators = self.results["allocators"] - - self.plot_fixed_arg("{requests}", - xlabel='"threads"', - ylabel='"requests/s"', - autoticks=False, - filepostfix="requests", - title='perm.site + ": requests/s"') - - self.plot_fixed_arg("{nginx_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": nginx memory usage"', - filepostfix="httpd_vmhwm", - autoticks=False) - - self.plot_fixed_arg("{php-fpm_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": php-fpm memory usage"', - filepostfix="php-fpm_vmhwm", - autoticks=False) + plt.plot_fixed_arg(self, + "{requests}", + xlabel='"threads"', + ylabel='"requests/s"', + autoticks=False, + filepostfix="requests", + title='perm.site + ": requests/s"') + + plt.plot_fixed_arg(self, + "{nginx_vmhwm}", + xlabel='"threads"', + ylabel='"VmHWM in KB"', + title='perm.site + ": nginx memory usage"', + filepostfix="httpd_vmhwm", + autoticks=False) + + plt.plot_fixed_arg(self, + "{php-fpm_vmhwm}", + xlabel='"threads"', + ylabel='"VmHWM in KB"', + title='perm.site + ": php-fpm memory usage"', + filepostfix="php-fpm_vmhwm", + autoticks=False) httpd = BenchmarkHTTPD() -- cgit v1.2.3 From 5d6a470ce0c7d334205293de9b596a5ea4eb2e8c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 11 Feb 2020 14:22:07 +0100 Subject: cleanup plot code * use str.format instead of eval for plot labels * use meaningful variable names * add license header * add some doc strings --- src/benchmarks/httpd.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/benchmarks/httpd.py') diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py index 2a848c5..2138834 100644 --- a/src/benchmarks/httpd.py +++ b/src/benchmarks/httpd.py @@ -62,25 +62,25 @@ class BenchmarkHTTPD(Benchmark): def summary(self): plt.plot_fixed_arg(self, "{requests}", - xlabel='"threads"', - ylabel='"requests/s"', + xlabel="threads", + ylabel="requests/s", autoticks=False, filepostfix="requests", - title='perm.site + ": requests/s"') + title="{perm.site}: requests/s") plt.plot_fixed_arg(self, "{nginx_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": nginx memory usage"', + xlabel="threads", + ylabel="VmHWM in KB", + title="{perm.site}: nginx memory usage", filepostfix="httpd_vmhwm", autoticks=False) plt.plot_fixed_arg(self, "{php-fpm_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": php-fpm memory usage"', + xlabel="threads", + ylabel="VmHWM in KB", + title="{perm.site}: php-fpm memory usage", filepostfix="php-fpm_vmhwm", autoticks=False) -- cgit v1.2.3