Skip to content

Instantly share code, notes, and snippets.

@cmrd-senya
Created December 17, 2015 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmrd-senya/3accb933c5a6a78979f6 to your computer and use it in GitHub Desktop.
Save cmrd-senya/3accb933c5a6a78979f6 to your computer and use it in GitHub Desktop.
diff --git a/Gemfile b/Gemfile
index 1f40a5e..5017eff 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,7 @@
source "https://rubygems.org"
+gem "ruby-prof"
+
gem "rails", "4.2.5"
# Legacy Rails features, remove me!
diff --git a/Gemfile.lock b/Gemfile.lock
index 1de15f1..da25227 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -681,6 +681,7 @@ GEM
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-oembed (0.8.14)
+ ruby-prof (0.15.9)
ruby-progressbar (1.7.5)
rubyzip (1.1.7)
rugged (0.23.3)
@@ -918,6 +919,7 @@ DEPENDENCIES
rspec-rails (= 3.3.3)
rubocop (= 0.34.2)
ruby-oembed (= 0.8.14)
+ ruby-prof
rubyzip (= 1.1.7)
sass-rails (= 5.0.4)
selenium-webdriver (= 2.47.1)
diff --git a/lib/postzord/receiver.rb b/lib/postzord/receiver.rb
index ecdf02f..d56fb3a 100644
--- a/lib/postzord/receiver.rb
+++ b/lib/postzord/receiver.rb
@@ -1,7 +1,7 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
-
+require "ruby-prof"
class Postzord::Receiver
include Diaspora::Logging
@@ -11,7 +11,13 @@ class Postzord::Receiver
require 'postzord/receiver/local_batch'
def perform!
+ f = File.new("/tmp/#{Time.now}-diaspora.html", "a+")
+ RubyProf.start
self.receive!
+ result = RubyProf.stop
+ printer = RubyProf::GraphHtmlPrinter.new(result)
+ printer.print(f)
+ f.close
end
private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment