Permalink
Browse files

Added valgrind profiler.

  • Loading branch information...
1 parent 9b5e9a7 commit 7c0754eda8ac2e225fa0aba0e8b2f2cabdcd4dd0 David Balatero committed with David Balatero Aug 26, 2009
Showing with 24 additions and 0 deletions.
  1. +24 −0 profilers/valgrind.rb
View
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+# go to ext/typhoeus and run ruby extconf.rb && make before running
+# this.
+
+$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../ext")
+require File.dirname(__FILE__) + "/../lib/typhoeus"
+
+klass = Class.new { include Typhoeus }
+
+loops = ENV['LOOPS'].to_i
+url = ARGV.first || (raise "requires URL!")
+
+loops.times do |i|
+ puts "On loop #{i}" if i % 10 == 0
+ results = []
+ 5.times do
+ results << klass.get(url)
+ end
+
+ # fire requests
+ results[0].code
+end
+
+puts "Ran #{loops} loops on #{url}!"

0 comments on commit 7c0754e

Please sign in to comment.