VirtualBox

Changeset 10534 in vbox for trunk/include/iprt/system.h


Ignore:
Timestamp:
Jul 11, 2008 3:21:53 PM (16 years ago)
Author:
vboxsync
Message:

Backed out Performance API changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/system.h

    r10528 r10534  
    3434#include <iprt/types.h>
    3535
     36#define IPRT_USAGE_MULTIPLIER   UINT64_C(1000000000)
     37
     38/**
     39 * This structure holds both computed and raw values of overall CPU load counters.
     40 *
     41 * @todo r=bird: What does these values mean?
     42 *
     43 *               Also, I no longer use 'u32', 'u16', 'u8', 'u64', etc unless this information
     44 *               is really important for the user. So, unless there is a better prefix just
     45 *               stick to 'u' here.
     46 *
     47 *               The name of the struct should include the prefix or a shortened
     48 *               version of it: RTSYSCPUUSAGESTATS
     49 *
     50 *               Also, I'd sugest calling it RTSYSCPULOADSTATS, replacing 'usage' with 'load',
     51 *               no particular reason, other than that it is easier to read in the (silly)
     52 *               condensed form we use for typedefs here.
     53 *
     54 *               Finally, I'm wondering how portable this is. I'd like to see what APIs are
     55 *               available on the important systems (Windows, Solaris, Linux) and compare
     56 *               the kind of info they return. This should be done in the defect *before*
     57 *               any of the above, please.
     58 */
     59typedef struct RTSYSCPUUSAGESTATS
     60{
     61    uint32_t u32User;
     62    uint32_t u32System;
     63    uint32_t u32Idle;
     64    /* Internal raw counter values. */
     65    uint32_t u32RawUser;
     66    uint32_t u32RawNice;
     67    uint32_t u32RawSystem;
     68    uint32_t u32RawIdle;
     69} RTCPUUSAGESTATS;
     70typedef RTCPUUSAGESTATS *PRTCPUUSAGESTATS;
     71
     72/* This structure holds both computed and raw values of per-VM CPU load counters. */
     73typedef struct
     74{
     75    uint32_t u32User;
     76    uint32_t u32System;
     77    /* Internal raw counter values. */
     78    uint64_t u64RawTotal;
     79    uint32_t u32RawProcUser;
     80    uint32_t u32RawProcSystem;
     81} RTPROCCPUUSAGESTATS;
     82typedef RTPROCCPUUSAGESTATS *PRTPROCCPUUSAGESTATS;
     83
    3684
    3785__BEGIN_DECLS
     
    60108RTDECL(uint64_t) RTSystemProcessorGetActiveMask(void);
    61109
     110/**
     111 * Gets the current figures of overall system processor usage.
     112 *
     113 * @remarks To get meaningful stats this function has to be
     114 *          called twice with a bit of delay between calls. This
     115 *          is due to the fact that at least two samples of
     116 *          system usage stats are needed to calculate the load.
     117 *
     118 * @returns IPRT status code.
     119 * @param   pStats  Pointer to the structure that contains the
     120 *                  results. Note that this structure is
     121 *                  modified with each call to this function and
     122 *                  is used to provide both in and out values.
     123 * @todo r=bird: Change to RTSystemGetCpuLoadStats.
     124 */
     125RTDECL(int) RTSystemProcessorGetUsageStats(PRTCPUUSAGESTATS pStats);
     126
     127/**
     128 * Gets the current processor usage for a partucilar process.
     129 *
     130 * @remarks To get meaningful stats this function has to be
     131 *          called twice with a bit of delay between calls. This
     132 *          is due to the fact that at least two samples of
     133 *          system usage stats are needed to calculate the load.
     134 *
     135 * @returns IPRT status code.
     136 * @param   pid     VM process id.
     137 * @param   pStats  Pointer to the structure that contains the
     138 *                  results. Note that this structure is
     139 *                  modified with each call to this function and
     140 *                  is used to provide both in and out values.
     141 *
     142 * @todo    Perharps this function should be moved somewhere
     143 *          else.
     144 * @todo    r=bird: Yes is should, iprt/proc.h. RTProcGetCpuLoadStats.
     145 */
     146RTDECL(int) RTProcessGetProcessorUsageStats(RTPROCESS pid, PRTPROCCPUUSAGESTATS pStats);
     147
    62148/** @} */
    63149
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