Skip to content

Per-package/per-core attributes such as actual processor speed (GHz) #418

Closed

Description

@markozajc

Is there any way of retreiving processor speed with this library? It is possible with SIGAR, can it also be done here?

Also, I tried printing out CentralProcessor (I saw it included GHz in example), but it gave me this:
AMD E1-2100 APU with Radeon(TM) HD Graphics

Activity

  1. dbwiddis commented on Oct 10, 2017

    @dbwiddis
    Member

    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.

  2. markozajc commented on Oct 10, 2017

    @markozajc
    Author

    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

  3. dbwiddis commented on Oct 10, 2017

    @dbwiddis
    Member

    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?

  4. added
    PR welcome
    on Oct 10, 2017
  5. markozajc commented on Oct 10, 2017

    @markozajc
    Author

    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.

  6. dbwiddis commented on Oct 21, 2017

    @dbwiddis
    Member

    For Windows we can get this from Win32_Processor (CurrentClockSpeed, MaxClockSpeed)

    macOS has a sysctl() call hw.cpufrequency and hw.cpufrequency_max

    Linux lscpu command has a CPU MHz field.

    FreeBSD has sysctl() call for dev.cpu.0.freq

    Solaris has kstat cpu_info:0:cpu_info0:clock_MHz (or current_clock_Hz). psrinfo -pv can be parsed. prtdiag may also be an option.

  7. added
    good first issue
    on Oct 21, 2017
  8. henryx commented on Oct 22, 2017

    @henryx
    Collaborator

    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

  9. seancarroll commented on Jan 6, 2018

    @seancarroll

    Is the intent to change getVendorFreq or to add an additional field?

  10. dbwiddis commented on Jan 6, 2018

    @dbwiddis
    Member

    The intent is an additional field. VendorFreq would be the advertized clock speed. We want to also get a "CurrentClockSpeed" if available.

  11. dbwiddis commented on Jan 6, 2018

    @dbwiddis
    Member

    Also the additional field should be an array with a result per-CPU.

  12. seancarroll commented on Jan 7, 2018

    @seancarroll

    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.

  13. dbwiddis commented on Jan 7, 2018

    @dbwiddis
    Member

    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.

  14. seancarroll commented on Jan 7, 2018

    @seancarroll

    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

  15. dbwiddis commented on Jan 7, 2018

    @dbwiddis
    Member

    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).

  16. changed the title [-]Retreiving processor speed (GHz)?[/-] [+]Per-package/per-core attributes such as actual processor speed (GHz)[/+] on Apr 18, 2018
  17. dbwiddis commented on Apr 18, 2018

    @dbwiddis
    Member

    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.

  18. dbwiddis commented on Apr 20, 2018

    @dbwiddis
    Member

    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....

  19. added this to the 3.6.0 milestone on May 12, 2018
  20. modified the milestones: 3.6.0, on Jun 20, 2018
  21. added
    design discussion
    on Jul 18, 2018
  22. modified the milestones: , on Nov 4, 2018
  23. modified the milestones: , 4.0.0 on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR welcomedesign discussiongood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions