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
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 \
+++ /dev/null
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Memory") }}{% end block %}
-
-{% block body %}
- <div class="page-header">
- <h1>{{ _("Memory") }}</h1>
- </div>
-
- <div class="row">
- <div class="col-md-2 col-md-offset-2 ac">
- <small class="text-muted">({{ _("minimum") }})</small>
- <h3>{{ "%.0f" % (mem_min / 1024) }} {{ _("MB") }}</h3>
- </div>
- <div class="col-md-4 ac">
- <small class="text-muted">({{ _("average") }})</small>
- <h1 class="text-success">{{ "%.0f" % (mem_avg / 1024) }} {{ _("MB") }}</h1>
- </div>
- <div class="col-md-2 ac">
- <small class="text-muted">({{ _("maximum") }})</small>
- <h3>{{ "%.0f" % (mem_max / 1024) }} {{ _("MB") }}</h3>
- </div>
- </div>
-
- <hr>
-
- <dl class="dl-horizonal">
- {% for amount, percentage in amounts %}
- {% if percentage >= 0.01 %}
- <dt>{{ _(">= %d MB") % amount }}</dt>
- <dd>
- {% if amount <= 256 %}
- {% module ProgressBar(percentage, "danger") %}
- {% elif amount >= 1024 %}
- {% module ProgressBar(percentage, "success") %}
- {% else %}
- {% module ProgressBar(percentage, "warning") %}
- {% end %}
- </dd>
- {% end %}
- {% end %}
- </dl>
-{% end block %}
<h4>
<a href="/statistics/processors">{{ _("Processors") }}</a>
</h4>
-
- <h4>
- <a href="/statistics/memory">{{ _("Memory") }}</a>
- </h4>
</div>
<div class="thumbnail ac">
(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),
])
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 = {