stackprof-run 0.2.0 → 0.3.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: 6473d2d034efcd895c6b90c17272b4eb9b8dbc36
4
- data.tar.gz: 1aeb56de31d85efc78f34d95527c977381acc74d
3
+ metadata.gz: 2c1842303afdf634f199e95a98780d6ca35839c3
4
+ data.tar.gz: a2ed797d123ad3aa575a74c6894f31d2fb505ada
5
5
  SHA512:
6
- metadata.gz: e53d77fa8b32725d0dec292e77d872eee206f64f247dc35861e17e6249d4d6b017fcc7a951d4f1d3396c384a81d43f43b2f114298ad18c7f6e999527044092ed
7
- data.tar.gz: 900bcd68d671cffa21a2dc810e4e5e334d98168bf57f609ef02e90d4f732d3db6d21d5faca4fd498d09f6bebffb37d98b2dfb2269a261e35ce5b53af6488d9a2
6
+ metadata.gz: a4e707b5b17158becbd13aec31cd47e35ee8e793b1d982ac9029d300d189c87e296a59d90422e826d13cd8c33afb5a8f940c5a7380c88ddbb5ef3c21ce44a3fb
7
+ data.tar.gz: 4accf086e95249cdcc044de4cf3b0d9510aeedbc92cc91c97854610437ebf04ca37ddffa104dbfebfcc99617a62db287921987d7684e9c3a51b02669495d7cfe
data/README.md CHANGED
@@ -20,24 +20,16 @@ $ stackprof-run rubocop some_ruby_file.rb
20
20
  $ stackprof-run bin/rake some_task
21
21
  ```
22
22
 
23
- ## Advanced Usage
24
-
25
- ### Specify output filename
26
-
27
- `stackprof-run` puts result to `./stackprof-out` in default. You can specify the filename by an environment variable.
28
-
29
- ```sh
30
- $ STACKPROF_OUT=stackprof_result stackprof-run some_ruby_command
31
- $ file stackprof_result
32
- stackprof_result: data
33
- ```
34
-
35
- ### Specify stackprof mode
36
-
37
- `stackprof-run` executes stackprof with `cpu` mode in default. You can specify the mode by an environment variable.
38
-
39
- ```sh
40
- $ STACKPROF_MODE=wall stackprof-run some_ruby_command
23
+ ### Options
24
+
25
+ ```bash
26
+ $ stackprof-run --help
27
+ Usage: stackprof-run [options] command [command options]
28
+ -m, --mode=MODE :cpu(default), :wall, :object
29
+ -o, --out=FILE Output file name. (default: stackprof-out)
30
+ -i, --interval=INTERVAL
31
+ -no-aggregate
32
+ -r, --raw
41
33
  ```
42
34
 
43
35
 
data/exe/stackprof-run CHANGED
@@ -1,17 +1,37 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'optparse'
4
+ require 'stackprof'
5
+
6
+ opt = OptionParser.new
7
+
8
+ mode = ENV['STACKPROF_MODE']&.to_sym || :cpu
9
+ out = ENV['STACKPROF_OUT'] || 'stackprof-out'
10
+ interval = nil
11
+ aggregate = true
12
+ raw = false
13
+
14
+ opt.banner = 'Usage: stackprof-run [options] command [command options]'
15
+ opt.on('-m MODE', '--mode=MODE', ':cpu(default), :wall, :object'){|v| mode = v.to_sym}
16
+ opt.on('-o FILE', '--out=FILE', 'Output file name. (default: stackprof-out)'){|v| out = v}
17
+ opt.on('-i INTERVAL', '--interval=INTERVAL'){|v| interval = v.to_i}
18
+ opt.on('-no-aggregate'){|v| aggregate = false}
19
+ opt.on('-r', '--raw'){|v| raw = true}
20
+
21
+ opt.order!(ARGV)
22
+
3
23
  cmd = ARGV.shift
24
+ unless cmd
25
+ puts opt.help
26
+ exit 1
27
+ end
4
28
 
5
29
  path = `which #{cmd}`.chomp
6
30
 
7
31
  $PROGRAM_NAME = cmd
8
32
 
9
- mode = ENV['STACKPROF_MODE']&.to_sym || :cpu
10
- out = ENV['STACKPROF_OUT'] || 'stackprof-out'
11
-
12
- require 'stackprof'
13
33
  ex = nil
14
- StackProf.run(mode: mode, out: out) do
34
+ StackProf.run(mode: mode, out: out, interval: interval, aggregate: aggregate, raw: raw) do
15
35
  begin
16
36
  load path
17
37
  rescue Exception => ex
@@ -1,5 +1,5 @@
1
1
  module Stackprof
2
2
  module Run
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Masataka Kuwabara"]
10
10
  spec.email = ["p.ck.t22@gmail.com"]
11
11
 
12
- spec.summary = %q{}
13
- spec.description = %q{}
12
+ spec.summary = %q{Run a ruby script with stackprof.}
13
+ spec.description = %q{Run a ruby script with stackprof.}
14
14
  spec.homepage = "https://github.com/pocke/stackprof-run"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackprof-run
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-03 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stackprof
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
- description: ''
55
+ description: Run a ruby script with stackprof.
56
56
  email:
57
57
  - p.ck.t22@gmail.com
58
58
  executables:
@@ -91,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.5.2
94
+ rubygems_version: 2.6.10
95
95
  signing_key:
96
96
  specification_version: 4
97
- summary: ''
97
+ summary: Run a ruby script with stackprof.
98
98
  test_files: []