문제

오이 테스트와 관련된 프로파일 러/프로파일 링 관련 문제.

오이 테스트 중 하나는 상당히 느리게 진행됩니다. 응용 프로그램이 어디에 시간을 소비하는지 추측하면서 프로그램적으로 알고 싶습니다.

프로파일 러로 오이 테스트를 어떻게 트리거합니까 ???

작동하지 않는 것 :

  $ URL=/projects/by/114951412 #URL to slow rails page
  $ script/performance/profiler 'app.get "$URL"' 50

'app.get'이 콘솔에서만 작동하고 프로파일 러 스크립트에 사용할 수 없기 때문에 작동하지 않습니다.

  $ EXPENSIVE_METHOD="Project.find('6300003243').aggregated_total_amount"
  $ script/performance/profiler "$EXPENSIVE_METHOD" 50

이것은 결과를 제공하지만이 방법은 병목 현상이라고 추측해야합니다.

(오이를 사용하고 있습니다.

도움이 되었습니까?

해결책 2

한 가지 더 실험은 실제로 내 질문에 대한 답변이지만 나에게주지 않았지만 실제로 유용한 결과를주지는 않습니다.

$ PROJECT_DIR=`pwd`
$ which cucumber
/usr/local/bin/cucumber
$ ln -s `which cucumber` cukes #required for profiler to have local file in next step
$ ruby-prof cukes -- features/manager_overview.feature:36

이것은 실제로 36 행에서 단일 오이 시나리오를 실행하지만 결과는 특히 유용하지 않습니다.

다른 팁

또한 오이를 시도해보십시오 -가장 느린 단계에 대한 몇 가지 통계를 얻으려면 공식 사용을 시도하십시오.

Ruby-Prof를 사용하면 제목 코드 전에 프로파일 러를 시작하고 다시 중지 할 수 있습니다. 예를 들어 :

require 'ruby-prof'
RubyProf.start
# code here
result = RubyProf.stop

# You can then output the trace in different ways.
# Simply print a overview to stdout
printer = RubyProf::FlatPrinter.new(result)
printer.print($stdout, :min_percent => 0.1)

# Save a callgrind trace
# You can load this up in kcachegrind or a compatible tool.
printer = RubyProf::CallTreePrinter.new(result)
File.open "callgrind.out.42", 'w' do |file|
  RubyProf::CallTreePrinter.new(result).print(file)
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top