Permalink
Browse files

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
  • Loading branch information...
1 parent 0f198eb commit 0de97c81dbe80e4abc50ec1434b33fe3219f2fd4 @leonbreedt leonbreedt committed Mar 31, 2005
@@ -1,5 +1,6 @@
require 'ostruct'
require 'uri'
+require 'benchmark'
module ActionWebService
module Scaffolding # :nodoc:
@@ -62,12 +63,15 @@ def #{action_name}_submit
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
@@ -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 %>

0 comments on commit 0de97c8

Please sign in to comment.