]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Add processors page
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 1 Nov 2018 13:44:15 +0000 (13:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 1 Nov 2018 13:44:15 +0000 (13:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/fireinfo.py
src/templates/fireinfo/index.html
src/templates/fireinfo/processors.html [new file with mode: 0644]
src/templates/fireinfo/stats-cpus-detail.html [deleted file]
src/templates/fireinfo/stats-cpus.html [deleted file]
src/templates/fireinfo/stats-geo.html [deleted file]
src/templates/fireinfo/stats.html [deleted file]
src/web/__init__.py
src/web/fireinfo.py

index 7d84d27e249846bf72a5f3bdc832119960477a7e..9cd40b721a36968df15fff5c70558d56b3da9ef6 100644 (file)
@@ -141,12 +141,9 @@ templates_fireinfo_DATA = \
        src/templates/fireinfo/driver.html \
        src/templates/fireinfo/index.html \
        src/templates/fireinfo/i-use-1.png \
+       src/templates/fireinfo/processors.html \
        src/templates/fireinfo/profile.html \
        src/templates/fireinfo/releases.html \
-       src/templates/fireinfo/stats-cpus-detail.html \
-       src/templates/fireinfo/stats-cpus.html \
-       src/templates/fireinfo/stats-geo.html \
-       src/templates/fireinfo/stats.html \
        src/templates/fireinfo/vendor.html \
        src/templates/fireinfo/vendors.html
 
index e1a07e023e2118b154ba95dd89fdbb066467e50d..b14edd919a9efc8ec173a665e4ec7dcaa4aa18e2 100644 (file)
@@ -1860,13 +1860,13 @@ class Fireinfo(Object):
        def get_common_cpu_flags_by_platform(self, platform, when=None):
                if platform == "arm":
                        flags = (
-                               "lpae", "neon", "thumb", "thumb2", "thumbee", "vfpv3", "vfpv4",
+                               "lpae", "neon", "thumb", "thumbee", "vfpv3", "vfpv4",
                        )
                elif platform == "x86":
                        flags = (
                                "aes", "avx", "avx2", "lm", "mmx", "mmxext", "nx", "pae",
                                "pni", "popcnt", "sse", "sse2", "rdrand", "ssse3", "sse4a",
-                               "sse4_1", "sse4_2", "sha", "pclmulqdq", "rdseed",
+                               "sse4_1", "sse4_2", "pclmulqdq", "rdseed",
                        )
                else:
                        return
index 2fe4deead951d7ccdbfe67cc2efa38460d554fa8..77667c8024fe27effbecd4abc81f0868c8cc5557 100644 (file)
                                                {% end %}
                                        </dl>
 
+                                       <a class="btn btn-sm btn-light mb-3" href="/processors">
+                                               {{ _("Processor Features") }}
+                                       </a>
+
                                        <h4>{{ _("Architectures") }}</h4>
 
                                        <dl class="row">
diff --git a/src/templates/fireinfo/processors.html b/src/templates/fireinfo/processors.html
new file mode 100644 (file)
index 0000000..58daac1
--- /dev/null
@@ -0,0 +1,99 @@
+{% extends "../base.html" %}
+
+{% block title %}{{ _("Processors") }}{% end block %}
+
+{% block container %}
+       <section>
+               <div class="container">
+                       <div class="row">
+                               <div class="col-12">
+                                       <h1>{{ _("Processors") }}</h1>
+                               </div>
+                       </div>
+               </div>
+       </section>
+
+       <div class="container">
+               {% for platform in flags %}
+                       <h2>{{ platform }}</h2>
+
+                       <dl class="row">
+                               {% for flag, percentage in flags[platform] %}
+                                       <dt class="col-sm-4">
+                                               {% if flag == "aes" %}
+                                                       {{ _("AES Instruction Set") }}
+                                               {% elif flag == "avx" %}
+                                                       {{ _("AVX") }}
+                                               {% elif flag == "avx2" %}
+                                                       {{ _("AVX2") }}
+                                               {% elif flag == "lpae" %}
+                                                       {{ _("LPAE") }}
+                                               {% elif flag == "mmx" %}
+                                                       {{ _("MMX") }}
+                                               {% elif flag == "mmxext" %}
+                                                       {{ _("MMX2") }}
+                                               {% elif flag == "neon" %}
+                                                       {{ _("NEON") }}
+                                               {% elif flag == "nx" %}
+                                                       {{ _("No eXecute bit") }}
+                                               {% elif flag == "lm" %}
+                                                       {{ _("Supports 64 bits") }}
+                                               {% elif flag == "pae" %}
+                                                       {{ _("PAE") }}
+                                               {% elif flag == "pclmulqdq" %}
+                                                       {{ _("PCLMULQDQ") }}
+                                               {% elif flag == "pni" %}
+                                                       {{ _("SSE3") }}
+                                               {% elif flag == "popcnt" %}
+                                                       {{ _("POPCNT") }}
+                                               {% elif flag == "rdrand" %}
+                                                       {{ _("RDRAND") }}
+                                               {% elif flag == "rdseed" %}
+                                                       {{ _("RDSEED") }}
+                                               {% elif flag == "sha" %}
+                                                       {{ _("SHA") }}
+                                               {% elif flag == "sse" %}
+                                                       {{ _("SSE") }}
+                                               {% elif flag == "sse2" %}
+                                                       {{ _("SSE2") }}
+                                               {% elif flag == "sse4a" %}
+                                                       {{ _("SSE4a") }}
+                                               {% elif flag == "sse4_1" %}
+                                                       {{ _("SSE4.1") }}
+                                               {% elif flag == "sse4_2" %}
+                                                       {{ _("SSE4.2") }}
+                                               {% elif flag == "ssse3" %}
+                                                       {{ _("SSSE3") }}
+                                               {% elif flag == "thumb" %}
+                                                       {{ _("Thumb") }}
+                                               {% elif flag == "thumb2" %}
+                                                       {{ _("Thumb2") }}
+                                               {% elif flag == "thumbee" %}
+                                                       {{ _("ThumbEE") }}
+                                               {% elif flag == "vfpv3" %}
+                                                       {{ _("VFPv3") }}
+                                               {% elif flag == "vfpv4" %}
+                                                       {{ _("VFPv4") }}
+                                               {% elif flag == "virt" %}
+                                                       {{ _("Virtualization") }}
+                                               {% else %}
+                                                       {{ flag }}
+                                               {% end %}
+                                       </dt>
+
+                                       <dd class="col-sm-8">
+                                               {% if percentage >= 0.95 %}
+                                                       {% module ProgressBar(percentage, "success") %}
+                                               {% elif percentage >= 0.5 %}
+                                                       {% module ProgressBar(percentage, "warning") %}
+                                               {% elif percentage >= 0.1 %}
+                                                       {% module ProgressBar(percentage, "info") %}
+                                               {% else %}
+                                                       {% module ProgressBar(percentage, "danger") %}
+                                               {% end %}
+                                       </dd>
+                               {% end %}
+                       </dl>
+               {% end %}
+       </div>
+{% end block %}
diff --git a/src/templates/fireinfo/stats-cpus-detail.html b/src/templates/fireinfo/stats-cpus-detail.html
deleted file mode 100644 (file)
index 4c306f0..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Processors") }}{% end block %}
-
-{% block body %}
-       <div class="page-header">
-               <h1>{{ _("Hardware: CPUs: %s") % platform }}</h1>
-       </div>
-
-       <h3>{{ _("CPU Features") }}</h3>
-       <dl class="dl-horizontal">
-               {% for flag, percentage in flags %}
-                       {% if percentage >= 0.01 %}
-                               <dt>
-                                       {% if flag == "aes" %}
-                                               {{ _("AES Instruction Set") }}
-                                       {% elif flag == "avx" %}
-                                               {{ _("AVX") }}
-                                       {% elif flag == "avx2" %}
-                                               {{ _("AVX2") }}
-                                       {% elif flag == "lpae" %}
-                                               {{ _("LPAE") }}
-                                       {% elif flag == "mmx" %}
-                                               {{ _("MMX") }}
-                                       {% elif flag == "mmxext" %}
-                                               {{ _("MMX2") }}
-                                       {% elif flag == "neon" %}
-                                               {{ _("NEON") }}
-                                       {% elif flag == "nx" %}
-                                               {{ _("No eXecute bit") }}
-                                       {% elif flag == "lm" %}
-                                               {{ _("Supports 64 bits") }}
-                                       {% elif flag == "pae" %}
-                                               {{ _("PAE") }}
-                                       {% elif flag == "pclmulqdq" %}
-                                               {{ _("PCLMULQDQ") }}
-                                       {% elif flag == "pni" %}
-                                               {{ _("SSE3") }}
-                                       {% elif flag == "popcnt" %}
-                                               {{ _("POPCNT") }}
-                                       {% elif flag == "rdrand" %}
-                                               {{ _("RDRAND") }}
-                                       {% elif flag == "rdseed" %}
-                                               {{ _("RDSEED") }}
-                                       {% elif flag == "sha" %}
-                                               {{ _("SHA") }}
-                                       {% elif flag == "sse" %}
-                                               {{ _("SSE") }}
-                                       {% elif flag == "sse2" %}
-                                               {{ _("SSE2") }}
-                                       {% elif flag == "sse4a" %}
-                                               {{ _("SSE4a") }}
-                                       {% elif flag == "sse4_1" %}
-                                               {{ _("SSE4.1") }}
-                                       {% elif flag == "sse4_2" %}
-                                               {{ _("SSE4.2") }}
-                                       {% elif flag == "ssse3" %}
-                                               {{ _("SSSE3") }}
-                                       {% elif flag == "thumb" %}
-                                               {{ _("Thumb") }}
-                                       {% elif flag == "thumb2" %}
-                                               {{ _("Thumb2") }}
-                                       {% elif flag == "thumbee" %}
-                                               {{ _("ThumbEE") }}
-                                       {% elif flag == "vfpv3" %}
-                                               {{ _("VFPv3") }}
-                                       {% elif flag == "vfpv4" %}
-                                               {{ _("VFPv4") }}
-                                       {% elif flag == "virt" %}
-                                               {{ _("Virtualization") }}
-                                       {% else %}
-                                               {{ flag }}
-                                       {% end %}
-                               </dt>
-                               <dd>
-                                       {% if percentage >= 0.95 %}
-                                               {% module ProgressBar(percentage, "success") %}
-                                       {% elif percentage >= 0.5 %}
-                                               {% module ProgressBar(percentage, "warning") %}
-                                       {% elif percentage >= 0.1 %}
-                                               {% module ProgressBar(percentage, "info") %}
-                                       {% else %}
-                                               {% module ProgressBar(percentage, "danger") %}
-                                       {% end %}
-                               </dd>
-                       {% end %}
-               {% end %}
-       </dl>
-{% end block %}
diff --git a/src/templates/fireinfo/stats-cpus.html b/src/templates/fireinfo/stats-cpus.html
deleted file mode 100644 (file)
index 52746f0..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Processors") }}{% end block %}
-
-{% block body %}
-       <div class="page-header">
-               <h1>{{ _("Hardware: CPUs") }}</h1>
-       </div>
-
-       <div class="row">
-               <div class="col-md-2 col-md-offset-2 ac">
-                       <small class="text-muted">({{ _("minimum") }})</small>
-                       <h3>{{ "%.0f" % clock_speed_min }} {{ _("MHz") }}</h3>
-               </div>
-               <div class="col-md-4 ac">
-                       <small class="text-muted">({{ _("average") }})</small>
-                       <h1 class="text-success">{{ "%.0f" % clock_speed_avg }} {{ _("MHz") }}</h1>
-               </div>
-               <div class="col-md-2 ac">
-                       <small class="text-muted">({{ _("maximum") }})</small>
-                       <h3>{{ "%.0f" % clock_speed_max }} {{ _("MHz") }}</h3>
-               </div>
-       </div>
-
-       <div class="ac">
-               <ul class="list-inline">
-                       <li>{{ _("CPU Features") }}:</li>
-                       {% for platform in ("x86", "arm") %}
-                               <li>
-                                       <a href="/statistics/processors/{{ platform }}">{{ platform }}</a>
-                               </li>
-                       {% end %}
-               </ul>
-       </div>
-
-       <hr>
-
-       <h3>{{ _("Vendors") }}</h3>
-       <p>
-               This chart shows us which vendors is the most favorite for the CPUs
-               used in IPFire.
-       </p>
-
-       <dl class="dl-horizontal">
-               {% for vendor, percentage in cpu_vendors %}
-                       <dt>{{ vendor }}</dt>
-                       <dd>{% module ProgressBar(percentage) %}</dd>
-               {% end %}
-       </dl>
-
-       <h3>{{ _("Architectures") }}</h3>
-       <dl class="dl-horizontal">
-               {% for name, percentage in arch_map %}
-                       <dt>{{ name }}</dt>
-                       <dd>{% module ProgressBar(percentage) %}</dd>
-               {% end %}
-       </dl>
-{% end block %}
diff --git a/src/templates/fireinfo/stats-geo.html b/src/templates/fireinfo/stats-geo.html
deleted file mode 100644 (file)
index 83dc223..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Geo Locations") }}{% end block %}
-
-{% block body %}
-       <div class="page-header">
-               <h1>{{ _("Geo Locations") }}</h1>
-       </div>
-
-       <div class="row">
-               <div class="col-lg-12 col-md-12">
-                       <p>
-                               This chart shows us in which country IPFire is running.
-                       </p>
-
-                       {% module FireinfoGeoTable(geo_locations) %}
-               </div>
-       </div>
-{% end block %}
diff --git a/src/templates/fireinfo/stats.html b/src/templates/fireinfo/stats.html
deleted file mode 100644 (file)
index a763cae..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Statistics") }}{% end block %}
-
-{% block body %}
-       <div class="page-header">
-               <h1>{{ _("fireinfo statistics") }}</h1>
-       </div>
-
-       <div class="row">
-               <div class="col-md-6">
-                       <div class="thumbnail ac">
-                               <img src="{{ static_url("images/tux/ipfire_tux_256x256.png") }}" alt="">
-
-                               <h3>
-                                       <a href="/statistics/releases">{{ _("IPFire Releases") }}</a>
-                               </h3>
-                       </div>
-               </div>
-
-               <div class="col-md-6">
-                       <div class="thumbnail ac">
-                               <h2 class="ac">{{ _("Hardware") }}</h2>
-
-                               <h4>
-                                       <a href="/statistics/processors">{{ _("Processors") }}</a>
-                               </h4>
-                       </div>
-
-                       <div class="thumbnail ac">
-                               <h2 class="ac">{{ _("Others") }}</h2>
-
-                               <h4>
-                                       <a href="/statistics/geo-locations">{{ _("Geo Locations") }}</a>
-                               </h4>
-                       </div>
-               </div>
-       </div>
-{% end block %}
index 15a747409afe803ac9246b8f5904aef7b4e0f895..85b58a5c99ae2403ccfd93a6030c6df0aaea8415 100644 (file)
@@ -198,15 +198,11 @@ class Application(tornado.web.Application):
                        (r"/profile/([a-z0-9]{40})", fireinfo.ProfileHandler),
 
                        # Stats
+                       (r"/processors", fireinfo.ProcessorsHandler),
                        (r"/releases", fireinfo.ReleasesHandler),
 
-                       # Send profiles.
+                       # Send profiles
                        (r"/send/([a-z0-9]+)", fireinfo.ProfileSendHandler),
-
-                       # Stats handlers
-                       (r"/statistics", fireinfo.StatsHandler),
-                       (r"/statistics/processors", fireinfo.StatsProcessorsHandler),
-                       (r"/statistics/processors/(arm|x86)", fireinfo.StatsProcessorDetailHandler),
                ])
 
                # i-use.ipfire.org
index a4add7d1b4a20da35c4634ca650a1436fb2cadd7..a00eaaac8958064c90c5183adfd2096e4f3b6b90 100644 (file)
@@ -221,36 +221,18 @@ class ReleasesHandler(BaseHandler):
                return self.render("fireinfo/releases.html", **data)
 
 
-class StatsHandler(BaseHandler):
+class ProcessorsHandler(BaseHandler):
        def get(self):
-               self.render("fireinfo/stats.html")
+               flags = {}
 
+               for platform in ("arm", "x86"):
+                       flags[platform] = \
+                               self.fireinfo.get_common_cpu_flags_by_platform(platform, when=self.when)
 
-class StatsProcessorsHandler(BaseHandler):
-       def get(self):
-               avg, stddev, min, max = self.fireinfo.get_cpu_clock_speeds(when=self.when)
-               arch_map = self.fireinfo.get_arch_map(when=self.when)
-
-               data = {
-                       "arch_map" : arch_map,
-                       "cpu_vendors" : self.fireinfo.get_cpu_vendors_map(when=self.when),
-                       "clock_speed_avg" : avg,
-                       "clock_speed_stddev" : stddev,
-                       "clock_speed_min" : min,
-                       "clock_speed_max" : max,
-               }
-
-               return self.render("fireinfo/stats-cpus.html", **data)
-
-
-class StatsProcessorDetailHandler(BaseHandler):
-       def get(self, platform):
-               assert platform in ("arm", "x86")
-
-               flags = self.fireinfo.get_common_cpu_flags_by_platform(platform, when=self.when)
+               # Cache for 1h
+               self.set_expires(3600)
 
-               return self.render("fireinfo/stats-cpus-detail.html",
-                       platform=platform, flags=flags)
+               return self.render("fireinfo/processors.html", flags=flags)
 
 
 class VendorsHandler(BaseHandler):