Changeset 9935 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Jun 25, 2008 4:49:24 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 32357
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/system-posix.cpp
r9904 r9935 94 94 /** 95 95 * Gets the current figures of overall system processor usage. 96 * 97 * @remarks To get meaningful stats this function has to be 96 * 97 * @remarks To get meaningful stats this function has to be 98 98 * called twice with a bit of delay between calls. This 99 99 * is due to the fact that at least two samples of 100 100 * system usage stats are needed to calculate the load. 101 * 101 * 102 102 * @returns None. 103 103 */ 104 104 RTDECL(int) RTSystemProcessorGetUsageStats(PRTCPUUSAGESTATS pStats) 105 105 { 106 /** @todo r=bird: This is Linux specific and doesn't belong here. Move this to r3/linux/RTSystemGetCpuLoadStats-linux.cpp. */ 106 107 int rc = VINF_SUCCESS; 107 108 uint32_t u32UserNow, u32NiceNow, u32SystemNow, u32IdleNow; … … 139 140 /** 140 141 * Gets the current processor usage for a partucilar process. 141 * 142 * @remarks To get meaningful stats this function has to be 142 * 143 * @remarks To get meaningful stats this function has to be 143 144 * called twice with a bit of delay between calls. This 144 145 * is due to the fact that at least two samples of 145 146 * system usage stats are needed to calculate the load. 146 * 147 * 147 148 * @returns None. 148 149 */ … … 153 154 uint32_t u32UserDelta, u32SystemDelta; 154 155 uint64_t u64TotalNow, u64TotalDelta; 156 157 /** @todo r=bird: This is Linux specific and doesn't belong here. Move this to r3/linux/RTSystemGetCpuLoadStats-linux.cpp. */ 155 158 FILE *f = fopen("/proc/stat", "r"); 156 159 157 160 if (f) 158 161 { 159 if (fscanf(f, "cpu %u %u %u %u", &u32UserNow, &u32NiceNow, &u32SystemNow, &u32IdleNow) == 4) 162 if (fscanf(f, "cpu %u %u %u %u", &u32UserNow, &u32NiceNow, &u32SystemNow, &u32IdleNow) == 4) /** @todo 'uint32_t' is not necessarily the same as 'unsigned int'. */ 160 163 { 161 164 char *pszName;
Note:
See TracChangeset
for help on using the changeset viewer.