MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / MakeChannel

Function MakeChannel

IntelPresentMon/PresentMonService/LogSetup.cpp:28–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 namespace
27 {
28 std::shared_ptr<IChannel> MakeChannel()
29 {
30 GlobalPolicy::Get().SetSubsystem(Subsystem::Server);
31 // channel (use custom deleter to ensure deletion in this module's heap)
32 auto pChannel = std::shared_ptr<IChannel>{ new Channel{}, [](Channel* p) { delete p; } };
33 // error resolver
34 auto pErrorResolver = std::make_shared<ErrorCodeResolver>();
35 pErrorResolver->AddProvider(std::make_unique<win::HrErrorCodeProvider>());
36 pErrorResolver->AddProvider(std::make_unique<pwr::intel::IgclErrorCodeProvider>());
37 pErrorResolver->AddProvider(std::make_unique<pmapi::PmErrorCodeProvider>());
38 // error resolving policy
39 auto pErrPolicy = std::make_shared<ErrorCodeResolvePolicy>();
40 pErrPolicy->SetResolver(std::move(pErrorResolver));
41 pChannel->AttachComponent(std::move(pErrPolicy));
42 // make and add the line-tracking policy
43 pChannel->AttachComponent(std::make_shared<LinePolicy>());
44 // make the formatter
45 const auto pFormatter = std::make_shared<TextFormatter>();
46 // attach drivers
47 pChannel->AttachComponent(std::make_shared<MsvcDebugDriver>(pFormatter), "drv:dbg");
48 pChannel->AttachComponent(std::make_shared<StdioDriver>(pFormatter), "drv:std");
49 // flusher
50 pChannel->AttachComponent(std::make_shared<ChannelFlusher>(pChannel), "obj:fsh");
51
52 return pChannel;
53 }
54 }
55
56 // this is injected into to util::log namespace and hooks into that system

Callers

nothing calls this directly

Calls 4

SetSubsystemMethod · 0.80
AddProviderMethod · 0.80
SetResolverMethod · 0.80
AttachComponentMethod · 0.45

Tested by

no test coverage detected