VirtualBox

Changeset 10399 in vbox for trunk


Ignore:
Timestamp:
Jul 9, 2008 9:52:56 AM (16 years ago)
Author:
vboxsync
Message:

Main API fix for getting processor speed/description - there's no guarantee that all cpus will stick to same properties forever. So query by cpuId.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r9937 r10399  
    101101#include <VBox/err.h>
    102102#include <iprt/string.h>
     103/** @todo the following line becomes obsolete after switching to Mp runtime functions */
    103104#include <iprt/system.h>
     105#include <iprt/mp.h>
    104106#include <iprt/time.h>
    105107#include <iprt/param.h>
     
    667669    CHECK_READY();
    668670    *count = RTSystemProcessorGetCount();
     671    /** @todo after implementing the Mp runtime on all platforms replace with
     672     * *count = RTMpGetOnlineCount(); */
    669673    return S_OK;
    670674}
    671675
    672676/**
    673  * Returns the (approximate) speed of the host CPU in MHz
     677 * Returns the (approximate) maximum speed of the given host CPU in MHz
    674678 *
    675679 * @returns COM status code
    676  * @param   speed address of result variable
     680 * @param   cpu id to get info for.
     681 * @param   speed address of result variable, speed is 0 if unknown or cpuId is invalid.
    677682 */
    678 STDMETHODIMP Host::COMGETTER(ProcessorSpeed)(ULONG *speed)
     683STDMETHODIMP Host::COMGETTER(ProcessorSpeed)(ULONG cpuId, ULONG *speed)
    679684{
    680685    if (!speed)
     
    682687    AutoWriteLock alock (this);
    683688    CHECK_READY();
    684     /** @todo Add a runtime function for this which uses GIP. */
     689    /** @todo after implementing the Mp runtime on all platforms replace with
     690     * *speed = RTMpGetOnlineCpuMaxSpeed(cpuId); */
     691    *speed = 0;
    685692    return S_OK;
    686693}
     
    689696 *
    690697 * @returns COM status code
    691  * @param   description address of result variable
     698 * @param   cpu id to get info for.
     699 * @param   description address of result variable, NULL if known or cpuId is invalid.
    692700 */
    693 STDMETHODIMP Host::COMGETTER(ProcessorDescription)(BSTR *description)
     701STDMETHODIMP Host::COMGETTER(ProcessorDescription)(ULONG cpuId, BSTR *description)
    694702{
    695703    if (!description)
     
    698706    CHECK_READY();
    699707    /** @todo */
    700     return S_OK;
     708    return E_NOTIMPL;
    701709}
    702710
     
    715723    CHECK_READY();
    716724    /** @todo */
    717     return S_OK;
     725    return E_NOTIMPL;
    718726}
    719727
     
    731739    CHECK_READY();
    732740    /** @todo */
    733     return S_OK;
     741    return E_NOTIMPL;
    734742}
    735743
     
    747755    CHECK_READY();
    748756    /** @todo */
    749     return S_OK;
     757    return E_NOTIMPL;
    750758}
    751759
     
    763771    CHECK_READY();
    764772    /** @todo */
    765     return S_OK;
     773    return E_NOTIMPL;
    766774}
    767775
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r10333 r10399  
    48054805  <interface
    48064806     name="IHost" extends="$unknown"
    4807      uuid="a42a480f-d554-4be0-b11c-6c2e54dd1274"
     4807     uuid="3d864057-ae6b-4d05-9cf7-c341139b6062"
    48084808     wsmap="managed"
    48094809     >
     
    48794879    </attribute>
    48804880
    4881     <attribute name="processorSpeed" type="unsigned long" readonly="yes">
    4882       <desc>(Approximate) speed of the host CPU in Megahertz.</desc>
    4883     </attribute>
    4884 
    4885     <attribute name="processorDescription" type="wstring" readonly="yes">
    4886       <desc>Description string of the host CPU.</desc>
    4887     </attribute>
     4881    <method name="getProcessorSpeed">
     4882      <desc>Query the (approximate) maximum speed of a specified host CPU in Megahertz.</desc>
     4883      <param name="cpuId" type="unsigned long" dir="in">
     4884        <desc>
     4885          Identifier of the CPU.
     4886        </desc>
     4887      </param>
     4888      <param name="speed" type="unsigned long" dir="return">
     4889        <desc>
     4890          Speed value. 0 is returned if value is not known or @a cpuId is
     4891          invalid.
     4892        </desc>
     4893      </param>
     4894    </method>
     4895
     4896    <method name="getProcessorDescription">
     4897      <desc>Query the model string of a specified host CPU.</desc>
     4898      <param name="cpuId" type="unsigned long" dir="in">
     4899        <desc>
     4900          Identifier of the CPU.
     4901        </desc>
     4902      </param>
     4903      <param name="description" type="wstring" dir="return">
     4904        <desc>
     4905          Model string. A NULL string is returned if value is not known or
     4906          @a cpuId is invalid.
     4907        </desc>
     4908      </param>
     4909    </method>
    48884910
    48894911    <attribute name="memorySize" type="unsigned long" readonly="yes">
  • trunk/src/VBox/Main/include/HostImpl.h

    r9937 r10399  
    8989#endif
    9090    STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
    91     STDMETHOD(COMGETTER(ProcessorSpeed))(ULONG *speed);
    92     STDMETHOD(COMGETTER(ProcessorDescription))(BSTR *description);
     91    STDMETHOD(COMGETTER(ProcessorSpeed))(ULONG cpuId, ULONG *speed);
     92    STDMETHOD(COMGETTER(ProcessorDescription))(ULONG cpuId, BSTR *description);
    9393    STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
    9494    STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette