peek-gc-0.0.2/0000755000175000017500000000000013153002057012044 5ustar pravipravipeek-gc-0.0.2/CHANGELOG.md0000644000175000017500000000027613153002057013662 0ustar pravipravi# 0.0.1 - Initial release # 0.0.2 - GC tooltip values weren't matching values displayed. [@ChrisLundquist](https://github.com/chrislundquist) [#1](https://github.com/peek/peek-gc/pull/1) peek-gc-0.0.2/README.md0000644000175000017500000000111013153002057013314 0ustar pravipravi# Peek::GC Take a peek into the GC info of your Rails application. ## Installation Add this line to your application's Gemfile: gem 'peek-gc' And then execute: $ bundle Or install it yourself as: $ gem install peek-gc ## Usage Add the following to your `config/initializers/peek.rb`: ```ruby Peek.into Peek::Views::GC ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request peek-gc-0.0.2/lib/0000755000175000017500000000000013153002057012612 5ustar pravipravipeek-gc-0.0.2/lib/peek/0000755000175000017500000000000013153002057013536 5ustar pravipravipeek-gc-0.0.2/lib/peek/views/0000755000175000017500000000000013153002057014673 5ustar pravipravipeek-gc-0.0.2/lib/peek/views/gc.rb0000644000175000017500000000330213153002057015607 0ustar pravipravimodule Peek module Views class GC < View attr_reader :invokes attr_reader :invoke_time attr_reader :use_size attr_reader :total_size attr_reader :total_object attr_reader :gc_time def results parse_result { :invokes => invokes, :invoke_time => "%.2f" % invoke_time, :use_size => use_size, :total_size => total_size, :total_object => total_object, :gc_time => "%.2f" % gc_time } end def parse_result results = ::GC::Profiler.result.split("\n") @invokes = 0 @invoke_time = 0.0 @use_size = 0 @total_size = 0 @total_object = 0 @gc_time = 0.0 return if results.empty? @invokes = results.first.scan(/\s+\d+(?:\.\d+)?/).first.strip results[2..-1].each do |line| _, invoke_time, use_size, total_size, total_object, gc_time = line.scan(/\s+\-?\d+(?:\.\d+)?/).collect(&:strip) @invoke_time += invoke_time.to_f @use_size += use_size.to_i @total_size += total_size.to_i @total_object += total_object.to_i @gc_time += gc_time.to_f end end private def setup_subscribers # Reset each counter when a new request starts before_request do |name, start, finish, id, payload| ::GC::Profiler.enable ::GC::Profiler.clear end # Once the action is finished subscribe 'process_action.action_controller' do |name, start, finish, id, payload| ::GC::Profiler.disable ::GC::Profiler.clear end end end end end peek-gc-0.0.2/lib/peek-gc.rb0000644000175000017500000000011413153002057014446 0ustar pravipravirequire 'peek/views/gc' require 'peek-gc/version' require 'peek-gc/railtie' peek-gc-0.0.2/lib/peek-gc/0000755000175000017500000000000013153002057014125 5ustar pravipravipeek-gc-0.0.2/lib/peek-gc/railtie.rb0000644000175000017500000000011613153002057016101 0ustar pravipravimodule Peek module GC class Railtie < ::Rails::Engine end end end peek-gc-0.0.2/lib/peek-gc/version.rb0000644000175000017500000000007013153002057016134 0ustar pravipravimodule Peek module GC VERSION = '0.0.2' end end peek-gc-0.0.2/peek-gc.gemspec0000644000175000017500000000146613153002057014733 0ustar pravipravi# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'peek-gc/version' Gem::Specification.new do |gem| gem.name = 'peek-gc' gem.version = Peek::GC::VERSION gem.authors = ['Garrett Bjerkhoel'] gem.email = ['me@garrettbjerkhoel.com'] gem.description = %q{Take a peek into the GC info of your Rails application.} gem.summary = %q{Take a peek into the GC info of your Rails application.} gem.homepage = 'https://github.com/peek/peek-gc' gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] gem.add_dependency 'peek' end peek-gc-0.0.2/LICENSE.txt0000644000175000017500000000206113153002057013666 0ustar pravipraviCopyright (c) 2013 Garrett Bjerkhoel MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.peek-gc-0.0.2/.gitignore0000644000175000017500000000023213153002057014031 0ustar pravipravi*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp peek-gc-0.0.2/Rakefile0000644000175000017500000000003413153002057013506 0ustar pravipravirequire "bundler/gem_tasks" peek-gc-0.0.2/app/0000755000175000017500000000000013153002057012624 5ustar pravipravipeek-gc-0.0.2/app/views/0000755000175000017500000000000013153002057013761 5ustar pravipravipeek-gc-0.0.2/app/views/peek/0000755000175000017500000000000013153002057014705 5ustar pravipravipeek-gc-0.0.2/app/views/peek/views/0000755000175000017500000000000013153002057016042 5ustar pravipravipeek-gc-0.0.2/app/views/peek/views/_gc.html.erb0000644000175000017500000000027713153002057020235 0ustar pravipravi...ms / ... gc peek-gc-0.0.2/Gemfile0000644000175000017500000000013413153002057013335 0ustar pravipravisource 'https://rubygems.org' # Specify your gem's dependencies in peek-gc.gemspec gemspec