vbox的更動 44548 路徑 trunk/src/VBox/Main/src-server
- 時間撮記:
- 2013-2-5 下午03:52:49 (12 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/src-server/Performance.cpp
r44529 r44548 29 29 #endif 30 30 #include "Performance.h" 31 #include "HostNetworkInterfaceImpl.h" 32 #include "netif.h" 31 33 32 34 #include <VBox/com/array.h> … … 684 686 } 685 687 688 #ifndef VBOX_COLLECTOR_TEST_CASE 689 static bool getLinkSpeed(const char *szShortName, uint32_t *pSpeed) 690 { 691 /* 692 * Note that we do not need the full name in the info, so we do not 693 * allocate the space for it and we rely on the fact that 694 * NetIfGetConfigByName() never fills it. 695 */ 696 NETIFINFO Info; 697 memset(&Info, 0, sizeof(Info)); 698 strcpy(Info.szShortName, szShortName); 699 int rc = NetIfGetConfigByName(&Info); 700 if (RT_FAILURE(rc)) 701 return false; 702 *pSpeed = Info.enmStatus == NETIF_S_UP ? Info.uSpeedMbits : 0; 703 return true; 704 } 705 706 void HostNetworkSpeed::init(ULONG period, ULONG length) 707 { 708 mPeriod = period; 709 mLength = length; 710 mLinkSpeed->init(length); 711 /* 712 * Retrieve the link speed now as it may be wrong if the metric was 713 * registered at boot (see @bugref{6613}). 714 */ 715 getLinkSpeed(mShortName.c_str(), &mSpeed); 716 } 717 686 718 void HostNetworkLoadRaw::init(ULONG period, ULONG length) 687 719 { … … 690 722 mRx->init(mLength); 691 723 mTx->init(mLength); 724 /* 725 * Retrieve the link speed now as it may be wrong if the metric was 726 * registered at boot (see @bugref{6613}). 727 */ 728 uint32_t uSpeedMbit = 65535; 729 if (getLinkSpeed(mShortName.c_str(), &uSpeedMbit)) 730 mSpeed = (uint64_t)uSpeedMbit * (1000000/8); /* Convert to bytes/sec */ 692 731 /*int rc =*/ mHAL->getRawHostNetworkLoad(mShortName.c_str(), &mRxPrev, &mTxPrev); 693 732 //AssertRC(rc); … … 736 775 " Will update the list of interfaces...\n", mRc,mRc)); 737 776 } 777 #endif /* !VBOX_COLLECTOR_TEST_CASE */ 738 778 739 779 void HostDiskLoadRaw::init(ULONG period, ULONG length)
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器