From 37144f88d4b11ae55a73fb063bcd82c0c45a5cf0 Mon Sep 17 00:00:00 2001 From: Lauren Prinn Date: Mon, 20 Jun 2022 15:47:55 -0700 Subject: [PATCH] Handling RESULT_CODE_FAILURE_NO_CONTEXT_INFO_AVAILABLE and simplifying noAdmin logic Handling RESULT_CODE_FAILURE_NO_CONTEXT_INFO_AVAILABLE and simplifying noAdmin logic --- src/Commands.cpp | 7 +++++-- src/main.cpp | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Commands.cpp b/src/Commands.cpp index b815d10..deac924 100644 --- a/src/Commands.cpp +++ b/src/Commands.cpp @@ -136,7 +136,7 @@ void PrintError(RESULT_CODE failureCode) case RESULT_CODE_FAILURE_INSUFFICIENT_PRIVILEGES: std::wcout << "This operation requires administrator privileges."; break; - + case RESULT_CODE_FAILURE_DROPPED_EVENTS: std::wcout << "Events were dropped during the trace. Please try recollecting the trace."; break; @@ -146,7 +146,10 @@ void PrintError(RESULT_CODE failureCode) "does not support the version of the operating system that the trace was collected on. " "Please try updating vcperf to the latest version."; break; - + case RESULT_CODE_FAILURE_NO_CONTEXT_INFO_AVAILABLE: + std::wcout << "You are using a version of Build Insights that does not support the `/noadmin` option. " + "Please try updating your Build Insights version to at least 1.3.0."; + break; case RESULT_CODE_FAILURE_START_SYSTEM_TRACE: case RESULT_CODE_FAILURE_START_MSVC_TRACE: std::wcout << "A trace that is currently being collected on your system is preventing vcperf " diff --git a/src/main.cpp b/src/main.cpp index 5351778..091e653 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -206,11 +206,10 @@ int wmain(int argc, wchar_t* argv[]) return E_FAIL; } noAdminSpecified = true; - noCpuSamplingSpecified = true; } else if (subCommand == StartSubCommand::NO_CPU_SAMPLING) { - if (noCpuSamplingSpecified && !noAdminSpecified) + if (noCpuSamplingSpecified) { std::wcout << L"ERROR: you can only specify /nocpusampling once." << std::endl; std::wcout << L"vcperf.exe /start [/noadmin] [/nocpusampling] [/level1 | /level2 | /level3] sessionName" << std::endl;