ruby-memory-usage-profiler 0.0.1 → 0.0.2

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: 475184e2462d265a1a8c54cb87b471d6f68cf01f
4
- data.tar.gz: 0a68277dd07cfdddccc01815df9ea812e3a0919c
3
+ metadata.gz: 5390adb52d3669790abd8abb7d340cc71491392a
4
+ data.tar.gz: 7aa86467294d964adbf18fb20c1f688a24231e6c
5
5
  SHA512:
6
- metadata.gz: 8fb74d9aca323224dd24cabda7d513d8138a711b0c7a4e7380dc0a7d2bcd3e357b10079093ec261caf7c65eedec23ac57c790963b96fd066c9f6015b69917cbc
7
- data.tar.gz: d61a513756a06d51aeb1fa4b22f6abe91a65756fb1330baf40486a06e3a01eab128793f1c34c36ce965ed4f46d3abbf767ca4fbab979aaf7ce9c65bf9d287dbe
6
+ metadata.gz: 1e8cf7fa38fe281378eaf9e8d964845fd20f3cccb3706924f19a371ae9bd0cf22aade1bb190dc8996e81c7cf185c43ddcbc5bb29862e9b98efc5359a747e9533
7
+ data.tar.gz: 56f7a141f507c575ff4e9284440394f101aefcdb3ae7f4a1434996723f9fee95f857efa11e06812e7b88aa36672e9c814f3aef46668a87280f5dadd51242b52a
data/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  Collect memory usage profiling informations from CRuby runtime and Linux pseudo filesystems.
4
4
 
5
- Originally written by @_ko1 on URL below.
6
- * http://www.atdot.net/sp/view/fd73um
5
+ Originally written by @_ko1.
7
6
 
8
7
  ## Installation
9
8
 
@@ -37,9 +36,11 @@ For stdout, specify '-'
37
36
 
38
37
  Kick `MemoryUsageProfiler#kick` with block how to process results each time you want.
39
38
 
39
+ labels = MemoryUsageProfiler.banner
40
40
  each_time_you_want do
41
41
  MemoryUsageProfiler.kick('my_program_label') do |result|
42
- send_to_anywhere_by_myself(result)
42
+ result_hash = Hash[ [labels, result].transpose ]
43
+ send_to_anywhere_by_myself(result_hash)
43
44
  end
44
45
  end
45
46
 
@@ -54,8 +54,12 @@ module MemoryUsageProfiler
54
54
  end
55
55
  end
56
56
 
57
+ def self.banner_items
58
+ MEMORY_PROFILE_BANNER
59
+ end
60
+
57
61
  def self.banner
58
- MEMORY_PROFILE_BANNER.join("\t")
62
+ banner_items.join("\t")
59
63
  end
60
64
 
61
65
  def self.kick(name, &callback)
@@ -63,7 +67,7 @@ module MemoryUsageProfiler
63
67
  MEMORY_PROFILE_PROCS.each{|pr|
64
68
  pr.call(result)
65
69
  }
66
- callback.call(result.join("\t"))
70
+ callback.call(result)
67
71
  end
68
72
 
69
73
  def self.start_thread(duration=MEMORY_PROFILE_DURATION, file=MEMORY_PROFILE_OUTPUT_PATH)
@@ -84,7 +88,7 @@ module MemoryUsageProfiler
84
88
  Thread.current.abort_on_exception = true
85
89
  while @@thread_running
86
90
  kick(Time.now.iso8601) { |result|
87
- file.puts result
91
+ file.puts result.join("\t")
88
92
  sleep duration
89
93
  }
90
94
  end
@@ -95,10 +99,3 @@ module MemoryUsageProfiler
95
99
  @@thread_running = false
96
100
  end
97
101
  end
98
- # if __FILE__ == $0
99
- # MemoryUsageProfiler.periodical_profile
100
- # 1_000_000_000.times{
101
- # ''
102
- # }
103
- # p :exit
104
- # end
@@ -1,3 +1,3 @@
1
1
  module MemoryUsageProfiler
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-memory-usage-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
@@ -48,7 +48,6 @@ extra_rdoc_files: []
48
48
  files:
49
49
  - .gitignore
50
50
  - Gemfile
51
- - LICENSE.txt
52
51
  - README.md
53
52
  - Rakefile
54
53
  - bin/run_ruby_memory_usage_profiler
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 TAGOMORI Satoshi
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.