Changeset 10589 in vbox for trunk/src/VBox/Main/testcase
- Timestamp:
- Jul 14, 2008 10:16:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstAPI.cpp
r10544 r10589 920 920 921 921 #if 1 922 {922 do { 923 923 Bstr metricNames[] = { L"CPU/User:avg,CPU/System:avg,CPU/Idle:avg" }; 924 924 com::SafeArray<BSTR> metrics(1); … … 928 928 CHECK_RC_BREAK (virtualBox->COMGETTER(Host) (host.asOutParam())); 929 929 ComPtr <IPerformanceCollector> collector; 930 CHECK_RC ( virtualBox->COMGETTER(PerformanceCollector)(collector.asOutParam()) );930 CHECK_RC_BREAK( virtualBox->COMGETTER(PerformanceCollector)(collector.asOutParam()) ); 931 931 932 932 com::SafeIfaceArray<IUnknown> objects(1); 933 933 host.queryInterfaceTo(&objects[0]); 934 collector->SetupMetrics(ComSafeArrayAsInParam(metrics),935 ComSafeArrayAsInParam(objects), 1u, 10u);934 CHECK_RC_BREAK( collector->SetupMetrics(ComSafeArrayAsInParam(metrics), 935 ComSafeArrayAsInParam(objects), 1u, 10u) ); 936 936 RTThreadSleep(3000); /* Sleep 10 seconds. */ 937 /*com::SafeIfaceArray<IPerformanceData> result; 938 collector->QueryMetricsData(ComSafeArrayAsInParam(metrics), 939 ComSafeArrayAsInParam(objects), 940 ComSafeArrayAsOutParam(result)); 941 for (unsigned i = 0; i < result.size(); i++) 942 { 943 Bstr metricName; 944 result[i]->COMGETTER(MetricName) (metricName.asOutParam()); 945 com::SafeArray<LONG> values; 946 result[i]->COMGETTER(Values) (ComSafeArrayAsOutParam(values)); 937 com::SafeArray<BSTR> retNames; 938 com::SafeIfaceArray<IUnknown> retObjects; 939 com::SafeArray<ULONG> retIndices; 940 com::SafeArray<ULONG> retLengths; 941 com::SafeArray<LONG> retData; 942 CHECK_RC_BREAK( collector->QueryMetricsData(ComSafeArrayAsInParam(metrics), 943 ComSafeArrayAsInParam(objects), 944 ComSafeArrayAsOutParam(retNames), 945 ComSafeArrayAsOutParam(retObjects), 946 ComSafeArrayAsOutParam(retIndices), 947 ComSafeArrayAsOutParam(retLengths), 948 ComSafeArrayAsOutParam(retData)) ); 949 for (unsigned i = 0; i < retNames.size(); i++) 950 { 951 Bstr metricName(retNames[i]); 947 952 printf("%ls", metricName.raw()); 948 for (unsigned j = 0; j < values.size(); j++)953 for (unsigned j = 0; j < retLengths[i]; j++) 949 954 { 950 printf(" %d\n", values[j]);955 printf(" %d\n", retData[retIndices[i] + j]); 951 956 } 952 } */953 } 957 } 958 } while (0); 954 959 #endif 955 960 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.