perf_check 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5a9897a251c91e07e9e20082a6992fcd952964b
4
- data.tar.gz: cd11654f7464453b90bb57f52bba33a5f51cfd0a
3
+ metadata.gz: 4889da43eb0fdd05ddda82e2ac5ce98f39fa2104
4
+ data.tar.gz: 37f15e1100fbdb95b386921da50a2be65a4daec3
5
5
  SHA512:
6
- metadata.gz: 097aec836afed6820b9cbdb5b5a9f94797f2a0511d3797b22bbf3c730064ddf2e616402037f10379cb035bb45804453e57d3dcb0403a4a3ee15363af25c4ef2a
7
- data.tar.gz: 6d8467a860d950e173f9e419c19533bbb033230e8b9588c29eb119b8c6a4d0d960bf8a4730b46ab87b546b99a9df783f39365fe62ba66c1058348605225d41d2
6
+ metadata.gz: ded87cf9dd12de4ebd09d4305008ccfc7a9111e61cd51ff682da0cee52f5c97912382ead9a87832c1c86fe069f1c850893be4270e8533733e4c6602e47be66de
7
+ data.tar.gz: 9d0960078d6740851e1c79f8d577a137b733a3c08d22c6d5c690a56540dfa3eb3bdf56289e71b149fa937de19280f9df7f81e42993ba1fba391049bc0921adc3
data/bin/perf_check CHANGED
@@ -46,8 +46,6 @@ perf_check.run
46
46
 
47
47
  if perf_check.options.brief
48
48
  perf_check.print_brief_results
49
- elsif perf_check.options.json
50
- perf_check.print_json_results
51
49
  else
52
50
  perf_check.print_full_results
53
51
  end
@@ -47,10 +47,6 @@ class PerfCheck
47
47
  options.headers[key.strip] = value.strip
48
48
  end
49
49
 
50
- opts.on('--json', '-j') do
51
- options.json = true
52
- end
53
-
54
50
  opts.on('--input FILE', '-i') do |input|
55
51
  File.readlines(input).each do |resource|
56
52
  ARGV << resource.strip
@@ -66,12 +62,12 @@ class PerfCheck
66
62
  options.brief = true
67
63
  end
68
64
 
69
- # opts.on('--diff') do
70
- # options.diff = true
71
- # options.brief = true
72
- # options.verify_responses = true
73
- # options.number_of_requests = 1
74
- # end
65
+ opts.on('--diff') do
66
+ options.diff = true
67
+ options.brief = true
68
+ options.verify_responses = true
69
+ options.number_of_requests = 1
70
+ end
75
71
 
76
72
  opts.separator ''
77
73
  opts.separator <<EOF
@@ -101,8 +97,8 @@ EOF
101
97
  end
102
98
  end
103
99
 
104
- def self.diff_options
105
- @@diff_options ||=
100
+ def diff_options
101
+ @diff_options ||=
106
102
  ['-U3', '--ignore-matching-lines=/mini-profiler-resources/includes.js']
107
103
  end
108
104
  end
@@ -66,47 +66,4 @@ class PerfCheck
66
66
  print_diff_results(test.response_diff) if options.verify_responses
67
67
  end
68
68
  end
69
-
70
- def print_json_results
71
- results = []
72
- test_cases.each do |test|
73
- results.push(
74
- route: test.resource,
75
- latency: test.this_latency,
76
- query_count: test.this_query_count,
77
- requests: []
78
- )
79
-
80
- test.this_profiles.each do |profile|
81
- results[-1][:requests].push(
82
- latency: profile.latency,
83
- query_count: profile.query_count,
84
- server_memory: profile.server_memory,
85
- response_code: profile.response_code,
86
- miniprofiler_url: profile.profile_url
87
- )
88
- end
89
-
90
- if options.reference
91
- results[-1].merge!(
92
- reference_latency: test.reference_latency,
93
- latency_difference: test.latency_difference,
94
- speedup_factor: test.speedup_factor,
95
- reference_query_count: test.reference_query_count,
96
- reference_requests: []
97
- )
98
-
99
- test.reference_profiles.each do |profile|
100
- results[-1][:reference_requests].push(
101
- latency: profile.latency,
102
- query_count: profile.query_count,
103
- server_memory: profile.server_memory,
104
- response_code: profile.response_code,
105
- miniprofiler_url: profile.profile_url
106
- )
107
- end
108
- end
109
- end
110
- puts JSON.pretty_generate(results)
111
- end
112
69
  end
@@ -80,13 +80,13 @@ class PerfCheck
80
80
  end
81
81
 
82
82
  def response_diff
83
- diff = Diffy::Diff.new(this_response, reference_response,
84
- :diff => PerfCheck.diff_options)
83
+ diff = Diffy::Diff.new(reference_response, this_response,
84
+ diff: perf_check.diff_options)
85
85
  if diff.to_s.empty?
86
86
  OpenStruct.new(:changed? => false)
87
87
  else
88
- FileUtils.mkdir_p("#{Rails.root}/tmp/perf_check/diffs")
89
- file = `mktemp -u "#{Rails.root}/tmp/perf_check/diffs/XXXXXXXXXX"`.strip
88
+ FileUtils.mkdir_p("#{perf_check.app_root}/tmp/perf_check/diffs")
89
+ file = `mktemp -u "#{perf_check.app_root}/tmp/perf_check/diffs/XXXXXXXXX"`.strip
90
90
  [:text, :html].each do |format|
91
91
  ext = {:text => 'diff', :html => 'html'}[format]
92
92
  File.open("#{file}.#{ext}", 'w'){ |f| f.write(diff.to_s(format)) }
data/lib/perf_check.rb CHANGED
@@ -4,7 +4,6 @@ require 'fileutils'
4
4
  require 'benchmark'
5
5
  require 'ostruct'
6
6
  require 'colorize'
7
- require 'json'
8
7
  require 'logger'
9
8
 
10
9
  class PerfCheck
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perf_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune