Changeset 12133 in vbox for trunk/src/VBox
- Timestamp:
- Sep 5, 2008 2:13:33 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 36087
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/darwin/PerformanceDarwin.cpp
r12066 r12133 65 65 { 66 66 public: 67 CollectorDarwin(); 67 68 virtual int getRawHostCpuLoad(uint64_t *user, uint64_t *kernel, uint64_t *idle); 68 69 virtual int getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available); 69 70 virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total); 70 71 virtual int getProcessMemoryUsage(RTPROCESS process, ULONG *used); 72 private: 73 ULONG totalRAM; 71 74 }; 72 75 … … 75 78 mHAL = new CollectorDarwin(); 76 79 Assert(mHAL); 80 } 81 82 CollectorDarwin::CollectorDarwin() 83 { 84 uint64_t hostMemory; 85 int mib[2]; 86 size_t size; 87 88 mib[0] = CTL_HW; 89 mib[1] = HW_MEMSIZE; 90 91 size = sizeof(hostMemory); 92 if (sysctl(mib, 2, &hostMemory, &size, NULL, 0) == -1) { 93 Log(("sysctl() -> %s", strerror(errno))); 94 hostMemory = 0; 95 } 96 totalRAM = (ULONG)(hostMemory / 1024); 77 97 } 78 98 … … 114 134 } 115 135 116 uint64_t hostMemory; 117 int mib[2]; 118 size_t size; 119 120 mib[0] = CTL_HW; 121 mib[1] = HW_MEMSIZE; 122 123 size = sizeof(hostMemory); 124 if (sysctl(mib, 2, &hostMemory, &size, NULL, 0) == -1) { 125 int error = errno; 126 Log(("sysctl() -> %s", strerror(error))); 127 return RTErrConvertFromErrno(error); 128 } 129 *total = (ULONG)(hostMemory / 1024); 136 *total = totalRAM; 130 137 *available = info.free_count * (PAGE_SIZE / 1024); 131 138 *used = *total - *available; -
trunk/src/VBox/Main/testcase/tstCollector.cpp
r12085 r12133 76 76 { \ 77 77 RTPrintf("tstCollector: "#fn" -> %Vrc\n", rc); \ 78 return 1; \79 78 } \ 80 RTPrintf("%50s -- %u calls per second\n", #fn, nCalls) 79 else \ 80 RTPrintf("%50s -- %u calls per second\n", #fn, nCalls) 81 81 82 82 int main(int argc, char *argv[])
Note:
See TracChangeset
for help on using the changeset viewer.