From 84550e02191bb159d05d31863f42341499b0570a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 30 Oct 2018 13:03:24 +0000 Subject: [PATCH] fireinfo: Drop old memory page Signed-off-by: Michael Tremer --- Makefile.am | 1 - src/backend/fireinfo.py | 20 ----------- src/templates/fireinfo/stats-memory.html | 43 ------------------------ src/templates/fireinfo/stats.html | 4 --- src/web/__init__.py | 1 - src/web/fireinfo.py | 16 --------- 6 files changed, 85 deletions(-) delete mode 100644 src/templates/fireinfo/stats-memory.html diff --git a/Makefile.am b/Makefile.am index a05d730c..ade67f28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -146,7 +146,6 @@ templates_fireinfo_DATA = \ src/templates/fireinfo/stats-cpus.html \ src/templates/fireinfo/stats-geo.html \ src/templates/fireinfo/stats.html \ - src/templates/fireinfo/stats-memory.html \ src/templates/fireinfo/stats-oses.html \ src/templates/fireinfo/vendor.html \ src/templates/fireinfo/vendors.html diff --git a/src/backend/fireinfo.py b/src/backend/fireinfo.py index 80be0736..251c8845 100644 --- a/src/backend/fireinfo.py +++ b/src/backend/fireinfo.py @@ -1883,26 +1883,6 @@ class Fireinfo(Object): return sorted(ret, key=lambda x: x[1], reverse=True) - def get_common_memory_amounts(self, when=None): - amounts = (128, 256, 512, 1024, 2 * 1024, 4 * 1024, 8 * 1024, 16 * 1024, 32 * 1024, 64 * 1024) - - ret = [] - for amount in amounts: - ret.append((amount, self.get_memory_amount(amount * 1024 * 0.95, when=when))) - - return ret - - def get_memory_amount(self, greather_than, when=None): - res = self.db.get("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id) \ - SELECT COUNT(*)::float / (SELECT COUNT(*) FROM profiles \ - LEFT JOIN fireinfo_profiles_memory ON profiles.id = fireinfo_profiles_memory.profile_id \ - WHERE NOT fireinfo_profiles_memory.amount IS NULL) AS percentage FROM profiles \ - LEFT JOIN fireinfo_profiles_memory ON profiles.id = fireinfo_profiles_memory.profile_id \ - WHERE fireinfo_profiles_memory.amount >= %s", when, greather_than) - - if res: - return res.percentage - def get_average_memory_amount(self, when=None): res = self.db.get("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id) \ SELECT AVG(fireinfo_profiles_memory.amount) AS avg FROM profiles \ diff --git a/src/templates/fireinfo/stats-memory.html b/src/templates/fireinfo/stats-memory.html deleted file mode 100644 index 7f42ee9b..00000000 --- a/src/templates/fireinfo/stats-memory.html +++ /dev/null @@ -1,43 +0,0 @@ -{% extends "../base.html" %} - -{% block title %}{{ _("Memory") }}{% end block %} - -{% block body %} - - -
-
- ({{ _("minimum") }}) -

{{ "%.0f" % (mem_min / 1024) }} {{ _("MB") }}

-
-
- ({{ _("average") }}) -

{{ "%.0f" % (mem_avg / 1024) }} {{ _("MB") }}

-
-
- ({{ _("maximum") }}) -

{{ "%.0f" % (mem_max / 1024) }} {{ _("MB") }}

-
-
- -
- -
- {% for amount, percentage in amounts %} - {% if percentage >= 0.01 %} -
{{ _(">= %d MB") % amount }}
-
- {% if amount <= 256 %} - {% module ProgressBar(percentage, "danger") %} - {% elif amount >= 1024 %} - {% module ProgressBar(percentage, "success") %} - {% else %} - {% module ProgressBar(percentage, "warning") %} - {% end %} -
- {% end %} - {% end %} -
-{% end block %} diff --git a/src/templates/fireinfo/stats.html b/src/templates/fireinfo/stats.html index b7f2c302..a763caeb 100644 --- a/src/templates/fireinfo/stats.html +++ b/src/templates/fireinfo/stats.html @@ -25,10 +25,6 @@

{{ _("Processors") }}

- -

- {{ _("Memory") }} -

diff --git a/src/web/__init__.py b/src/web/__init__.py index 4cca0adc..2e337d5e 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -203,7 +203,6 @@ class Application(tornado.web.Application): (r"/statistics/processors", fireinfo.StatsProcessorsHandler), (r"/statistics/processors/(arm|x86)", fireinfo.StatsProcessorDetailHandler), (r"/statistics/geo-locations", fireinfo.StatsGeoHandler), - (r"/statistics/memory", fireinfo.StatsMemoryHandler), (r"/statistics/releases", fireinfo.StatsReleasesHandler), ]) diff --git a/src/web/fireinfo.py b/src/web/fireinfo.py index ca4446b5..fdc790e2 100644 --- a/src/web/fireinfo.py +++ b/src/web/fireinfo.py @@ -235,22 +235,6 @@ class StatsProcessorDetailHandler(BaseHandler): platform=platform, flags=flags) -class StatsMemoryHandler(BaseHandler): - def get(self): - avg, stddev, min, max = self.fireinfo.get_memory_amounts(when=self.when) - amounts = self.fireinfo.get_common_memory_amounts(when=self.when) - - data = { - "mem_avg" : avg, - "mem_stddev" : stddev, - "mem_min" : min, - "mem_max" : max, - "amounts" : amounts, - } - - return self.render("fireinfo/stats-memory.html", **data) - - class StatsReleasesHandler(BaseHandler): def get(self): data = { -- 2.39.2