aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/lib
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-03-31 10:47:01 +0000
committerLeon Breedt <bitserf@gmail.com>2005-03-31 10:47:01 +0000
commit0de97c81dbe80e4abc50ec1434b33fe3219f2fd4 (patch)
treed1785188387cce4166b157227f34a36eca974ac8 /actionwebservice/lib
parent0f198eb58ece74409827f3d4a739e49a1a0ecab5 (diff)
downloadrails-0de97c81dbe80e4abc50ec1434b33fe3219f2fd4.tar.gz
rails-0de97c81dbe80e4abc50ec1434b33fe3219f2fd4.tar.bz2
rails-0de97c81dbe80e4abc50ec1434b33fe3219f2fd4.zip
display the amount of time taken to invoke a scaffolding request
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1044 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib')
-rw-r--r--actionwebservice/lib/action_web_service/scaffolding.rb14
-rw-r--r--actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml4
2 files changed, 13 insertions, 5 deletions
diff --git a/actionwebservice/lib/action_web_service/scaffolding.rb b/actionwebservice/lib/action_web_service/scaffolding.rb
index 21790c101b..e311515fba 100644
--- a/actionwebservice/lib/action_web_service/scaffolding.rb
+++ b/actionwebservice/lib/action_web_service/scaffolding.rb
@@ -1,5 +1,6 @@
require 'ostruct'
require 'uri'
+require 'benchmark'
module ActionWebService
module Scaffolding # :nodoc:
@@ -62,12 +63,15 @@ module ActionWebService
when :xmlrpc
protocol = Protocol::XmlRpc::XmlRpcProtocol.new
end
- @method_request_xml = @scaffold_method.encode_rpc_call(protocol.marshaler, protocol.encoder, @params['method_params'].dup)
cgi = @request.cgi
- @request = protocol.create_action_pack_request(@scaffold_service.name, @scaffold_method.public_name, @method_request_xml)
- dispatch_web_service_request
- @method_response_xml = @response.body
- @method_return_value = protocol.marshaler.unmarshal(protocol.encoder.decode_rpc_response(@method_response_xml)[1]).value
+ bm = Benchmark.measure do
+ @method_request_xml = @scaffold_method.encode_rpc_call(protocol.marshaler, protocol.encoder, @params['method_params'].dup)
+ @request = protocol.create_action_pack_request(@scaffold_service.name, @scaffold_method.public_name, @method_request_xml)
+ dispatch_web_service_request
+ @method_response_xml = @response.body
+ @method_return_value = protocol.marshaler.unmarshal(protocol.encoder.decode_rpc_response(@method_response_xml)[1]).value
+ end
+ @method_elapsed = bm.real
add_instance_variables_to_assigns
@response = ::ActionController::CgiResponse.new(cgi)
@performed_render = false
diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml b/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml
index 4475abff4a..5317688fcd 100644
--- a/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml
+++ b/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml
@@ -1,6 +1,10 @@
<h4>Method Invocation Result for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4>
<p>
+Invocation took <tt><%= '%f' % @method_elapsed %></tt> seconds
+</p>
+
+<p>
<strong>Return Value:</strong><br />
<pre>
<%= h @method_return_value.inspect %>