You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-package/per-core attributes such as actual processor speed (GHz) #418
PR welcomeNot maintainer's priority to do but will accept contributions!design discussionWays to improve OSHI's designgood first issueGood issues for new contributors to work on
It currently has a getVendorFreq() method but this is populated by text parsing the processor name. I'm sure we could find other ways to process it depending on the OS.
Would it be possible to maybe intergrate that functionality into the library? I would really be glad if so, because this is one of the main reasons I need a system metrics library
It's mostly a matter of finding where that information lives on various operating systems. We can override the default. Let's start with which OS you are using?
I'm currently on Windows 10, but the server I'm deploying to system is Linux (GNU/Linux Ubuntu 16.04.3 LTS (Xenial Xerus) build 3.13.0-128). As far as I can see, it does work on the Linux system, but it doesn't work on my computer, so it's way harder to test.
Also, I think the main problem is that I use AMD's CPU, which doesn't include clock speed info like Intel's CPUs do.
Please keep in mind that the Linux /proc/cpuinfo file reports the same information (CPU MHz) per cpu/core. Use of lscpu command is a good choice because it reports result per cpu, but is more expensive than parsing the /proc/cpuinfo file
When you say result per CPU do you mean logical core? If you want to return a result per logical core I'm not sure hw.cpufrequency and hw.cpufrequency_max works for mac. Based on what my machine provides sysctl hw.logicalcpu gives me 4 however hw.cpufrequency and hw.cpufrequency_max only give me one result. I'm not familiar with most of these commands so its likely I'm missing something obvious.
I would think it's a physical core property, so that's probably the proper breakdown.... although without knowing where we get the information that's just a hunch. It might be that #353 ought to be done first, to make that size variable more accessible. If you don't have multicore frequency information you can just return an array of size 1.
That might be a good idea. Currently Oshi gives me back 2 physical cores on my mac and my initial thought was that it seemed strange to have the core count be different than the size of the array but perhaps thats just me and there should be an expectation that they would be equal
If we have the ability to identify the number of packages (See #353) then IMO the array should be sized thus, with a per-package index. If we only have one number (macOS) then we can copy the # as needed across all packages (but I think the mac has a single-package multi-core).
A similar request in #430 indicates there's interest in getting some values which are possibly different for multi-package systems. While it's likely that very little will differ between the systems, it's reasonable to return the information if it's available.
I'm musing the best way to do so. A simple array of size physicalPackageCount would be one possibility but we'd need an array for every stat we wanted to measure. I'm thinking there's some possibilities by using objects to represent the topology with the CentralProcessor object having a getPackages() command, and the Packages having getCores(), with the smaller objects having their own getters (and inheriting many attributes from their parents by default).
Open to input from the community. And thoughts on whether this would work in the existing 3.x version or should wait for a 4.x rewrite.
I'm thinking that an inner/nested class (of CentralProcessor) for Package, and then a nested class of Core inside Package, might be the most representative. (And in hindsight, OSProcess should be an inner class of OperatingSystem, and something similar with DiskStore and Partition, but that ship has sailed.) The nested class could contain just the per-package / per-core data (pulling from the outer class if there's no data) such as ProcessorID and ActualFrequency. An array of these objects could be returned with a BitMask attribute identifying their relationship with each other....
PR welcomeNot maintainer's priority to do but will accept contributions!design discussionWays to improve OSHI's designgood first issueGood issues for new contributors to work on
Activity
dbwiddis commentedon Oct 10, 2017
It currently has a
getVendorFreq()method but this is populated by text parsing the processor name. I'm sure we could find other ways to process it depending on the OS.markozajc commentedon Oct 10, 2017
Would it be possible to maybe intergrate that functionality into the library? I would really be glad if so, because this is one of the main reasons I need a system metrics library
dbwiddis commentedon Oct 10, 2017
It's mostly a matter of finding where that information lives on various operating systems. We can override the default. Let's start with which OS you are using?
markozajc commentedon Oct 10, 2017
I'm currently on Windows 10, but the server I'm deploying to system is Linux (GNU/Linux Ubuntu 16.04.3 LTS (Xenial Xerus) build 3.13.0-128). As far as I can see, it does work on the Linux system, but it doesn't work on my computer, so it's way harder to test.
Also, I think the main problem is that I use AMD's CPU, which doesn't include clock speed info like Intel's CPUs do.
dbwiddis commentedon Oct 21, 2017
For Windows we can get this from Win32_Processor (CurrentClockSpeed, MaxClockSpeed)
macOS has a
sysctl()callhw.cpufrequencyandhw.cpufrequency_maxLinux
lscpucommand has aCPU MHzfield.FreeBSD has
sysctl()call fordev.cpu.0.freqSolaris has kstat
cpu_info:0:cpu_info0:clock_MHz(orcurrent_clock_Hz).psrinfo -pvcan be parsed.prtdiagmay also be an option.henryx commentedon Oct 22, 2017
Please keep in mind that the Linux
/proc/cpuinfofile reports the same information (CPU MHz) per cpu/core. Use oflscpucommand is a good choice because it reports result per cpu, but is more expensive than parsing the/proc/cpuinfofileseancarroll commentedon Jan 6, 2018
Is the intent to change getVendorFreq or to add an additional field?
dbwiddis commentedon Jan 6, 2018
The intent is an additional field. VendorFreq would be the advertized clock speed. We want to also get a "CurrentClockSpeed" if available.
dbwiddis commentedon Jan 6, 2018
Also the additional field should be an array with a result per-CPU.
seancarroll commentedon Jan 7, 2018
When you say result per CPU do you mean logical core? If you want to return a result per logical core I'm not sure
hw.cpufrequencyandhw.cpufrequency_maxworks for mac. Based on what my machine providessysctl hw.logicalcpugives me 4 howeverhw.cpufrequencyandhw.cpufrequency_maxonly give me one result. I'm not familiar with most of these commands so its likely I'm missing something obvious.dbwiddis commentedon Jan 7, 2018
I would think it's a physical core property, so that's probably the proper breakdown.... although without knowing where we get the information that's just a hunch. It might be that #353 ought to be done first, to make that size variable more accessible. If you don't have multicore frequency information you can just return an array of size 1.
seancarroll commentedon Jan 7, 2018
That might be a good idea. Currently Oshi gives me back 2 physical cores on my mac and my initial thought was that it seemed strange to have the core count be different than the size of the array but perhaps thats just me and there should be an expectation that they would be equal
dbwiddis commentedon Jan 7, 2018
If we have the ability to identify the number of packages (See #353) then IMO the array should be sized thus, with a per-package index. If we only have one number (macOS) then we can copy the # as needed across all packages (but I think the mac has a single-package multi-core).
[-]Retreiving processor speed (GHz)?[/-][+]Per-package/per-core attributes such as actual processor speed (GHz)[/+]dbwiddis commentedon Apr 18, 2018
A similar request in #430 indicates there's interest in getting some values which are possibly different for multi-package systems. While it's likely that very little will differ between the systems, it's reasonable to return the information if it's available.
I'm musing the best way to do so. A simple array of size physicalPackageCount would be one possibility but we'd need an array for every stat we wanted to measure. I'm thinking there's some possibilities by using objects to represent the topology with the CentralProcessor object having a getPackages() command, and the Packages having getCores(), with the smaller objects having their own getters (and inheriting many attributes from their parents by default).
Open to input from the community. And thoughts on whether this would work in the existing 3.x version or should wait for a 4.x rewrite.
dbwiddis commentedon Apr 20, 2018
I'm thinking that an inner/nested class (of CentralProcessor) for Package, and then a nested class of Core inside Package, might be the most representative. (And in hindsight, OSProcess should be an inner class of OperatingSystem, and something similar with DiskStore and Partition, but that ship has sailed.) The nested class could contain just the per-package / per-core data (pulling from the outer class if there's no data) such as ProcessorID and ActualFrequency. An array of these objects could be returned with a BitMask attribute identifying their relationship with each other....