本文整理汇总了C++中PCM::hasPCICFGUncore方法的典型用法代码示例。如果您正苦于以下问题:C++ PCM::hasPCICFGUncore方法的具体用法?C++ PCM::hasPCICFGUncore怎么用?C++ PCM::hasPCICFGUncore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCM
的用法示例。
在下文中一共展示了PCM::hasPCICFGUncore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[])
{
std::cout << "\n Intel(r) Performance Counter Monitor " << INTEL_PCM_VERSION << std::endl;
std::cout << "\n Power Monitoring Utility\n Copyright (c) 2011-2012 Intel Corporation\n";
int imc_profile = 0;
int pcu_profile = 0;
int delay = -1;
char * ext_program = NULL;
freq_band[0] = default_freq_band[0];
freq_band[1] = default_freq_band[1];
freq_band[2] = default_freq_band[2];
int my_opt = -1;
while ((my_opt = getopt(argc, argv, "m:p:a:b:c:")) != -1)
{
switch(my_opt)
{
case 'm':
imc_profile = atoi(optarg);
break;
case 'p':
pcu_profile = atoi(optarg);
break;
case 'a':
freq_band[0] = atoi(optarg);
break;
case 'b':
freq_band[1] = atoi(optarg);
break;
case 'c':
freq_band[2] = atoi(optarg);
break;
default:
print_usage(argv[0]);
return -1;
}
}
if (optind >= argc)
{
print_usage(argv[0]);
return -1;
}
delay = atoi(argv[optind]);
if(delay == 0)
ext_program = argv[optind];
else
delay = (delay<0)?1:delay;
#ifdef _MSC_VER
// Increase the priority a bit to improve context switching delays on Windows
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
TCHAR driverPath[1024];
GetCurrentDirectory(1024, driverPath);
wcscat(driverPath, L"\\msr.sys");
// WARNING: This driver code (msr.sys) is only for testing purposes, not for production use
Driver drv;
// drv.stop(); // restart driver (usually not needed)
if (!drv.start(driverPath))
{
std::cout << "Can not access CPU performance counters" << std::endl;
std::cout << "You must have signed msr.sys driver in your current directory and have administrator rights to run this program" << std::endl;
return -1;
}
#endif
PCM * m = PCM::getInstance();
m->disableJKTWorkaround();
if(!(m->hasPCICFGUncore()))
{
std::cout <<"Unsupported processor model ("<<m->getCPUModel()<<"). Only models "<<PCM::JAKETOWN<<" (JAKETOWN), " << PCM::IVYTOWN<< " (IVYTOWN) are supported."<< std::endl;
return -1;
}
if(PCM::Success != m->programServerUncorePowerMetrics(imc_profile,pcu_profile,freq_band))
{
#ifdef _MSC_VER
std::cout << "You must have signed msr.sys driver in your current directory and have administrator rights to run this program" << std::endl;
#elif defined(__linux__)
std::cout << "You need to be root and loaded 'msr' Linux kernel module to execute the program. You may load the 'msr' module with 'modprobe msr'. \n";
#endif
return -1;
}
ServerUncorePowerState * BeforeState = new ServerUncorePowerState[m->getNumSockets()];
ServerUncorePowerState * AfterState = new ServerUncorePowerState[m->getNumSockets()];
uint64 BeforeTime = 0, AfterTime = 0;
std::cout << std::dec << std::endl;
std::cout.precision(2);
std::cout << std::fixed;
std::cout << "\nMC counter group: "<<imc_profile << std::endl;
std::cout << "PCU counter group: "<<pcu_profile << std::endl;
if(pcu_profile == 0)
//.........这里部分代码省略.........