public
Rubygem
Description: simple database query profiling tool
Clone URL: git://github.com/quake/db_profiling.git
Search Repo:
change gemspec and add README
quake (author)
Wed Jun 11 07:29:22 -0700 2008
commit  0cb2d6a61a32e9796714cb71f1f52bcf3521af22
tree    c33ac373edd6e81567d23633b481565db9b42d7c
parent  700e63f890d132d75ee3ec2b825f04ea4f67f70e
0
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -0,0 +1,21 @@
0
+= DB Profiling
0
+
0
+A simple database query profiling tool, basis of Aaron Patterson's blog:
0
+http://tenderlovemaking.com/2008/03/13/profiling-database-queries-in-rails/
0
+Honor to him, bug to me
0
+
0
+== Installation
0
+
0
+The recommended way is that you get the gem:
0
+
0
+gem install quake-db_profiling --source http://gems.github.com/
0
+
0
+== Example usage
0
+
0
+add one line to environment.rb:
0
+
0
+require 'db_profiling' if RAILS_ENV == "development"
0
+
0
+add helper output to the view which you want to profiling, for example, layouts/application.rhtml:
0
+
0
+<%= db_profiling_view if RAILS_ENV == "development" %>
...
1
2
3
4
 
5
6
7
...
13
14
15
16
 
17
...
 
1
2
 
3
4
5
6
...
12
13
14
 
15
16
0
@@ -1,7 +1,6 @@
0
-require 'rubygems'
0
 Gem::Specification.new do |s|
0
   s.name = 'db_profiling'
0
- s.version = '0.0.1'
0
+ s.version = '0.0.2'
0
   s.date = '2008-06-11'
0
   
0
   s.summary = "simple database query profiling tool"
0
@@ -13,5 +12,5 @@ Gem::Specification.new do |s|
0
   s.has_rdoc = false
0
   s.extra_rdoc_files=["README"]
0
   
0
- s.files = Dir.glob("{lib}/**/*")
0
+ s.files = ["lib/db_profiling.rb", "lib/db_profiling/db_profiling.rb", "lib/db_profiling/db_profiling_helper.rb"]
0
 end
...
9
10
11
12
 
 
13
14
15
...
18
19
20
21
22
 
...
9
10
11
 
12
13
14
15
16
...
19
20
21
 
22
23
0
@@ -9,7 +9,8 @@ module JavaEye
0
       <strong>
0
         Queries: <a href="#" onclick="$('cache_hits').toggle();return false;">#{cache_stats[:hits].size}</a> / <a href="#" onclick="$('cache_misses').toggle();return false;">#{cache_stats[:misses].size}</a> / #{number_to_percentage((cache_stats[:hits].size.to_f / (cache_stats[:hits].size + cache_stats[:misses].size)) * 100, :precision => 0)} |
0
         Rows: #{sql_stats[:rows]} |
0
- Transfer: #{sprintf("%.1fk", sql_stats[:bytes].to_f / 1024)}
0
+ Transfer: #{sprintf("%.1fk", sql_stats[:bytes].to_f / 1024)} |
0
+ <a href="#" onclick="$('db_profiling').remove();return false;" title="close">[X]</a>
0
       </strong>
0
       <ul id="cache_hits" style="text-align:left;display:none;"><li>#{cache_stats[:hits].join("</li><li>")}</li></ul>
0
       <ul id="cache_misses" style="text-align:left;display:none;"><li>#{cache_stats[:misses].join("</li><li>")}</li></ul>
0
@@ -18,4 +19,4 @@ HTML
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.