stackprof-webnav 1.0.2 → 1.0.4
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +3 -1
- data/Gemfile.lock +19 -15
- data/lib/stackprof-webnav/public/css/application.css +6 -0
- data/lib/stackprof-webnav/public/lib/string_score.js +78 -0
- data/lib/stackprof-webnav/public/overview.js +29 -0
- data/lib/stackprof-webnav/server.rb +0 -1
- data/lib/stackprof-webnav/version.rb +1 -1
- data/lib/stackprof-webnav/views/overview.haml +8 -2
- data/stackprof-webnav.gemspec +5 -3
- metadata +65 -12
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 536091a961ef13d723a47f7b9a6abb0ca702bb5f92dd55434a8fee240e019250
|
|
4
|
+
data.tar.gz: 884079b5c901aa908731b337079dcbdcf963ab8a57def3a748cf49e31a4db6ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a469776477c3960b6c995a6290d41d8d07bda5e4b76cb9a77687d8e5c0b6ef60ab3ecf2fe0346cbbdd8dddea42ed37f1597c927040b062b5f0dc55f3544d33d
|
|
7
|
+
data.tar.gz: 618609350477be8f74d1313b0ea102a731603c8b4fc2bf2e0f7e878f1befcdedb82c8c0b4eb936b1895eedab20fb34251dec099759c4e2aa3197cdda0d367c33
|
data/.github/workflows/ruby.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
stackprof-webnav (1.0.
|
|
4
|
+
stackprof-webnav (1.0.3)
|
|
5
5
|
better_errors (~> 1.1.0)
|
|
6
6
|
haml (~> 5.1.2)
|
|
7
|
+
rackup (>= 1.0.0, < 3.0.0)
|
|
7
8
|
ruby-graphviz (~> 1.2.4)
|
|
8
|
-
sinatra (
|
|
9
|
-
sinatra-contrib (
|
|
9
|
+
sinatra (>= 2.1.0, < 5.0.0)
|
|
10
|
+
sinatra-contrib (>= 2.1.0, < 5.0.0)
|
|
10
11
|
stackprof (>= 0.2.13)
|
|
12
|
+
webrick (~> 1.7)
|
|
11
13
|
|
|
12
14
|
GEM
|
|
13
15
|
remote: https://rubygems.org/
|
|
14
16
|
specs:
|
|
15
|
-
backports (3.21.0)
|
|
16
17
|
better_errors (1.1.0)
|
|
17
18
|
coderay (>= 1.0.0)
|
|
18
19
|
erubis (>= 2.6.6)
|
|
@@ -29,11 +30,14 @@ GEM
|
|
|
29
30
|
pry (0.12.2)
|
|
30
31
|
coderay (~> 1.1.0)
|
|
31
32
|
method_source (~> 0.9.0)
|
|
32
|
-
rack (2.
|
|
33
|
-
rack-protection (2.0
|
|
33
|
+
rack (2.2.3)
|
|
34
|
+
rack-protection (2.1.0)
|
|
34
35
|
rack
|
|
35
36
|
rack-test (1.1.0)
|
|
36
37
|
rack (>= 1.0, < 3)
|
|
38
|
+
rackup (1.0.0)
|
|
39
|
+
rack (< 3)
|
|
40
|
+
webrick
|
|
37
41
|
rake (10.5.0)
|
|
38
42
|
rexml (3.2.5)
|
|
39
43
|
rspec (3.9.0)
|
|
@@ -51,22 +55,22 @@ GEM
|
|
|
51
55
|
rspec-support (3.9.0)
|
|
52
56
|
ruby-graphviz (1.2.5)
|
|
53
57
|
rexml
|
|
54
|
-
ruby2_keywords (0.0.
|
|
55
|
-
sinatra (2.0
|
|
58
|
+
ruby2_keywords (0.0.5)
|
|
59
|
+
sinatra (2.1.0)
|
|
56
60
|
mustermann (~> 1.0)
|
|
57
|
-
rack (~> 2.
|
|
58
|
-
rack-protection (= 2.0
|
|
61
|
+
rack (~> 2.2)
|
|
62
|
+
rack-protection (= 2.1.0)
|
|
59
63
|
tilt (~> 2.0)
|
|
60
|
-
sinatra-contrib (2.0
|
|
61
|
-
backports (>= 2.8.2)
|
|
64
|
+
sinatra-contrib (2.1.0)
|
|
62
65
|
multi_json
|
|
63
66
|
mustermann (~> 1.0)
|
|
64
|
-
rack-protection (= 2.0
|
|
65
|
-
sinatra (= 2.0
|
|
67
|
+
rack-protection (= 2.1.0)
|
|
68
|
+
sinatra (= 2.1.0)
|
|
66
69
|
tilt (~> 2.0)
|
|
67
70
|
stackprof (0.2.17)
|
|
68
71
|
temple (0.8.2)
|
|
69
72
|
tilt (2.0.10)
|
|
73
|
+
webrick (1.7.0)
|
|
70
74
|
|
|
71
75
|
PLATFORMS
|
|
72
76
|
ruby
|
|
@@ -74,7 +78,7 @@ PLATFORMS
|
|
|
74
78
|
DEPENDENCIES
|
|
75
79
|
bundler (~> 2.2)
|
|
76
80
|
pry
|
|
77
|
-
rack-test (
|
|
81
|
+
rack-test (>= 1.1.0, < 3.0.0)
|
|
78
82
|
rake (~> 10.1)
|
|
79
83
|
rspec (~> 3.9.0)
|
|
80
84
|
stackprof-webnav!
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* string_score.js: Quicksilver-like string scoring algorithm.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2009-2011 Joshaven Potter <yourtech@gmail.com>
|
|
5
|
+
* Copyright (C) 2010-2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
|
|
6
|
+
* MIT license: http://www.opensource.org/licenses/mit-license.php
|
|
7
|
+
*
|
|
8
|
+
* This is a javascript port of the above mentionned, with a tiny change:
|
|
9
|
+
* it avoids string monkey patch.
|
|
10
|
+
*/
|
|
11
|
+
;(function(global) {
|
|
12
|
+
global.stringScore = (string, abbreviation) => {
|
|
13
|
+
// Perfect match if the spring equals the abbreviation
|
|
14
|
+
if (string == abbreviation) return 1.0
|
|
15
|
+
|
|
16
|
+
// Initializing variables.
|
|
17
|
+
let string_length = string.length
|
|
18
|
+
let abbreviation_length = abbreviation.length
|
|
19
|
+
let total_character_score = 0
|
|
20
|
+
|
|
21
|
+
// Awarded only if the string and the abbreviation have a common prefix.
|
|
22
|
+
let should_award_common_prefix_bonus = 0
|
|
23
|
+
|
|
24
|
+
// # Sum character scores
|
|
25
|
+
|
|
26
|
+
// Add up scores for each character in the abbreviation.
|
|
27
|
+
for (let i = 0, c = abbreviation[i]; i < abbreviation_length; c = abbreviation[++i]) {
|
|
28
|
+
// Find the index of current character (case-insensitive) in remaining part of string.
|
|
29
|
+
let index_c_lowercase = string.indexOf(c.toLowerCase())
|
|
30
|
+
let index_c_uppercase = string.indexOf(c.toUpperCase())
|
|
31
|
+
let min_index = Math.min(index_c_lowercase, index_c_uppercase)
|
|
32
|
+
let index_in_string = min_index > -1 ? min_index : Math.max(index_c_lowercase, index_c_uppercase)
|
|
33
|
+
|
|
34
|
+
// # Identical Strings
|
|
35
|
+
// Bail out if current character is not found (case-insensitive) in remaining part of string.
|
|
36
|
+
if (index_in_string == -1) return 0
|
|
37
|
+
|
|
38
|
+
// Set base score for current character.
|
|
39
|
+
let character_score = 0.1
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// # Case-match bonus
|
|
43
|
+
// If the current abbreviation character has the same case
|
|
44
|
+
// as that of the character in the string, we add a bonus.
|
|
45
|
+
if (string[index_in_string] == c) character_score += 0.1
|
|
46
|
+
|
|
47
|
+
// # Consecutive character match and common prefix bonuses
|
|
48
|
+
// Increase the score when each consecutive character of
|
|
49
|
+
// the abbreviation matches the first character of the
|
|
50
|
+
// remaining string.
|
|
51
|
+
if (index_in_string == 0) {
|
|
52
|
+
character_score += 0.8
|
|
53
|
+
// String and abbreviation have common prefix, so award bonus.
|
|
54
|
+
if (i == 0) should_award_common_prefix_bonus = 1
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// # Acronym bonus
|
|
58
|
+
// Typing the first character of an acronym is as
|
|
59
|
+
// though you preceded it with two perfect character
|
|
60
|
+
// matches.
|
|
61
|
+
if (string.charAt(index_in_string - 1) == ' ') // TODO: better accro
|
|
62
|
+
character_score += 0.8 // * Math.min(index_in_string, 5) # Cap bonus at 0.4 * 5
|
|
63
|
+
|
|
64
|
+
// Left trim the matched part of the string
|
|
65
|
+
// (forces sequential matching).
|
|
66
|
+
string = string.substring(index_in_string + 1, string_length)
|
|
67
|
+
|
|
68
|
+
// Add to total character score.
|
|
69
|
+
total_character_score += character_score
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let abbreviation_score = total_character_score / abbreviation_length
|
|
73
|
+
|
|
74
|
+
let final_score = ((abbreviation_score * (abbreviation_length / string_length)) + abbreviation_score) / 2
|
|
75
|
+
if (should_award_common_prefix_bonus && final_score + 0.1 < 1) final_score += 0.1
|
|
76
|
+
return final_score
|
|
77
|
+
}
|
|
78
|
+
})(window)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
;(function() {
|
|
2
|
+
const table = document.getElementsByTagName('table')[0]
|
|
3
|
+
const input = document.getElementsByClassName('filter')[0]
|
|
4
|
+
const rows = {}
|
|
5
|
+
const filterKeys = Array.from(document.querySelectorAll('tr[data-filter-key]')).map(el => {
|
|
6
|
+
key = el.dataset.filterKey
|
|
7
|
+
rows[key] = el
|
|
8
|
+
return key
|
|
9
|
+
})
|
|
10
|
+
const scores = {}
|
|
11
|
+
const computeScores = () => {
|
|
12
|
+
const searchString = input.value
|
|
13
|
+
filterKeys.forEach(filterKey => scores[filterKey] = stringScore(filterKey, searchString))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const redrawTable = (sorted) => {
|
|
17
|
+
const newBody = document.createElement('tbody')
|
|
18
|
+
sorted.forEach(key => newBody.appendChild(rows[key]))
|
|
19
|
+
table.removeChild(table.getElementsByTagName('tbody')[0])
|
|
20
|
+
table.appendChild(newBody)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input.addEventListener('input', () => {
|
|
24
|
+
computeScores()
|
|
25
|
+
redrawTable(
|
|
26
|
+
filterKeys.filter(k => scores[k] !== 0).sort((a, b) => scores[b] - scores[a])
|
|
27
|
+
)
|
|
28
|
+
})
|
|
29
|
+
})()
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
%th %
|
|
26
26
|
%th Samples
|
|
27
27
|
%th %
|
|
28
|
-
%th
|
|
28
|
+
%th
|
|
29
|
+
Method
|
|
30
|
+
%input.filter{:placeholder => "filter methods", :type => "text"}/
|
|
29
31
|
|
|
30
32
|
%tbody
|
|
31
33
|
- @frames.each do |frame|
|
|
32
|
-
|
|
34
|
+
- # Filter keys are preprocessed to better match acronyms.
|
|
35
|
+
%tr{"data-filter-key" => frame[:method].gsub(/[A-Z]/, " \\0").gsub(/[\W_]+/, " ").strip}
|
|
33
36
|
%td= frame[:total]
|
|
34
37
|
%td= frame[:total_pct]
|
|
35
38
|
%td= frame[:samples]
|
|
@@ -37,3 +40,6 @@
|
|
|
37
40
|
%td
|
|
38
41
|
%a{:href => url_for("/method", name: frame[:method])}
|
|
39
42
|
&= frame[:method]
|
|
43
|
+
|
|
44
|
+
%script{src: "lib/string_score.js"}
|
|
45
|
+
%script{src: "overview.js"}
|
data/stackprof-webnav.gemspec
CHANGED
|
@@ -21,14 +21,16 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.bindir = 'bin'
|
|
22
22
|
spec.executables << 'stackprof-webnav'
|
|
23
23
|
|
|
24
|
-
spec.add_dependency "sinatra", "
|
|
24
|
+
spec.add_dependency "sinatra", ">= 2.1.0", "< 5.0.0"
|
|
25
25
|
spec.add_dependency "haml", "~> 5.1.2"
|
|
26
26
|
spec.add_dependency "stackprof", ">= 0.2.13"
|
|
27
27
|
spec.add_dependency "better_errors", "~> 1.1.0"
|
|
28
|
+
spec.add_dependency "rackup", ">= 1.0.0", "< 3.0.0"
|
|
28
29
|
spec.add_dependency "ruby-graphviz", "~> 1.2.4"
|
|
29
|
-
spec.add_dependency "sinatra-contrib", "
|
|
30
|
+
spec.add_dependency "sinatra-contrib", ">= 2.1.0", "< 5.0.0"
|
|
31
|
+
spec.add_dependency "webrick", "~> 1.7"
|
|
30
32
|
spec.add_development_dependency "bundler", "~> 2.2"
|
|
31
33
|
spec.add_development_dependency "rake", "~> 10.1"
|
|
32
34
|
spec.add_development_dependency "rspec", "~> 3.9.0"
|
|
33
|
-
spec.add_development_dependency "rack-test", "
|
|
35
|
+
spec.add_development_dependency "rack-test", ">= 1.1.0", "< 3.0.0"
|
|
34
36
|
end
|
metadata
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stackprof-webnav
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Lisnic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sinatra
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.1.0
|
|
20
|
+
- - "<"
|
|
18
21
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
22
|
+
version: 5.0.0
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.0
|
|
29
|
+
version: 2.1.0
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 5.0.0
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: haml
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,6 +72,26 @@ dependencies:
|
|
|
66
72
|
- - "~>"
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
74
|
version: 1.1.0
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: rackup
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 1.0.0
|
|
82
|
+
- - "<"
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: 3.0.0
|
|
85
|
+
type: :runtime
|
|
86
|
+
prerelease: false
|
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 1.0.0
|
|
92
|
+
- - "<"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: 3.0.0
|
|
69
95
|
- !ruby/object:Gem::Dependency
|
|
70
96
|
name: ruby-graphviz
|
|
71
97
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,18 +108,38 @@ dependencies:
|
|
|
82
108
|
version: 1.2.4
|
|
83
109
|
- !ruby/object:Gem::Dependency
|
|
84
110
|
name: sinatra-contrib
|
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: 2.1.0
|
|
116
|
+
- - "<"
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: 5.0.0
|
|
119
|
+
type: :runtime
|
|
120
|
+
prerelease: false
|
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: 2.1.0
|
|
126
|
+
- - "<"
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: 5.0.0
|
|
129
|
+
- !ruby/object:Gem::Dependency
|
|
130
|
+
name: webrick
|
|
85
131
|
requirement: !ruby/object:Gem::Requirement
|
|
86
132
|
requirements:
|
|
87
133
|
- - "~>"
|
|
88
134
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
135
|
+
version: '1.7'
|
|
90
136
|
type: :runtime
|
|
91
137
|
prerelease: false
|
|
92
138
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
139
|
requirements:
|
|
94
140
|
- - "~>"
|
|
95
141
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
142
|
+
version: '1.7'
|
|
97
143
|
- !ruby/object:Gem::Dependency
|
|
98
144
|
name: bundler
|
|
99
145
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,16 +186,22 @@ dependencies:
|
|
|
140
186
|
name: rack-test
|
|
141
187
|
requirement: !ruby/object:Gem::Requirement
|
|
142
188
|
requirements:
|
|
143
|
-
- - "
|
|
189
|
+
- - ">="
|
|
144
190
|
- !ruby/object:Gem::Version
|
|
145
191
|
version: 1.1.0
|
|
192
|
+
- - "<"
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: 3.0.0
|
|
146
195
|
type: :development
|
|
147
196
|
prerelease: false
|
|
148
197
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
198
|
requirements:
|
|
150
|
-
- - "
|
|
199
|
+
- - ">="
|
|
151
200
|
- !ruby/object:Gem::Version
|
|
152
201
|
version: 1.1.0
|
|
202
|
+
- - "<"
|
|
203
|
+
- !ruby/object:Gem::Version
|
|
204
|
+
version: 3.0.0
|
|
153
205
|
description: Provides the ability to analyze StackProf dumps
|
|
154
206
|
email:
|
|
155
207
|
- andrei.lisnic@gmail.com
|
|
@@ -160,7 +212,6 @@ extra_rdoc_files: []
|
|
|
160
212
|
files:
|
|
161
213
|
- ".github/workflows/ruby.yml"
|
|
162
214
|
- ".gitignore"
|
|
163
|
-
- ".travis.yml"
|
|
164
215
|
- Gemfile
|
|
165
216
|
- Gemfile.lock
|
|
166
217
|
- LICENSE.txt
|
|
@@ -176,6 +227,8 @@ files:
|
|
|
176
227
|
- lib/stackprof-webnav/public/css/foundation.min.css
|
|
177
228
|
- lib/stackprof-webnav/public/css/normalize.css
|
|
178
229
|
- lib/stackprof-webnav/public/flamegraph.js
|
|
230
|
+
- lib/stackprof-webnav/public/lib/string_score.js
|
|
231
|
+
- lib/stackprof-webnav/public/overview.js
|
|
179
232
|
- lib/stackprof-webnav/server.rb
|
|
180
233
|
- lib/stackprof-webnav/version.rb
|
|
181
234
|
- lib/stackprof-webnav/views/error.haml
|
|
@@ -218,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
218
271
|
- !ruby/object:Gem::Version
|
|
219
272
|
version: '0'
|
|
220
273
|
requirements: []
|
|
221
|
-
rubygems_version: 3.
|
|
274
|
+
rubygems_version: 3.3.7
|
|
222
275
|
signing_key:
|
|
223
276
|
specification_version: 4
|
|
224
277
|
summary: View stackprof dumps in a web UI
|
data/.travis.yml
DELETED