1338 _cpu_info->set_cpu_description(NULL);
1339 delete _cpu_info;
1340 _cpu_info = NULL;
1341 }
1342 }
1343
1344 int CPUInformationInterface::cpu_information(CPUInformation& cpu_info) {
1345 if (NULL == _cpu_info) {
1346 return OS_ERR;
1347 }
1348 cpu_info = *_cpu_info; // shallow copy assignment
1349 return OS_OK;
1350 }
1351
1352 class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
1353 friend class NetworkPerformanceInterface;
1354 private:
1355 bool _iphlp_attached;
1356
1357 NetworkPerformance();
1358 NetworkPerformance(const NetworkPerformance& rhs); // no impl
1359 NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
1360 bool initialize();
1361 ~NetworkPerformance();
1362 int network_utilization(NetworkInterface** network_interfaces) const;
1363 };
1364
1365 NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance()
1366 : _iphlp_attached(false) {
1367 }
1368
1369 bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
1370 _iphlp_attached = IphlpDll::IphlpAttach();
1371 return _iphlp_attached;
1372 }
1373
1374 NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
1375 if (_iphlp_attached) {
1376 IphlpDll::IphlpDetach();
1377 }
1378 }
1379
|
1338 _cpu_info->set_cpu_description(NULL);
1339 delete _cpu_info;
1340 _cpu_info = NULL;
1341 }
1342 }
1343
1344 int CPUInformationInterface::cpu_information(CPUInformation& cpu_info) {
1345 if (NULL == _cpu_info) {
1346 return OS_ERR;
1347 }
1348 cpu_info = *_cpu_info; // shallow copy assignment
1349 return OS_OK;
1350 }
1351
1352 class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
1353 friend class NetworkPerformanceInterface;
1354 private:
1355 bool _iphlp_attached;
1356
1357 NetworkPerformance();
1358 NONCOPYABLE(NetworkPerformance);
1359 bool initialize();
1360 ~NetworkPerformance();
1361 int network_utilization(NetworkInterface** network_interfaces) const;
1362 };
1363
1364 NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance()
1365 : _iphlp_attached(false) {
1366 }
1367
1368 bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
1369 _iphlp_attached = IphlpDll::IphlpAttach();
1370 return _iphlp_attached;
1371 }
1372
1373 NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
1374 if (_iphlp_attached) {
1375 IphlpDll::IphlpDetach();
1376 }
1377 }
1378
|