Can not find the processor speed correctly

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Ghetas
Posts: 19
Joined: 19. Dec 2015, 17:35

Can not find the processor speed correctly

Post by Ghetas »

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

    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
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Can not find the processor speed correctly

Post by noteirak »

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://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply