stella 0.7.0.006 → 0.7.0.012

Sign up to get free protection for your applications and to get access to all the features.
data/lib/stella/client.rb CHANGED
@@ -4,86 +4,100 @@ require 'nokogiri'
4
4
 
5
5
  module Stella
6
6
  class Client
7
+ require 'stella/client/modifiers'
8
+ require 'stella/client/container'
9
+
7
10
  include Gibbler::Complex
8
11
  include Observable
9
12
 
10
13
  attr_reader :client_id
11
14
  attr_accessor :base_uri
12
15
  attr_accessor :proxy
13
- attr_reader :stats
16
+
14
17
  def initialize(base_uri=nil, client_id=1)
15
18
  @base_uri, @client_id = base_uri, client_id
16
- @cookie_file = Tempfile.new('stella-cookie')
17
- @stats = Stella::Stats.new("Client #{@client_id}")
19
+ #@cookie_file = File.new("cookies-#{client_id}", 'w')
18
20
  @proxy = OpenStruct.new
19
21
  end
20
-
21
- def execute(usecase)
22
+ def execute(usecase, &stat_collector)
23
+ # We need to make sure the gibbler cache has a value
24
+ self.gibbler if self.__gibbler_cache.nil?
25
+
22
26
  http_client = create_http_client
27
+ stats = {}
23
28
  container = Container.new(usecase)
24
29
  counter = 0
25
30
  usecase.requests.each do |req|
26
31
  counter += 1
32
+
33
+ stats ||= Benelux::Stats.new
27
34
  update(:prepare_request, usecase, req, counter)
28
35
  uri_obj = URI.parse(req.uri)
29
- params = prepare_params(usecase, req.params)
30
- headers = prepare_headers(usecase, req.headers)
36
+ params = prepare_params(container, req.params)
37
+ headers = prepare_headers(container, req.headers)
31
38
  uri = build_request_uri uri_obj, params, container
32
39
  raise NoHostDefined, uri_obj if uri.host.nil? || uri.host.empty?
40
+ stella_id = [Time.now, self.gibbler_cache, req, params, headers, counter].gibbler
41
+
42
+ Benelux.add_thread_tags :request => req.gibbler_cache
43
+ Benelux.add_thread_tags :retry => counter
44
+ Benelux.add_thread_tags :stella_id => stella_id
33
45
 
34
- unique_id = [req, params, headers, counter].gibbler
35
- req_id = req.gibbler
46
+ params['__stella'] = stella_id
47
+ headers['X-Stella-ID'] = stella_id
36
48
 
37
49
  meth = req.http_method.to_s.downcase
38
50
  Stella.ld "#{req.http_method}: " << "#{uri_obj.to_s} " << params.inspect
39
51
 
40
52
  begin
41
- send_request http_client, usecase, meth, uri, req, params, headers, container
53
+ send_request http_client, usecase, meth, uri, req, params, headers, container, counter
54
+ #http_client.save_cookie_store
55
+ update(:stats, http_client, usecase, req)
42
56
  rescue => ex
43
57
  update(:request_error, usecase, uri, req, params, ex)
44
58
  next
45
59
  end
46
60
 
47
- #probe_header_size(container.response)
48
- #probe_body_size(container.response)
49
-
61
+ Benelux.add_thread_tags :status => container.status
50
62
  ret = execute_response_handler container, req
63
+ Benelux.remove_thread_tags :status
51
64
 
52
65
  Stella.lflush
53
66
 
67
+ run_sleeper(req.wait) if req.wait && !nowait?
68
+
54
69
  # TODO: consider throw/catch
55
70
  case ret.class.to_s
56
71
  when "Stella::Client::Repeat"
57
- Stella.ld "REPETITION: #{counter} of #{ret.times+1}"
72
+ update(:repeat_request, counter, ret.times+1)
58
73
  redo if counter <= ret.times
59
74
  when "Stella::Client::Quit"
60
- Stella.ld "QUIT USECASE: #{ret.message}"
75
+ update(:quit_usecase, ret.message)
61
76
  break
62
77
  end
63
78
 
64
-
65
79
  counter = 0 # reset
66
- run_sleeper(req.wait) if req.wait && !benchmark?
67
80
  end
81
+ Benelux.remove_thread_tags :retry, :request, :stella_id
82
+ stats
68
83
  end
69
84
 
70
- def enable_benchmark_mode; @bm = true; end
71
- def disable_benchmark_mode; @bm = false; end
72
- def benchmark?; @bm == true; end
85
+ def enable_nowait_mode; @nowait = true; end
86
+ def disable_nowait_mode; @nowait = false; end
87
+ def nowait?; @nowait == true; end
73
88
 
74
89
  private
75
- def send_request(http_client, usecase, meth, uri, req, params, headers, container)
76
- update(:send_request, usecase, uri, req, params, container)
90
+ def send_request(http_client, usecase, meth, uri, req, params, headers, container, counter)
77
91
  container.response = http_client.send(meth, uri, params, headers) # booya!
78
- update(:receive_response, usecase, uri, req, params, container)
92
+ update(:receive_response, usecase, uri, req, counter, container)
79
93
  end
80
94
 
81
95
  def update(kind, *args)
82
- changed and notify_observers(kind, @client_id, *args)
96
+ changed and notify_observers(kind, self.__gibbler_cache, *args)
83
97
  end
84
98
 
85
99
  def run_sleeper(wait)
86
- if wait.is_a?(Range)
100
+ if wait.is_a?(::Range)
87
101
  ms = rand(wait.last * 1000).to_f
88
102
  ms = wait.first if ms < wait.first
89
103
  else
@@ -101,24 +115,23 @@ module Stella
101
115
  http_client = HTTPClient.new opts
102
116
  http_client.set_proxy_auth(@proxy.user, @proxy.pass) if @proxy.user
103
117
  http_client.debug_dev = STDOUT if Stella.debug? && Stella.loglev > 3
104
- http_client.set_cookie_store @cookie_file.to_s
105
- #http_client.redirect_uri_callback = ??
118
+ #http_client.set_cookie_store @cookie_file.path
106
119
  http_client
107
120
  end
108
121
 
109
- def prepare_params(usecase, params)
122
+ def prepare_params(container, params)
110
123
  newparams = {}
111
124
  params.each_pair do |n,v|
112
125
  Stella.ld "PREPARE PARAM: #{n}"
113
- v = usecase.instance_eval &v if v.is_a?(Proc)
126
+ v = container.instance_eval &v if v.is_a?(Proc)
114
127
  newparams[n] = v
115
128
  end
116
129
  newparams
117
130
  end
118
131
 
119
- def prepare_headers(usecase, headers)
132
+ def prepare_headers(container, headers)
120
133
  Stella.ld "PREPARE HEADERS: #{headers}"
121
- headers = usecase.instance_eval &headers if headers.is_a?(Proc)
134
+ headers = container.instance_eval &headers if headers.is_a?(Proc)
122
135
  headers
123
136
  end
124
137
 
@@ -132,6 +145,12 @@ module Stella
132
145
  # If no replacement value can be found, the variable will remain.
133
146
  def build_request_uri(uri, params, container)
134
147
  uri = URI::HTTP.build({:path => uri}) unless uri.is_a?(URI::Generic)
148
+
149
+ if uri.host.nil? && base_uri.nil?
150
+ Stella.abort!
151
+ raise NoHostDefined, uri
152
+ end
153
+
135
154
  uri.scheme = base_uri.scheme if uri.scheme.nil?
136
155
  uri.host = base_uri.host if uri.host.nil?
137
156
  uri.port = base_uri.port if uri.port.nil?
@@ -197,52 +216,5 @@ module Stella
197
216
  end
198
217
  end
199
218
 
200
- class Container
201
- attr_accessor :usecase
202
- attr_accessor :response
203
- def initialize(usecase)
204
- @usecase = usecase
205
- end
206
-
207
- def self.const_missing(const, *args)
208
- ResponseError.new(const)
209
- end
210
-
211
- def doc
212
- # NOTE: It's important to parse the document on every
213
- # request because this container is available for the
214
- # entire life of a usecase.
215
- case @response.header['Content-Type']
216
- when ['text/html']
217
- Nokogiri::HTML(body)
218
- when ['text/yaml']
219
- YAML.load(body)
220
- end
221
- end
222
-
223
- def body; @response.body.content; end
224
- def headers; @response.header; end
225
- alias_method :header, :headers
226
- def status; @response.status; end
227
- def set(n, v); usecase.resource n, v; end
228
- def resource(n); usecase.resource n; end
229
- def wait(t); sleep t; end
230
- def quit(msg=nil); Quit.new(msg); end
231
- def repeat(t=1); Repeat.new(t); end
232
- end
233
-
234
- class ResponseModifier; end
235
- class Repeat < ResponseModifier;
236
- attr_accessor :times
237
- def initialize(times)
238
- @times = times
239
- end
240
- end
241
- class Quit < ResponseModifier;
242
- attr_accessor :message
243
- def initialize(msg=nil)
244
- @message = msg
245
- end
246
- end
247
219
  end
248
220
  end
@@ -84,14 +84,14 @@ module Stella::Data::HTTP
84
84
  end
85
85
 
86
86
  def inspect
87
- str = "%s %s HTTP/%s" % [http_method, uri.to_s, http_version]
87
+ str = "%s %s" % [http_method, uri.to_s, http_version]
88
88
  #str << $/ + headers.join($/) unless headers.empty?
89
89
  #str << $/ + $/ + body.to_s if body
90
90
  str
91
91
  end
92
92
 
93
93
  def to_s
94
- str = "%s %s HTTP/%s" % [http_method, uri.to_s, http_version]
94
+ str = "%s %s" % [http_method, uri.to_s, http_version]
95
95
  str
96
96
  end
97
97
 
@@ -7,7 +7,7 @@ module Stella::Engine
7
7
  def run(plan, opts={})
8
8
  opts = {
9
9
  :hosts => [],
10
- :benchmark => false,
10
+ :nowait => false,
11
11
  :repetitions => 1
12
12
  }.merge! opts
13
13
  Stella.ld "OPTIONS: #{opts.inspect}"
@@ -17,7 +17,7 @@ module Stella::Engine
17
17
  client = Stella::Client.new opts[:hosts].first
18
18
  client.add_observer(self)
19
19
 
20
- client.enable_benchmark_mode if opts[:benchmark]
20
+ client.enable_nowait_mode if opts[:nowait]
21
21
 
22
22
  Stella.li $/, "Starting test...", $/
23
23
  Stella.lflush
@@ -25,40 +25,35 @@ module Stella::Engine
25
25
 
26
26
  plan.usecases.each_with_index do |uc,i|
27
27
  desc = (uc.desc || "Usecase ##{i+1}")
28
- Stella.li ' %-65s '.att(:reverse).bright % [desc]
28
+ Stella.li ' %-65s '.att(:reverse).bright % ["#{desc} (#{uc.gibbler_cache.shorter}) "]
29
29
  Stella.rescue { client.execute uc }
30
30
  end
31
31
 
32
-
33
- #p client.benelux_at(:execute_start).first.name
34
-
35
- #p client.benelux_between(:execute_start, :execute_end)
36
-
37
- #p client.benelux_duration(:execute)
38
-
39
32
  !plan.errors?
40
33
  end
41
34
 
42
35
 
43
36
  def update_prepare_request(client_id, usecase, req, counter)
44
37
  notice = "repeat: #{counter-1}" if counter > 1
45
- Stella.li2 ' ' << " %-46s %16s ".att(:reverse) % [req.desc, notice]
38
+ Stella.li2 " %-46s %16s ".bright % [req.desc, notice]
46
39
  end
47
40
 
48
- def update_send_request(client_id, usecase, uri, req, params, counter)
49
-
50
- end
51
-
52
- def update_receive_response(client_id, usecase, uri, req, params, container)
53
- Stella.li ' %-59s %3d' % [uri, container.status]
54
- Stella.li2 " Method: " << req.http_method
55
- Stella.li2 " Params: " << params.inspect
56
- Stella.li3 $/, " Headers:"
41
+ def update_receive_response(client_id, usecase, uri, req, counter, container)
42
+ Stella.li ' %-59s %3d' % [uri, container.status]
43
+
44
+ Stella.li2 ' ' << container.response.request.header.send(:request_line)
45
+
46
+ Stella.li2 $/, " Request-Headers:"
47
+ container.response.request.header.all.each do |pair|
48
+ Stella.li2 " %s: %s" % pair
49
+ end
50
+
51
+ Stella.li2 $/, " Response-Headers:"
57
52
  container.headers.all.each do |pair|
58
- Stella.li3 " %s: %s" % pair
53
+ Stella.li2 " %s: %s" % pair
59
54
  end
60
- Stella.li4 $/, " Content:"
61
- Stella.li4 container.body.empty? ? ' [empty]' : container.body
55
+ Stella.li3 $/, " Response-Content:"
56
+ Stella.li3 container.body.empty? ? ' [empty]' : container.body
62
57
  Stella.li2 $/
63
58
  end
64
59
 
@@ -72,7 +67,7 @@ module Stella::Engine
72
67
 
73
68
  def update_request_error(client_id, usecase, uri, req, params, ex)
74
69
  desc = "#{usecase.desc} > #{req.desc}"
75
- Stella.le ' Client%-3s %-45s %s' % [client_id, desc, ex.message]
70
+ Stella.le ' Client-%s %-45s %s' % [client_id.short, desc, ex.message]
76
71
  Stella.ld ex.backtrace
77
72
  end
78
73
 
@@ -3,13 +3,13 @@ module Stella::Engine
3
3
  module Load
4
4
  extend Stella::Engine::Base
5
5
  extend self
6
-
6
+
7
7
  def run(plan, opts={})
8
8
  opts = {
9
9
  :hosts => [],
10
10
  :clients => 1,
11
11
  :time => nil,
12
- :benchmark => false,
12
+ :nowait => false,
13
13
  :repetitions => 1
14
14
  }.merge! opts
15
15
  opts[:clients] = plan.usecases.size if opts[:clients] < plan.usecases.size
@@ -19,50 +19,42 @@ module Stella::Engine
19
19
  Stella.li3 "Hosts: " << opts[:hosts].join(', ')
20
20
  Stella.li2 plan.pretty
21
21
 
22
- packages = build_thread_package plan, opts
23
- Stella.li $/, "Prepared #{packages.size} virtual clients..."
24
- Stella.lflush
25
-
22
+ counts = calculate_usecase_clients plan, opts
26
23
 
27
- Stella.li $/, "Starting test...", $/
24
+ Stella.li $/, "Preparing #{counts[:total]} virtual clients...", $/
28
25
  Stella.lflush
29
- sleep 0.3
26
+ packages = build_thread_package plan, opts, counts
30
27
 
28
+ Stella.li "Generating load...", $/
29
+ Stella.lflush
31
30
 
