diff --git a/src/Resources/CPU.vala b/src/Resources/CPU.vala index 7b3aae88d..e00f204f6 100644 --- a/src/Resources/CPU.vala +++ b/src/Resources/CPU.vala @@ -16,6 +16,9 @@ public class Monitor.CPU : Object { public uint ? revision; public string ? model_name; + public uint physical_cpus; + public uint physical_cores_per_cpu; + public uint logical_threads_per_cpu; public string ? model; public string ? family; public string ? microcode; @@ -77,7 +80,7 @@ public class Monitor.CPU : Object { parse_cpuinfo (); - model_name = get_cpu_info (); + model_name = get_cpu_info (out physical_cpus, out physical_cores_per_cpu, out logical_threads_per_cpu); debug ("CPU name: %s", model_name); @@ -259,7 +262,7 @@ public class Monitor.CPU : Object { } // straight from elementary about-plug - private string ? get_cpu_info () { + private string ? get_cpu_info (out uint cpus, out uint cores, out uint threads) { unowned GTop.SysInfo ? info = GTop.glibtop_get_sysinfo (); if (info == null) { @@ -307,21 +310,14 @@ public class Monitor.CPU : Object { string result = ""; foreach (var cpu in counts.entries) { - if (result.length > 0) { - result += "\n"; - } - - if (cpu.@value == 2) { - result += _("Dual-Core %s").printf ((cpu.key)); - } else if (cpu.@value == 4) { - result += _("Quad-Core %s").printf ((cpu.key)); - } else if (cpu.@value == 6) { - result += _("Hexa-Core %s").printf ((cpu.key)); - } else { - result += "%u\u00D7 %s ".printf (cpu.@value, (cpu.key)); - } + result += "%s".printf ((cpu.key)); + cores = cpu.@value; + break; } + cpus = counts.size; + threads = (uint) info.ncpu / cpus; + return Utils.Strings.beautify (result); } } diff --git a/src/Views/SystemView/SystemCPUInfoPopover.vala b/src/Views/SystemView/SystemCPUInfoPopover.vala index a6ba8bc4d..ad71f0e50 100755 --- a/src/Views/SystemView/SystemCPUInfoPopover.vala +++ b/src/Views/SystemView/SystemCPUInfoPopover.vala @@ -59,6 +59,10 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { activate_on_single_click = false }; + listbox.append (label (_("CPUs:") + " %u".printf (cpu.physical_cpus))); + listbox.append (label (_("Cores per CPU:") + " %u".printf (cpu.physical_cores_per_cpu))); + listbox.append (label (_("Threads per CPU:") + " %u".printf (cpu.logical_threads_per_cpu))); + listbox.append (label (_("Model:") + " " + cpu.model)); listbox.append (label (_("Model:") + " " + cpu.model)); listbox.append (label (_("Family:") + " " + cpu.family)); listbox.append (label (_("Microcode ver.:") + " " + cpu.microcode));