Changeset 10544 in vbox for trunk/include/iprt/system.h
- Timestamp:
- Jul 11, 2008 6:39:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/system.h
r10534 r10544 34 34 #include <iprt/types.h> 35 35 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 information44 * is really important for the user. So, unless there is a better prefix just45 * stick to 'u' here.46 *47 * The name of the struct should include the prefix or a shortened48 * version of it: RTSYSCPUUSAGESTATS49 *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 are55 * available on the important systems (Windows, Solaris, Linux) and compare56 * the kind of info they return. This should be done in the defect *before*57 * any of the above, please.58 */59 typedef struct RTSYSCPUUSAGESTATS60 {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;70 typedef RTCPUUSAGESTATS *PRTCPUUSAGESTATS;71 72 /* This structure holds both computed and raw values of per-VM CPU load counters. */73 typedef struct74 {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;82 typedef RTPROCCPUUSAGESTATS *PRTPROCCPUUSAGESTATS;83 84 36 85 37 __BEGIN_DECLS … … 108 60 RTDECL(uint64_t) RTSystemProcessorGetActiveMask(void); 109 61 110 /**111 * Gets the current figures of overall system processor usage.112 *113 * @remarks To get meaningful stats this function has to be114 * called twice with a bit of delay between calls. This115 * is due to the fact that at least two samples of116 * system usage stats are needed to calculate the load.117 *118 * @returns IPRT status code.119 * @param pStats Pointer to the structure that contains the120 * results. Note that this structure is121 * modified with each call to this function and122 * is used to provide both in and out values.123 * @todo r=bird: Change to RTSystemGetCpuLoadStats.124 */125 RTDECL(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 be131 * called twice with a bit of delay between calls. This132 * is due to the fact that at least two samples of133 * 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 the138 * results. Note that this structure is139 * modified with each call to this function and140 * is used to provide both in and out values.141 *142 * @todo Perharps this function should be moved somewhere143 * else.144 * @todo r=bird: Yes is should, iprt/proc.h. RTProcGetCpuLoadStats.145 */146 RTDECL(int) RTProcessGetProcessorUsageStats(RTPROCESS pid, PRTPROCCPUUSAGESTATS pStats);147 148 62 /** @} */ 149 63
Note:
See TracChangeset
for help on using the changeset viewer.