Question

Je dois profiler la suite de tests avec laquelle j'exécute habituellement bundle exec rspec spec/ et produisez l’image GIF.

Quelle est la commande pour exécuter le perftools.rb pour que ça fonctionne correctement avec bundler ?

Était-ce utile?

La solution

Moi aussi, j'ai dû fouiller pour obtenir ça.Voici ce que j'ai fait

  1. Mettez ceci dans spec_helper.rb :

    config.before :suite do
      PerfTools::CpuProfiler.start("/tmp/rspec_profile")
    end
    
    config.after :suite do
      PerfTools::CpuProfiler.stop
    end
    
  2. Exécutez votre rspec

  3. Exécutez pprof pour obtenir vos numéros

    pprof.rb --text  /tmp/rspec_profile
    
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top