Skip to content

Commit 4cfde58

Browse files
committed
verbose working for service
1 parent 0955602 commit 4cfde58

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

IntelPresentMon/KernelProcess/KernelProcess.args.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"Id": "49b6fc1f-b969-4280-b0d8-17a213e80f16",
37-
"Command": "--log-verbose-modules core_window v8async"
37+
"Command": "--log-verbose-modules core_window v8async etwq"
3838
},
3939
{
4040
"Id": "bab48d6d-3a48-4b3b-9ed9-903e381824c6",

IntelPresentMon/KernelProcess/winmain.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,24 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
210210
as::io_context ioctx;
211211
std::optional<bp2::basic_process<as::io_context::executor_type>> svcChild;
212212
if (opt.svcAsChild) {
213-
svcChild = bp2::windows::default_launcher{}(
214-
ioctx, "PresentMonService.exe"s, std::vector{
213+
// compile fixed CLI options
214+
auto args = std::vector<std::string>{
215215
"--control-pipe"s, *opt.controlPipe,
216216
"--nsm-prefix"s, "pm-frame-nsm"s,
217217
"--intro-nsm"s, *opt.shmName,
218218
"--etw-session-name"s, *opt.etwSessionName,
219219
"--log-level"s, util::log::GetLevelName(util::log::GlobalPolicy::Get().GetLogLevel()),
220220
"--log-pipe-name"s, logSvcPipe,
221-
"--enable-stdio-log"s
222-
});
223-
221+
"--enable-stdio-log"s,
222+
};
223+
// append verbose module options
224+
if (opt.logVerboseModules) {
225+
args.push_back("--log-verbose-modules"s);
226+
args.append_range(*opt.logVerboseModules | vi::transform(util::log::GetVerboseModuleName));
227+
}
228+
// launch service child process
229+
svcChild = bp2::windows::default_launcher{}(ioctx, "PresentMonService.exe"s, std::move(args));
230+
// wait for pipe availability of service api
224231
if (!::pmon::util::win::WaitForNamedPipe(*opt.controlPipe + "-in", 1500)) {
225232
pmlog_error("timeout waiting for child service control pipe to go online");
226233
return -1;
@@ -377,7 +384,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
377384
"--p2c-log-trace-level"s, util::log::GetLevelName(*opt.logTraceLevel),
378385
"--p2c-act-name"s, actName,
379386
"--p2c-log-pipe-name"s, cefLogPipe
380-
});
387+
});
381388
// launch the CEF browser process, which in turn launches all the other processes in the CEF process constellation
382389
auto cefChild = [&] {
383390
if (util::win::WeAreElevated()) {

IntelPresentMon/PresentMonService/CliOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "../CommonUtilities/cli/CliFramework.h"
33
#include "../CommonUtilities/log/Level.h"
4+
#include "../CommonUtilities/log/Verbose.h"
45
#include "GlobalIdentifiers.h"
56

67
namespace clio
@@ -11,6 +12,7 @@ namespace clio
1112
{
1213
private:
1314
CLI::CheckedTransformer logLevelTf_{ GetLevelMapNarrow(), CLI::ignore_case };
15+
CLI::CheckedTransformer logVmodTf_{ GetVerboseModuleMapNarrow(), CLI::ignore_case };
1416

1517
private: Group gc_{ this, "Connection", "Control client connection" }; public:
1618
Option<std::string> etwSessionName{ this, "--etw-session-name", "", "Name to use when creating the ETW session" };
@@ -34,6 +36,7 @@ namespace clio
3436
Flag disableIpcLog{ this, "--disable-ipc-log", "Disable logging to named pipe connection" };
3537
Option<Level> logLevel{ this, "--log-level", Level::Error, "Severity to log at", logLevelTf_ };
3638
Flag logNamePid{ this, "--log-name-pid", "Append PID to log files instead of timestamp" };
39+
Option<std::vector<V>> logVerboseModules{ this, "--log-verbose-modules", {}, "Verbose logging modules to enable", logVmodTf_ };
3740

3841
private: Group gt_{ this, "Testing", "Automated testing features" }; public:
3942
Flag enableTestControl{ this, "--enable-test-control", "Enable test control over stdio" };

IntelPresentMon/PresentMonService/LogSetup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ namespace logsetup
7777
if (opt.logLevel || reg.logLevel.Exists()) {
7878
GlobalPolicy::Get().SetLogLevel(opt.logLevel ? *opt.logLevel : reg.logLevel);
7979
}
80+
if (opt.logVerboseModules) {
81+
for (auto mod : *opt.logVerboseModules) {
82+
GlobalPolicy::Get().ActivateVerboseModule(mod);
83+
}
84+
}
8085
if (!opt.enableStdioLog) {
8186
pChannel->AttachComponent({}, "drv:std");
8287
}

0 commit comments

Comments
 (0)