$cat test.cpp
void longa()
{
  int i,j;
  for(i = 0; i < 900000000000; i++)
  j=i; //am I silly or crazy? I feel boring and desperate.
}

void foo2()
{
  int i;
  for(i=0 ; i < 90000000000; i++)
       longa();
}

void foo1()
{
  int i;
  for(i = 0; i< 9009999999900; i++)
     longa();
}

int main(void)
{
  foo1();
  foo2();
}

 

——————

perf top

如何查看 最耗cpu的进程和方法

相关文章:

  • 2021-10-28
  • 2021-10-08
  • 2022-12-23
  • 2021-09-04
  • 2021-06-20
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2021-10-05
相关资源
相似解决方案