本文整理汇总了C++中PCM::getServerUncorePowerState方法的典型用法代码示例。如果您正苦于以下问题:C++ PCM::getServerUncorePowerState方法的具体用法?C++ PCM::getServerUncorePowerState怎么用?C++ PCM::getServerUncorePowerState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCM
的用法示例。
在下文中一共展示了PCM::getServerUncorePowerState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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)
std::cout << "Freq bands [0/1/2]: "<<freq_band[0]*100 << " MHz; "<< freq_band[1]*100 << " MHz; "<<freq_band[2]*100 << " MHz; "<<std::endl;
if(!ext_program)
std::cout << "Update every "<<delay<<" seconds"<< std::endl;
uint32 i = 0;
BeforeTime = m->getTickCount();
for(i=0; i<m->getNumSockets(); ++i)
BeforeState[i] = m->getServerUncorePowerState(i);
while(1)
{
std::cout << "----------------------------------------------------------------------------------------------"<<std::endl;
#ifdef _MSC_VER
int delay_ms = delay * 1000;
// compensate slow Windows console output
if(AfterTime) delay_ms -= (int)(m->getTickCount() - BeforeTime);
if(delay_ms < 0) delay_ms = 0;
#else
int delay_ms = delay * 1000;
#endif
if(ext_program)
MySystem(ext_program);
else
MySleepMs(delay_ms);
AfterTime = m->getTickCount();
for(i=0; i<m->getNumSockets(); ++i)
AfterState[i] = m->getServerUncorePowerState(i);
std::cout << "Time elapsed: "<<AfterTime-BeforeTime<<" ms\n";
std::cout << "Called sleep function for "<<delay_ms<<" ms\n";
for(uint32 socket=0;socket<m->getNumSockets();++socket)
{
for(uint32 port=0;port<m->getQPILinksPerSocket();++port)
{
std::cout << "S"<<socket<<"P"<<port
<< "; QPIClocks: "<< getQPIClocks(port,BeforeState[socket],AfterState[socket])
<< "; L0p Tx Cycles: "<< 100.*getNormalizedQPIL0pTxCycles(port,BeforeState[socket],AfterState[socket])<< "%"