File: thread_test.rb

package info (click to toggle)
ruby-prof 0.4.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 348 kB
  • ctags: 275
  • sloc: ruby: 990; ansic: 939; makefile: 20
file content (32 lines) | stat: -rwxr-xr-x 574 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env ruby

require 'test/unit'
require 'ruby-prof'
require 'timeout'
require 'test_helper'

# --  Tests ----
class ThreadTest < Test::Unit::TestCase
  def test_thread
    RubyProf.start
    
    begin
      status = Timeout::timeout(2) do
      	while true
        	next
      	end
    	end
   	rescue Timeout::Error
   	end
   
    result = RubyProf.stop
    
    result.threads.values.each do |methods|
			methods.values.each do |method|
    		check_parent_times(method)
    		check_parent_calls(method)
    		check_child_times(method)		
			end
  	end
  end
end