lineprofiler 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/lib/lineprofiler.rb +21 -0
- data/lineprofiler.gemspec +12 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 07a795ec2c111f30cd143c5bafb99cc6c0d016f0
|
4
|
+
data.tar.gz: 92a150f239a799c306177d57f7a7fbd9808113ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4911bd7b92c411f11f095e84fa52f33e9dd4020053f62916c263575c23a4bd59fcd751d00ce70004bda8c110e4d0e1711cf8b8477175c3746346973b000d937
|
7
|
+
data.tar.gz: aa2a5ba60d4552119237200268b71bdfa0a0745e50f9f65e87b81598d76fd871fc01d1fe1db0a1a09d7890eaf26a83bcecf3f65a0e9bb4cf6f327983a69e2596
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Victor Maslov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/lib/lineprofiler.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
profile = []
|
2
|
+
Thread.new do
|
3
|
+
loop do
|
4
|
+
profile.push Thread.main.backtrace_locations.map{ |loc| [loc.absolute_path, loc.lineno] }
|
5
|
+
sleep 0.01
|
6
|
+
end
|
7
|
+
end
|
8
|
+
END {
|
9
|
+
require "io/console"
|
10
|
+
[$0, *ENV["LINEPROFILER"]].each do |filename|
|
11
|
+
puts filename
|
12
|
+
File.foreach(filename).with_index do |line, i|
|
13
|
+
v = profile.count do |bt|
|
14
|
+
bt.include? [File.expand_path(filename), i + 1]
|
15
|
+
end.fdiv(profile.size).round(4) * 100
|
16
|
+
puts "%-8s%s" % [("%5.2f%%" % v unless v.zero?).to_s, line[0, IO.console.winsize[1]-10]]
|
17
|
+
end
|
18
|
+
puts ""
|
19
|
+
end
|
20
|
+
puts ""
|
21
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lineprofiler"
|
3
|
+
spec.version = "0.0.0"
|
4
|
+
spec.summary = "very simple Ruby line profiler"
|
5
|
+
|
6
|
+
spec.author = "Victor Maslov aka Nakilon"
|
7
|
+
spec.email = "nakilon@gmail.com"
|
8
|
+
spec.license = "MIT"
|
9
|
+
spec.metadata = {"source_code_uri" => "https://github.com/nakilon/lineprofiler"}
|
10
|
+
|
11
|
+
spec.files = %w{ LICENSE lineprofiler.gemspec lib/lineprofiler.rb }
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lineprofiler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Maslov aka Nakilon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: nakilon@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE
|
20
|
+
- lib/lineprofiler.rb
|
21
|
+
- lineprofiler.gemspec
|
22
|
+
homepage:
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata:
|
26
|
+
source_code_uri: https://github.com/nakilon/lineprofiler
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.6.14.4
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: very simple Ruby line profiler
|
47
|
+
test_files: []
|