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

Function RunLogDemo

IntelPresentMon/SampleClient/LogDemo.cpp:39–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void RunLogDemo(int mode)
40{
41 pmapi::Session sesh;
42
43 for (auto&& o : clio::Options::Get().GetForwardedOptions()) {
44 std::cout << std::format("({}, {})", o.first, o.second) << std::endl;
45 }
46
47 // basic log info w/ message
48 if (mode == 0) {
49 pmlog_info("information goes here");
50 }
51 // basic warn w/ format message
52 else if (mode == 1) {
53 const int x = 4224;
54 pmlog_warn(std::format("warning with variable x = {}", x));
55 }
56 // error log has trace (no message)
57 else if (mode == 2) {
58 f1();
59 }
60 // disable info at runtime
61 else if (mode == 3) {
62 log::GlobalPolicy::Get().SetLogLevel(log::Level::Warning);
63 pmlog_info("info hidden");
64 pmlog_warn("warn gets through");
65 }
66 // show build release disable (info/warn)
67 else if (mode == 4) {
68 pmlog_info("info hidden in release, shows in debug");
69 pmlog_error("error always shows");
70 }
71 // set trace level
72 else if (mode == 5) {
73 log::GlobalPolicy::Get().SetTraceLevel(log::Level::Warning);
74 pmlog_warn("enable stack trace for warning");
75 }
76 // error code logging hr
77 else if (mode == 6) {
78 CreateFileA("this-doesnt-exist.fake", 0, 0, nullptr, OPEN_EXISTING, 0, nullptr);
79 pmlog_error().hr();
80 }
81 // error code logging pmon
82 else if (mode == 7) {
83 pmlog_error().code(PM_STATUS_INVALID_ADAPTER_ID);
84 }
85 // watch for variables
86 else if (mode == 8) {
87 const int x = 2, y = 10;
88 pmlog_info().pmwatch(x).pmwatch(y).pmwatch(std::pow(x, y));
89 }
90 // loop frequency control 3 variants
91 else if (mode == 9) {
92 for (int i = 0; i < 9; i++) {
93 pmlog_warn("every 3").every(3);
94 pmlog_warn("first 2").first(2);
95 pmlog_warn("after 6").after(6);
96 }

Callers 1

mainFunction · 0.85

Calls 11

f1Function · 0.85
g1Function · 0.85
ReportExceptionFunction · 0.85
GetForwardedOptionsMethod · 0.80
SetLogLevelMethod · 0.80
SetTraceLevelMethod · 0.80
SetExceptionTraceMethod · 0.80
emptyMethod · 0.80
GetDefaultChannelFunction · 0.70
AttachComponentMethod · 0.45
WaitForConnectionMethod · 0.45

Tested by

no test coverage detected