return sorted(ret, key=lambda x: x[1], reverse=True)
+ 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 \
+ LEFT JOIN fireinfo_profiles_memory ON profiles.id = fireinfo_profiles_memory.profile_id", when)
+
+ if res:
+ return res.avg or 0
+
def get_arch_map(self, when=None):
res = self.db.query("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id) \
SELECT fireinfo_arches.name AS arch, COUNT(*)::float / (SELECT COUNT(*) FROM profiles) AS count \
# Hardware
"arches" : self.fireinfo.get_arch_map(when=self.when),
"cpu_vendors" : self.fireinfo.get_cpu_vendors_map(when=self.when),
+ "memory_avg" : self.backend.fireinfo.get_average_memory_amount(when=self.when),
# Virtualization
"hypervisors" : self.fireinfo.get_hypervisor_map(when=self.when),