32
- Thread.ify packages, :threads => opts[:clients] do |package|
33
- # TEMPFIX. The fill in build_thread_package is creating nil elements
34
- next if package.nil?
35
- (1..opts[:repetitions]).to_a.each do |rep|
36
- # We store client specific data in the usecase
37
- # so we clone it here so each thread is unique.
38
- Stella.rescue { package.client.execute package.usecase }
39
- end
40
-
41
- #package.client.benelux_timeline.each do |i|
42
- # Stella.li "#{package.client.client_id}: #{i.to_f}: #{i.name}"
43
- #end
44
- #t = Benelux.thread_timeline.sort
45
- #dur = t.last.to_f - t.first.to_f
46
- #Stella.li [:thread, t.first.name, t.last.name, dur].inspect
47
- #Stella.lflush
31
+ begin
32
+ execute_test_plan packages, opts[:repetitions]
33
+ rescue Interrupt
34
+ Stella.li "Stopping test...", $/
35
+ Stella.abort!
36
+ ensure
37
+ Stella.li "Processing statistics...", $/
38
+ Stella.lflush
39
+ generate_report plan
40
+
41
+ rep_stats = self.timeline.ranges(:build_thread_package).first
42
+ Stella.li "%20s %0.4f" % ['Prep time:', rep_stats.duration]
43
+
44
+ rep_stats = self.timeline.ranges(:execute_test_plan).first
45
+ Stella.li "%20s %0.4f" % ['Test time:', rep_stats.duration]
46
+
47
+ rep_stats = self.timeline.ranges(:generate_report).first
48
+ Stella.li "%20s %0.4f" % ['Reporting time:', rep_stats.duration]
49
+ Stella.li $/
48
50
  end
49
51
 
50
- #t = Benelux.timeline.sort
51
- #dur = t.last.to_f - t.first.to_f
52
- #Stella.li [:global, t.first.name, t.last.name, dur].inspect
53
-
54
- #puts Thread.list
55
- #p Benelux.timeline
52
+
56
53
 
57
- prev = nil
58
- #Stella.li Benelux.timeline.sort.collect { |obj|
59
- # str = "#{obj.to_f}: #{obj.name} (#{obj.same_timeline?(prev)})"
60
- # prev = obj
61
- # str
62
- #}
63
54
  !plan.errors?
64
55
  end
65
56
 
57
+
66
58
  protected
67
59
  class ThreadPackage
68
60
  attr_accessor :index
@@ -73,10 +65,9 @@ module Stella::Engine
73
65
  end
74
66
  end
75
67
 
76
- def build_thread_package(plan, opts)
77
- packages, pointer = Array.new(opts[:clients]), 0
68
+ def calculate_usecase_clients(plan, opts)
69
+ counts = { :total => 0 }
78
70
  plan.usecases.each_with_index do |usecase,i|
79
-
80
71
  count = case opts[:clients]
81
72
  when 0..9
82
73
  if (opts[:clients] % plan.usecases.size > 0)
@@ -88,48 +79,127 @@ module Stella::Engine
88
79
  else
89
80
  (opts[:clients] * usecase.ratio).to_i
90
81
  end
91
-
82
+ counts[usecase.gibbler_cache] = count
83
+ counts[:total] += count
84
+ end
85
+ counts
86
+ end
87
+
88
+ def build_thread_package(plan, opts, counts)
89
+ packages, pointer = Array.new(counts[:total]), 0
90
+ plan.usecases.each do |usecase|
91
+ count = counts[usecase.gibbler_cache]
92
92
  Stella.ld "THREAD PACKAGE: #{usecase.desc} (#{pointer} + #{count})"
93
93
  # Fill the thread_package with the contents of the block
94
94
  packages.fill(pointer, count) do |index|
95
- Stella.li2 "Creating client ##{index+1} "
95
+ Stella.li3 "Creating client ##{index+1} "
96
96
  client = Stella::Client.new opts[:hosts].first, index+1
97
97
  client.add_observer(self)
98
- client.enable_benchmark_mode if opts[:benchmark]
99
- ThreadPackage.new(index+1, client, usecase.clone)
98
+ client.enable_nowait_mode if opts[:nowait]
99
+ ThreadPackage.new(index+1, client, usecase)
100
100
  end
