Can not find the processor speed correctly

Discussion about using the VirtualBox API, Tutorials, Samples.

Can not find the processor speed correctly

Postby Ghetas » 23. Dec 2015, 05:03

Dear all i use the below code to find the processor count and processor speed of the host. The method gives correct number of processors but it gives each processor speed 0 MHZ. i use virtual box installed on windows 7
Code: Select all   Expand viewCollapse view
    static void  gethostinfo(IVirtualBox vbox){
       
        IHost host = vbox.getHost();
        long uProcCount = host.getProcessorCount();
        System.out.println("Processor count: " + uProcCount);

        for (long i=0; i<uProcCount; i++)
        {
            System.out.println("Processor #" + i + " speed: " + host.getProcessorSpeed(i) + "MHz");
        }
    }

the output
Processor count: 8
processor # 0 speed: 0Mhz
processor # 1 speed: 0Mhz
processor # 2 speed: 0Mhz
processor #3 speed: 0Mhz
processor # 4 speed: 0Mhz
processor # 5 speed: 0Mhz
processor # 6 speed: 0Mhz
processor # 7 speed: 0Mhz
Ghetas
 
Posts: 19
Joined: 19. Dec 2015, 17:35

Re: Can not find the processor speed correctly

Postby noteirak » 23. Dec 2015, 12:12

Refering to the posting guidelines:
When posting any issue or advice with the API, please ensure you include the following information :
  • Virtualbox version you are connecting to
  • Virtualbox API version you are using
  • Connection type (Webserver, XPCOM, ...)
  • Language used
Hyperbox - Virtual Infrastructure Manager - https://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 4 guests