gltail 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -1
- data/lib/gl_tail.rb +1 -1
- data/lib/gl_tail/block.rb +62 -37
- data/lib/gl_tail/config.rb +14 -11
- data/lib/gl_tail/element.rb +3 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/gl_tail.rb
CHANGED
data/lib/gl_tail/block.rb
CHANGED
@@ -37,7 +37,6 @@ class Block
|
|
37
37
|
@max_rate = 1.0/599
|
38
38
|
|
39
39
|
@sorted = []
|
40
|
-
@updated = false
|
41
40
|
end
|
42
41
|
|
43
42
|
def show=(value)
|
@@ -122,8 +121,7 @@ class Block
|
|
122
121
|
else
|
123
122
|
x = @elements[options[:name]]
|
124
123
|
end
|
125
|
-
x.add_activity(options[:message], @color || options[:color], options[:size] || 0.01, options[:type] || 0 )
|
126
|
-
@updated = true
|
124
|
+
x.add_activity(options[:message], @color || options[:color], options[:size] || 0.01, options[:type] || 0, options[:real_size] || options[:size] )
|
127
125
|
end
|
128
126
|
|
129
127
|
def add_event(options = { })
|
@@ -142,7 +140,6 @@ class Block
|
|
142
140
|
end
|
143
141
|
|
144
142
|
x.add_event(options[:message], options[:color] || @color, options[:update_stats] || false)
|
145
|
-
@updated = true
|
146
143
|
end
|
147
144
|
|
148
145
|
def update
|
@@ -151,48 +148,76 @@ class Block
|
|
151
148
|
@max_rate = @max_rate * 0.9999
|
152
149
|
|
153
150
|
startTime = Time.now
|
154
|
-
|
155
151
|
i = 1
|
152
|
+
@sorted[0].update
|
156
153
|
@ordered = [@sorted[0]]
|
157
|
-
|
154
|
+
min_pos = 0
|
158
155
|
size = @sorted.size
|
159
156
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
157
|
+
if @show == 0
|
158
|
+
min = @sorted[0].rate
|
159
|
+
while i < size
|
160
|
+
@sorted[i].update
|
161
|
+
rate = @sorted[i].rate
|
162
|
+
if rate > min
|
163
|
+
j = min_pos
|
164
|
+
while @ordered[j-1].rate < rate && j > 0
|
165
|
+
j -= 1
|
166
|
+
end
|
167
|
+
@ordered.insert(j, @sorted[i])
|
168
|
+
else
|
169
|
+
@ordered << @sorted[i]
|
170
|
+
if i < @size
|
171
|
+
min = rate
|
172
|
+
min_pos = i
|
173
|
+
end
|
166
174
|
end
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
175
|
+
i += 1
|
176
|
+
end
|
177
|
+
elsif @show == 1
|
178
|
+
min = @sorted[0].total
|
179
|
+
while i < size
|
180
|
+
@sorted[i].update
|
181
|
+
total = @sorted[i].total
|
182
|
+
if total > min
|
183
|
+
j = min_pos
|
184
|
+
while @ordered[j-1].total < total && j > 0
|
185
|
+
j -= 1
|
186
|
+
end
|
187
|
+
@ordered.insert(j, @sorted[i])
|
188
|
+
else
|
189
|
+
@ordered << @sorted[i]
|
190
|
+
if i < @size
|
191
|
+
min = total
|
192
|
+
min_pos = i
|
193
|
+
end
|
194
|
+
end
|
195
|
+
i += 1
|
171
196
|
end
|
172
|
-
|
197
|
+
elsif @show == 2
|
198
|
+
min = @sorted[0].average
|
199
|
+
while i < size
|
200
|
+
@sorted[i].update
|
201
|
+
average = @sorted[i].average
|
202
|
+
if average > min
|
203
|
+
j = min_pos
|
204
|
+
while @ordered[j-1].average < average && j > 0
|
205
|
+
j -= 1
|
206
|
+
end
|
207
|
+
@ordered.insert(j, @sorted[i])
|
208
|
+
else
|
209
|
+
@ordered << @sorted[i]
|
210
|
+
if i < @size
|
211
|
+
min = average
|
212
|
+
min_pos = i
|
213
|
+
end
|
214
|
+
end
|
215
|
+
i += 1
|
216
|
+
end
|
217
|
+
|
173
218
|
end
|
174
219
|
|
175
220
|
@sorted = @ordered
|
176
|
-
|
177
|
-
# puts "#{@name} [#{@sorted.size}]: [#{Time.now - startTime}]" if @name == "urls"
|
178
|
-
|
179
|
-
return
|
180
|
-
|
181
|
-
return unless @updated
|
182
|
-
|
183
|
-
sortTime = Time.now
|
184
|
-
# iSort( @sorted )
|
185
|
-
|
186
|
-
# @sorted = case @show
|
187
|
-
# when 0: @sorted.insertionSort
|
188
|
-
# when 1: @sorted.sort! { |k,v| "#{sprintf('%05d',v.total)} #{v.rate}" <=> "#{sprintf('%05d',k.total)} #{k.rate}" }
|
189
|
-
# when 2: @sorted.sort! { |k,v| "#{v.average} #{v.name}" <=> "#{k.average} #{k.name}" }
|
190
|
-
# end
|
191
|
-
|
192
|
-
puts "#{@name} [#{@sorted.size}]: [#{sortTime - startTime}] [#{Time.now - sortTime}]"
|
193
|
-
|
194
|
-
@updated = false
|
195
|
-
|
196
221
|
end
|
197
222
|
|
198
223
|
end
|
data/lib/gl_tail/config.rb
CHANGED
@@ -160,20 +160,23 @@ module GlTail
|
|
160
160
|
|
161
161
|
#block, message, size
|
162
162
|
def add_activity(source, options = { })
|
163
|
-
size = screen.min_blob_size
|
164
|
-
if options[:size]
|
165
|
-
size = options[:size].to_f
|
166
|
-
@max_size = size if size > @max_size
|
167
|
-
size = screen.min_blob_size + ((size / @max_size) * (screen.max_blob_size - screen.min_blob_size))
|
168
|
-
options[:size] = size
|
169
|
-
end
|
170
163
|
|
171
164
|
if block = @blocks_by_name[options[:block]]
|
165
|
+
|
166
|
+
size = screen.min_blob_size
|
167
|
+
if options[:size]
|
168
|
+
size = options[:size].to_f
|
169
|
+
|
170
|
+
options[:real_size] = size
|
171
|
+
@max_size = size if size > @max_size
|
172
|
+
options[:size] = screen.min_blob_size + ((size / @max_size) * (screen.max_blob_size - screen.min_blob_size))
|
173
|
+
end
|
174
|
+
|
172
175
|
block.add_activity({
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
176
|
+
:name => source.name,
|
177
|
+
:color => source.color,
|
178
|
+
:size => screen.min_blob_size
|
179
|
+
}.update(options) )
|
177
180
|
end
|
178
181
|
end
|
179
182
|
|
data/lib/gl_tail/element.rb
CHANGED
@@ -40,7 +40,7 @@ class Element
|
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
|
-
def add_activity(message, color, size, type)
|
43
|
+
def add_activity(message, color, size, type, real_size)
|
44
44
|
@bar_color[0] = @bar_color[0] + (@color[0] - @bar_color[0]) / 5
|
45
45
|
@bar_color[1] = @bar_color[1] + (@color[1] - @bar_color[1]) / 5
|
46
46
|
@bar_color[2] = @bar_color[2] + (@color[2] - @bar_color[2]) / 5
|
@@ -48,7 +48,7 @@ class Element
|
|
48
48
|
@pending.push Item.new(message, size, color, type) if(type != 3)
|
49
49
|
@messages += 1
|
50
50
|
@total += 1
|
51
|
-
@sum +=
|
51
|
+
@sum += real_size
|
52
52
|
@color = color
|
53
53
|
|
54
54
|
if @rate == 0
|
@@ -76,7 +76,7 @@ class Element
|
|
76
76
|
@messages = 0
|
77
77
|
size = @pending.size
|
78
78
|
if size > 0
|
79
|
-
@average = @sum / @total
|
79
|
+
@average = @sum / @total.to_f
|
80
80
|
|
81
81
|
@step = 1.0 / size * 1000.0
|
82
82
|
@queue = @pending
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gltail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ""
|
6
6
|
authors:
|
7
7
|
- Erlend Simonsen
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
/UfNqVgtDGy57Xw9DBNRbUm92FVILwpudQs3SX1z2Gik08RrKReELwpRciY=
|
30
30
|
-----END CERTIFICATE-----
|
31
31
|
|
32
|
-
date: 2008-02-
|
32
|
+
date: 2008-02-17 00:00:00 +01:00
|
33
33
|
default_executable:
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|