101
101
  pointer += count
102
102
  end
103
- packages
103
+ packages.compact # TODO: Why one nil element sometimes?
104
104
  end
105
105
 
106
-
107
- def update_prepare_request(client_id, usecase, req, counter)
108
-
106
+ def execute_test_plan(packages, reps=1)
107
+ Thread.ify packages, :threads => packages.size do |package|
108
+
109
+ # This thread will stay on this one track.
110
+ Benelux.current_track package.client.gibbler
111
+ Benelux.add_thread_tags :usecase => package.usecase.gibbler_cache
112
+
113
+ (1..reps).to_a.each do |rep|
114
+ Benelux.add_thread_tags :rep => rep
115
+ Stella::Engine::Load.rescue(package.client.gibbler_cache) {
116
+ print '.' if Stella.loglev == 1
117
+ stats = package.client.execute package.usecase
118
+ break if Stella.abort?
119
+ }
120
+ Benelux.remove_thread_tags :rep
121
+ end
122
+
123
+ Benelux.remove_thread_tags :usecase
124
+ end
125
+ Stella.li $/, $/
109
126
  end
110
-
111
- def update_send_request(client_id, usecase, uri, req, params, counter)
112
127
 
128
+ def generate_report(plan)
129
+ Benelux.update_all_track_timelines
130
+ global_timeline = Benelux.timeline
131
+
132
+ Stella.li $/, " %-72s ".att(:reverse) % ["#{plan.desc} (#{plan.gibbler_cache.shorter})"]
133
+ plan.usecases.uniq.each_with_index do |uc,i|
134
+
135
+ # TODO: Create Ranges object, like Stats object
136
+ # global_timeline.ranges(:do_request)[:usecase => '1111']
137
+ # The following returns globl do_request ranges.
138
+ requests = 0 #global_timeline.ranges(:do_request).size
139
+
140
+ desc = uc.desc || "Usecase ##{i+1} "
141
+ desc << " (#{uc.gibbler_cache.shorter}) "
142
+ str = ' ' << " %-66s %s %d%% ".bright.att(:reverse)
143
+ Stella.li str % [desc, '', uc.ratio_pretty]
144
+
145
+ uc.requests.each do |req|
146
+ desc = req.desc
147
+ Stella.li " %-72s ".bright % ["#{req.desc} (#{req.gibbler_cache.shorter})"]
148
+ Stella.li " %s" % [req.to_s]
149
+ global_timeline.stats.each_pair do |n,stat|
150
+ filter = {
151
+ :usecase => uc.gibbler_cache,
152
+ :request => req.gibbler_cache
153
+ }
154
+ stats = stat[filter]
155
+ Stella.li ' %-30s %.3f <= %.3f >= %.3f; %.3f(SD) %d(N)' % [n, stats.min, stats.mean, stats.max, stats.sd, stats.n]
156
+ Stella.lflush
157
+ end
158
+ Stella.li $/
159
+ end
160
+ end
113
161
  end
114
162
 
115
- def update_receive_response(client_id, usecase, uri, req, params, container)
163
+
164
+ def update_prepare_request(client_id, usecase, req, counter)
165
+
166
+ end
167
+
168
+ def update_receive_response(client_id, usecase, uri, req, counter, container)
116
169
  desc = "#{usecase.desc} > #{req.desc}"
117
- Stella.li2 ' Client%-3s %3d %-6s %-45s %s' % [client_id, container.status, req.http_method, desc, uri]
170
+ Stella.li2 ' Client-%s %3d %-6s %-45s' % [client_id.shorter, container.status, req.http_method, uri]
118
171
  end
119
172
 
120
173
  def update_execute_response_handler(client_id, req, container)
121
174
  end
122
175
 
123
176
  def update_error_execute_response_handler(client_id, ex, req, container)
