16

我需要分析我通常运行的测试套件bundle exec rspec spec/并生成 GIF 图像。

运行perftools.rb以使其与捆绑程序正常工作的命令是什么?

4

1 回答 1

16

我也不得不四处挖掘才能得到这个。这是我所做的

  1. 把它放在 spec_helper.rb 中:

    config.before :suite do
      PerfTools::CpuProfiler.start("/tmp/rspec_profile")
    end
    
    config.after :suite do
      PerfTools::CpuProfiler.stop
    end
    
  2. 运行你的 rspec

  3. 运行 pprof 以获取您的号码

    pprof.rb --text  /tmp/rspec_profile
    
于 2012-12-14T04:50:18.203 回答