<h3>{{ _("Speed") }}</h3>
<p>
{{ _("The average speed of all systems in the database is: <strong>%.2f MHz</strong>.") % average_speed }}
+ <br />
+ {{ _("All together, there are <strong>%s bogomips</strong> out there.") % locale.friendly_number(bogomips) }}
</p>
{{ modules.StasyTable(cpu_speeds) }}
+ <h3>{{ _("CPU cores counter") }}</h3>
+ <p>
+ {{ _("See a breakdown of the CPU cores that are installed on the IPFire systems.") }}
+ </p>
+ {{ modules.StasyCPUCoreTable(cpu_cores) }}
+
<p class="links">
<a href="cpuflags">{{ _("See statistics about common CPU flags") }}</a>
</p>
"Worldwide mirror servers","Weltweite Mirror-Server"
"Preferred for","Bevorzugt für"
"Profile not found","Profil nicht gefunden"
+"See a breakdown of the CPU cores that are installed on the IPFire systems.","Hier ist eine Übersicht über die Anzahl der CPU-Kerne, die in den IPFire-Systemen installiert sind."
+"CPU cores counter","CPU-Kerne"
+"All together, there are <strong>%s bogomips</strong> out there.","Insgesamt bringen es alle Systeme auf <strong>%s bogomips</strong>."
"SidebarBanner" : SidebarBannerModule,
"SidebarRelease" : SidebarReleaseModule,
"StasyTable" : StasyTableModule,
+ "StasyCPUCoreTable" : StasyCPUCoreTableModule,
"StasyDeviceTable" : StasyDeviceTableModule,
"StasyGeoTable" : StasyGeoTableModule,
"TrackerPeerList": TrackerPeerListModule,
(r"(VIA \w*).*", r"\1"),
)
+CPU_CORES = range(1, 9)
+
class ProfileDict(object):
def __init__(self, data):
self._data = data
return profiles
- def query(self, query, archives=False, no_virt=False, all=False):
+ def query(self, query, archives=False, no_virt=False, all=False, fields=None):
db = self._db.profiles
if archives:
logging.debug("Executing query: %s" % query)
- return db.find(query)
+ return db.find(query, fields=fields)
@property
def secret_ids(self):
return (speed / all.count())
+ def get_cpu_bogomips_accumulated(self):
+ profiles = self.query({}, no_virt=True, fields=["profile.cpu.bogomips"])
+
+ return sum([int(o["profile"]["cpu"]["bogomips"]) for o in profiles])
+
@property
def cpu_speed_map(self):
cpu_speeds = {}
return cpu_speeds
+ def get_cpu_cores_map(self):
+ cores = {}
+
+ for i in CPU_CORES:
+ cores[i] = \
+ self.query({
+ "profile.cpu.count" : i,
+ }, no_virt=True).count()
+
+ return cores
+
def get_memory_map(self):
memory = {}
return self.render("stasy-stats-cpus.html",
cpu_vendors=self.stasy.cpu_vendors_map,
average_speed=self.stasy.cpu_speed_average,
- cpu_speeds=self.stasy.cpu_speed_map)
+ cpu_speeds=self.stasy.cpu_speed_map,
+ cpu_cores=self.stasy.get_cpu_cores_map(),
+ bogomips=self.stasy.get_cpu_bogomips_accumulated())
class StasyStatsCPUFlagsHandler(StasyBaseHandler):
for name, flag in flags:
kwargs["cpus_" + name] = self.stasy.get_cpu_flag_map(flag)
- print kwargs
-
return self.render("stasy-stats-cpu-flags.html", **kwargs)
class StasyStatsMemoryHandler(StasyBaseHandler):
class StasyTableModule(UIModule):
+ def _make_percentages(self, items):
+ total = sum(items.values())
+
+ for k in items.keys():
+ items[k] *= 100
+ items[k] /= total
+
+ return items
+
def render(self, items, sortby="key", reverse=False, percentage=False, flags=False, locale=False):
hundred_percent = 0
for v in items.values():
return self.render_string("modules/stasy-table.html", items=items, flags=flags)
+class StasyCPUCoreTableModule(StasyTableModule):
+ def render(self, items):
+ items = self._make_percentages(items)
+
+ items = items.items()
+ items.sort()
+
+ return self.render_string("modules/stasy-table.html", items=items,
+ flags=None #XXX
+ )
+
+
class StasyDeviceTableModule(UIModule):
def render(self, devices):
groups = {}