177
+ desc = "#{container.usecase.desc} > #{req.desc}"
178
+ Stella.li $/ if Stella.loglev == 1
179
+ Stella.le ' Client-%s %-45s %s' % [client_id.shorter, desc, ex.message]
180
+ Stella.ld ex.backtrace
124
181
  end
125
182
 
126
183
  def update_request_error(client_id, usecase, uri, req, params, ex)
127
184
  desc = "#{usecase.desc} > #{req.desc}"
128
- Stella.le ' Client%-3s %-45s %s' % [client_id, desc, ex.message]
185
+ Stella.li $/ if Stella.loglev == 1
186
+ Stella.le ' Client-%s %-45s %s' % [client_id.shorter, desc, ex.message]
129
187
  Stella.ld ex.backtrace
130
188
  end
131
189
 
132
190
 
191
+ def self.rescue(client_id, &blk)
192
+ blk.call
193
+ rescue => ex
194
+ Stella.le ' Error in Client-%s: %s' % [client_id.shorter, ex.message]
195
+ Stella.ld ex.backtrace
196
+ end
197
+
198
+
199
+ Benelux.add_timer Stella::Engine::Load, :generate_report
200
+ Benelux.add_timer Stella::Engine::Load, :build_thread_package
201
+ Benelux.add_timer Stella::Engine::Load, :execute_test_plan
202
+ Benelux.add_timer Stella::Client, :execute_response_handler
133
203
  end
134
204
  end
135
205
 
data/lib/stella/engine.rb CHANGED
@@ -2,15 +2,20 @@
2
2
 
3
3
  module Stella::Engine
4
4
 
5
- Benelux.add_timer Stella::Client, :execute
6
- Benelux.add_timer Stella::Client, :send_request
5
+ # These commented out timers are not very revealing.
6
+ #Benelux.add_timer Stella::Client, :execute
7
+ #Benelux.add_timer Stella::Client, :send_request
8
+ #Benelux.add_timer HTTPClient, :create_request
9
+
10
+ # These timers are interesting from a reporting perspective.
7
11
  Benelux.add_timer HTTPClient, :do_request
8
12
  Benelux.add_timer HTTPClient::Session, :create_socket
13
+ Benelux.add_timer HTTPClient::Session, :create_ssl_socket
9
14
  Benelux.add_timer HTTPClient::Session, :connect
10
15
  Benelux.add_timer HTTPClient::Session, :query
11
- Benelux.add_timer HTTPClient::Session, :socket_gets_initial_line
16
+ Benelux.add_timer HTTPClient::Session, :socket_gets_first_byte
12
17
  Benelux.add_timer HTTPClient::Session, :get_body
13
-
18
+
14
19
  module Base
15
20
  extend self
16
21
 
@@ -26,6 +31,22 @@ module Stella::Engine
26
31
 
27
32
  def run; raise; end
28
33
 
34
+
35
+ def update_quit_usecase client_id, msg
36
+ Stella.li2 " Client-%s QUIT %s" % [client_id.shorter, msg]
37
+ end
38
+
39
+
40
+ def update_repeat_request client_id, counter, total
41
+ Stella.li3 " Client-%s REPEAT %d of %d" % [client_id.shorter, counter, total]
42
+ end
43
+
44
+ def update_stats client_id, http_client, usecase, req
45
+ #range = Thread.current.timeline.ranges(:do_request).last
46
+ #Thread.current.stathash
47
+ #Stella.li "Client-%s: %s-%s %s %.4f" % [client_id.short, usecase.gibbler.short, req.gibbler.short, req.desc, range.duration]
48
+ end
49
+
29
50
  def update_prepare_request(*args) raise end
30
51
  def update_send_request(*args) raise end
31
52
  def update_receive_response(*args) raise end
@@ -0,0 +1,6 @@
1
+
2
+
3
+ class Thread
4
+ extend Attic
5
+ attic :stats
6
+ end