Fix fmt-countertype in check_perfmon

All three options are now working as expected

fixes #10487
This commit is contained in:
Jean Flach 2016-09-08 16:30:30 +02:00
parent 38ac7b2070
commit 3e7b943e36
1 changed files with 7 additions and 6 deletions

View File

@ -131,13 +131,11 @@ BOOL ParseArguments(CONST INT ac, WCHAR **av, po::variables_map& vm, printInfoSt
} }
if (vm.count("fmt-countertype")) { if (vm.count("fmt-countertype")) {
if (vm["fmt-countertype"].as<std::wstring>().compare(L"double")) if (!vm["fmt-countertype"].as<std::wstring>().compare(L"int64"))
printInfo.dwRequestedType = PDH_FMT_DOUBLE;
else if (vm["fmt-countertype"].as<std::wstring>().compare(L"int64"))
printInfo.dwRequestedType = PDH_FMT_LARGE; printInfo.dwRequestedType = PDH_FMT_LARGE;
else if (vm["fmt-countertype"].as<std::wstring>().compare(L"long")) else if (!vm["fmt-countertype"].as<std::wstring>().compare(L"long"))
printInfo.dwRequestedType = PDH_FMT_LONG; printInfo.dwRequestedType = PDH_FMT_LONG;
else { else if (vm["fmt-countertype"].as<std::wstring>().compare(L"double")) {
std::wcout << "Unknown value type " << vm["fmt-countertype"].as<std::wstring>() << '\n'; std::wcout << "Unknown value type " << vm["fmt-countertype"].as<std::wstring>() << '\n';
return FALSE; return FALSE;
} }
@ -339,12 +337,15 @@ BOOL QueryPerfData(printInfoStruct& pI)
switch (pI.dwRequestedType) switch (pI.dwRequestedType)
{ {
case (PDH_FMT_LONG): case (PDH_FMT_LONG) :
pI.dValue = pDisplayValues[0].FmtValue.longValue; pI.dValue = pDisplayValues[0].FmtValue.longValue;
break;
case (PDH_FMT_LARGE) : case (PDH_FMT_LARGE) :
pI.dValue = pDisplayValues[0].FmtValue.largeValue; pI.dValue = pDisplayValues[0].FmtValue.largeValue;
break;
default: default:
pI.dValue = pDisplayValues[0].FmtValue.doubleValue; pI.dValue = pDisplayValues[0].FmtValue.doubleValue;
break;
} }
delete[]pDisplayValues; delete[]pDisplayValues;