33#include < format>
44#include " WmiCpu.h"
55
6+ #define GLOG_NO_ABBREVIATED_SEVERITIES
7+ #include < glog/logging.h>
8+
69namespace pwr ::cpu::wmi {
710
811std::wstring kProcessorFrequency =
@@ -24,32 +27,23 @@ WmiCpu::WmiCpu() {
2427 PdhAddEnglishCounterW (query_.get (), kProcessorFrequency .c_str (), 0 ,
2528 &processor_frequency_counter_);
2629 result != ERROR_SUCCESS) {
27- throw std::runtime_error{
28- std::format (" PdhAddEnglishCounter failed when adding processor frequency "
29- " counter. Result: {}" ,
30- result)
31- .c_str ()};
30+ LOG (INFO) << " PdhAddEnglishCounter failed when adding processor frequency counter. Result:"
31+ << result << std::endl;
3232 }
3333
3434 if (const auto result =
3535 PdhAddEnglishCounterW (query_.get (), kProcessorPerformance .c_str (),
3636 0 , &processor_performance_counter_);
3737 result != ERROR_SUCCESS) {
38- throw std::runtime_error{
39- std::format (" PdhAddEnglishCounter failed when adding processor performance "
40- " counter. Result: {}" ,
41- result)
42- .c_str ()};
38+ LOG (INFO) << " PdhAddEnglishCounter failed when adding processor performance counter. Result:"
39+ << result << std::endl;
4340 }
4441
4542 if (const auto result = PdhAddEnglishCounterW (query_.get (), kProcessorIdleTime .c_str (), 0 ,
4643 &processor_idle_time_counter_);
4744 result != ERROR_SUCCESS) {
48- throw std::runtime_error{
49- std::format (" PdhAddEnglishCounter failed when adding "
50- " processor time counter. Result: {}" ,
51- result)
52- .c_str ()};
45+ LOG (INFO) << " PdhAddEnglishCounter failed when adding processor time counter. Result:"
46+ << result << std::endl;
5347 }
5448
5549 // Most counters require two sample values to display a formatted value.
0 commit comments