Haruka Yoshihara
null+****@clear*****
Thu Dec 13 18:31:11 JST 2012
Haruka Yoshihara 2012-12-13 18:31:11 +0900 (Thu, 13 Dec 2012) New Revision: 9af4c6d01925bc36d39990aa852beca873b1c028 https://github.com/groonga/groonga-query-log/commit/9af4c6d01925bc36d39990aa852beca873b1c028 Log: SizedStatistics: use start_time(Time)#to_f for comparing start_time Added files: test/fixtures/order/-start-time.expected test/fixtures/order/start-time.expected Modified files: lib/groonga/query-log/analyzer/sized-statistics.rb test/test-analyzer.rb Modified: lib/groonga/query-log/analyzer/sized-statistics.rb (+2 -2) =================================================================== --- lib/groonga/query-log/analyzer/sized-statistics.rb 2012-12-13 18:06:45 +0900 (41b5fad) +++ lib/groonga/query-log/analyzer/sized-statistics.rb 2012-12-13 18:31:11 +0900 (6cd68c1) @@ -136,11 +136,11 @@ module Groonga end when "-start-time" lambda do |statistic| - -statistic.start_time + -statistic.start_time.to_f end else lambda do |statistic| - statistic.start_time + statistic.start_time.to_f end end end Added: test/fixtures/order/-start-time.expected (+28 -0) 100644 =================================================================== --- /dev/null +++ test/fixtures/order/-start-time.expected 2012-12-13 18:31:11 +0900 (6415208) @@ -0,0 +1,28 @@ +Summary: + Threshold: + slow response : 0.2 + slow operation : 0.1 + # of responses : 2 + # of slow responses : 0 + responses/sec : 387.0613143828114 + start time : 2012-12-12 17:39:17.3 + last time : 2012-12-12 17:39:17.3 + period(sec) : 0.00516714 + slow response ratio : 0.000% + total response time : 0.004345996 + Slow Operations: + +Slow Queries: +1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select> + parameters: + <table>: <Users> + <query>: <follower:@groonga> + <output_columns>: <_key,name> + 1) 0.00084295: filter( 2) query: follower:@groonga + 2) 0.00002795: select( 2) + 3) 0.00019585: output( 2) _key,name + +2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load> + parameters: + <table>: <Video> + Added: test/fixtures/order/start-time.expected (+28 -0) 100644 =================================================================== --- /dev/null +++ test/fixtures/order/start-time.expected 2012-12-13 18:31:11 +0900 (9f63eb3) @@ -0,0 +1,28 @@ +Summary: + Threshold: + slow response : 0.2 + slow operation : 0.1 + # of responses : 2 + # of slow responses : 0 + responses/sec : 387.0613143828114 + start time : 2012-12-12 17:39:17.3 + last time : 2012-12-12 17:39:17.3 + period(sec) : 0.00516714 + slow response ratio : 0.000% + total response time : 0.004345996 + Slow Operations: + +Slow Queries: +1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load> + parameters: + <table>: <Video> + +2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select> + parameters: + <table>: <Users> + <query>: <follower:@groonga> + <output_columns>: <_key,name> + 1) 0.00084295: filter( 2) query: follower:@groonga + 2) 0.00002795: select( 2) + 3) 0.00019585: output( 2) _key,name + Modified: test/test-analyzer.rb (+8 -0) =================================================================== --- test/test-analyzer.rb 2012-12-13 18:06:45 +0900 (e39ef04) +++ test/test-analyzer.rb 2012-12-13 18:31:11 +0900 (d0fec82) @@ -46,6 +46,14 @@ class AnalyzerTest < Test::Unit::TestCase assert_equal(expected_result, actual_result) end + data(:desc_elapsed => "-elapsed", :desc_start_time => "-start-time") + def test_order(order) + actual_result = run_analyzer("--order=#{order}", @query_log_path) + + expected_result = expected_analyzed_query("order/#{order}.expected") + assert_equal(expected_result, actual_result) + end + private def run_analyzer(*arguments) output = Tempfile.new("output.actual").path -------------- next part -------------- HTML����������������������������...Download