jvm_gclog 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a225ab0bbc55907e850abfd4c52e903992ed1f0b
4
+ data.tar.gz: b19aeb4f3a2b77a84a143b5f703d27e6518d2b03
5
+ SHA512:
6
+ metadata.gz: b376af94fb9e696f664818aeaf71145304139119970256a9471b501c6bfc563f8c175907297329cf10692a995cf8776a9671fffbd4f0e2c6695943061544fd17
7
+ data.tar.gz: e16e4365df937b6ae76735280f59a8da94beebe171207f1010b7af64f27b2247d4f2a2de7f9def2380cf308e5fde16ca5e617256174efd2120fd9c257f40aecc
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ # Gemfile.lock
31
+ # .ruby-version
32
+ # .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.1.3
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # jvm_gclog [![Build Status](https://travis-ci.org/stanaka/jvm_gclog.svg?branch=master)](https://travis-ci.org/stanaka/jvm_gclog)
2
+ A ruby parser for gc.log of JavaVM
3
+
4
+ ## Usage
5
+
6
+ ```ruby
7
+ line = "2014-08-19T14:44:08.807+0900: 513893.067: [Full GC [PSYoungGen: 43826K->0K(632832K)] [ParOldGen: 1375468K->149900K(1398272K)] 1419294K->149900K(2031104K) [PSPermGen: 95192K->95192K(95232K)], 0.6923610 secs] [Times: user=5.42 sys=0.00, real=0.69 secs] "
8
+ jvmgclog = JVMGCLog.new
9
+ record = JVMGCLog.parse(line)
10
+ ```
11
+
12
+ ```ruby
13
+ record = {
14
+ "time" => 1408427048,
15
+ "type" => "FullGC",
16
+ "uptime" => 513893.067,
17
+ "gctime" => 0.6923610,
18
+ "gctime_user" => 5.42,
19
+ "gctime_sys"=> 0.00,
20
+ "gctime_real" => 0.69,
21
+ }
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new("spec")
6
+ task :default => :spec
data/jvm_gclog.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- coding:utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["stanaka"]
5
+ gem.email = ["shinji.tanaka@gmail.com"]
6
+ gem.description = %q{JavaVM gc.log parser.}
7
+ gem.summary = %q{JavaVM gc.log parser.}
8
+ gem.homepage = "https://github.com/stanaka/jvm_gclog"
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "jvm_gclog"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = "0.0.1"
16
+ gem.add_development_dependency "rspec"
17
+ gem.add_development_dependency "rake"
18
+ end
19
+
data/lib/jvm_gclog.rb ADDED
@@ -0,0 +1,59 @@
1
+ require 'time'
2
+
3
+ class JVMGCLog
4
+ def adjust_type(value)
5
+ if value =~ /^\d+\.\d+$/
6
+ return value.to_f
7
+ else
8
+ return value.to_i
9
+ end
10
+ end
11
+
12
+ def parse(line)
13
+ record = Hash.new
14
+ m = line.match(/^(?<time>[^ ]+): (?<uptime>[\d\.]+): (?<body>.+)$/)
15
+ record["time"] = Time.parse(m[:time]).to_i
16
+ record["uptime"] = adjust_type(m["uptime"])
17
+
18
+ post_times = m[:body].match(/ \[Times: user=(?<gctime_user>[\d\.]+) sys=(?<gctime_sys>[\d\.]+), real=(?<gctime_real>[\d\.]+) secs\] *$/)
19
+ if post_times
20
+ post_times.names.each {|name|
21
+ record[name] = adjust_type(post_times[name])
22
+ }
23
+ end
24
+ body = $` || m[:body]
25
+
26
+ case body
27
+ when /^\[GC.+ParNew: (?<new_before>\d+)K-\>(?<new_after>\d+)K\((?<new_total>\d+)K\), (?<new_gctime>[\d\.]+) secs\] (?<heap_before>\d+)K\-\>(?<heap_after>\d+)K\((?<heap_total>\d+)K\)( icms_dc=(?<icms_dc>\d+) )?, (?<gctime>[\d\.]+) secs\]/
28
+ m = Regexp.last_match
29
+ record["type"] = "YoungGC"
30
+ when /^\[GC \[1 CMS-initial-mark: (?<old_before>\d+)K\((?<old_threshold>\d+)K\)\] (?<heap_before>\d+)K\((?<heap_total>\d+)K\), (?<gctime>[\d\.]+) secs\]/
31
+ m = Regexp.last_match
32
+ record["type"] = "CMS-initial-mark"
33
+ when /^\[GC\[YG occupancy: (?<new_before>\d+) K \((?<new_threshold>\d+) K\)\].+\[1 CMS-remark: (?<old_before>\d+)K\((?<old_threshold>\d+)K\)\] (?<heap_before>\d+)K\((?<heap_total>\d+)K\), (?<gctime>[\d\.]+) secs\]/
34
+ m = Regexp.last_match
35
+ record["type"] = "CMS-parallel-remark"
36
+ when /\[Full GC.+\(concurrent mode failure\).+ (?<gctime>[\d\.]+) secs\]/
37
+ m = Regexp.last_match
38
+ record["type"] = "FullGC-CMS-failure"
39
+ when /\[Full GC.+ (?<gctime>[\d\.]+) secs\]/
40
+ m = Regexp.last_match
41
+ record["type"] = "FullGC"
42
+ when /^\[(?<type>[A-Za-z\-]+)(: (?<time_cpu>[\d\.]+)\/(?<time_wall>[\d\.]+) secs)?\]/
43
+ m = Regexp.last_match
44
+ end
45
+
46
+ if m == nil
47
+ record["unknown"] = body
48
+ else
49
+ m.names.each {|name|
50
+ if name == "type"
51
+ record[name] = m[name]
52
+ elsif m[name]
53
+ record[name] = adjust_type(m[name])
54
+ end
55
+ }
56
+ end
57
+ return record
58
+ end
59
+ end
@@ -0,0 +1,160 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require "spec_helper"
4
+
5
+ describe "JVMGCLog" do
6
+ before :each do
7
+ @jvmgclog = JVMGCLog.new
8
+ end
9
+
10
+ describe "#parse" do
11
+ context "given log" do
12
+ describe "YoungGC" do
13
+ before :each do
14
+ @line = "2015-06-05T13:15:32.483+0900: 48.974: [GC2015-06-05T13:15:32.483+0900: 48.974: [ParNew: 886367K->1031K(996800K), 0.0096570 secs] 896432K->11133K(4083584K) icms_dc=0 , 0.0098390 secs] [Times: user=0.10 sys=0.00, real=0.01 secs] "
15
+ @r = @jvmgclog.parse(@line)
16
+ end
17
+
18
+ it "should have expected values" do
19
+ expect(@r["time"]).to eq 1433477732
20
+ expect(@r["type"]).to eq "YoungGC"
21
+ expect(@r["uptime"]).to eq 48.974
22
+ expect(@r["new_before"]).to eq 886367
23
+ expect(@r["new_after"]).to eq 1031
24
+ expect(@r["new_total"]).to eq 996800
25
+ expect(@r["new_gctime"]).to eq 0.009657
26
+ expect(@r["heap_before"]).to eq 896432
27
+ expect(@r["heap_after"]).to eq 11133
28
+ expect(@r["heap_total"]).to eq 4083584
29
+ expect(@r["icms_dc"]).to eq 0
30
+ expect(@r["gctime_user"]).to eq 0.1
31
+ expect(@r["gctime_sys"]).to eq 0.00
32
+ expect(@r["gctime_real"]).to eq 0.01
33
+ end
34
+ end
35
+
36
+ describe "CMS-initial-mark" do
37
+ before :each do
38
+ @line = "2015-06-05T13:15:27.747+0900: 44.239: [GC [1 CMS-initial-mark: 0K(3086784K)] 445450K(4083584K), 0.0298540 secs] [Times: user=0.04 sys=0.00, real=0.04 secs] "
39
+ @r = @jvmgclog.parse(@line)
40
+ end
41
+
42
+ it "should have expected values" do
43
+ expect(@r["time"]).to eq 1433477727
44
+ expect(@r["type"]).to eq "CMS-initial-mark"
45
+ expect(@r["uptime"]).to eq 44.239
46
+ expect(@r["old_before"]).to eq 0
47
+ expect(@r["old_threshold"]).to eq 3086784
48
+ expect(@r["heap_before"]).to eq 445450
49
+ expect(@r["heap_total"]).to eq 4083584
50
+ expect(@r["gctime_user"]).to eq 0.04
51
+ expect(@r["gctime_sys"]).to eq 0.00
52
+ expect(@r["gctime_real"]).to eq 0.04
53
+ end
54
+ end
55
+
56
+ describe "CMS-parallel-remark" do
57
+ before :each do
58
+ @line = "2015-06-05T13:15:29.600+0900: 46.091: [GC[YG occupancy: 454149 K (996800 K)]2015-06-05T13:15:29.600+0900: 46.091: [Rescan (parallel) , 0.0082970 secs]2015-06-05T13:15:29.608+0900: 46.099: [weak refs processing, 0.0000930 secs]2015-06-05T13:15:29.608+0900: 46.099: [scrub string table, 0.0007250 secs] [1 CMS-remark: 0K(3086784K)] 454149K(4083584K), 0.0094230 secs] [Times: user=0.09 sys=0.00, real=0.01 secs] "
59
+ @r = @jvmgclog.parse(@line)
60
+ end
61
+
62
+ it "should have expected values" do
63
+ expect(@r["time"]).to eq 1433477729
64
+ expect(@r["type"]).to eq "CMS-parallel-remark"
65
+ expect(@r["uptime"]).to eq 46.091
66
+ expect(@r["new_before"]).to eq 454149
67
+ expect(@r["new_threshold"]).to eq 996800
68
+ expect(@r["old_before"]).to eq 0
69
+ expect(@r["old_threshold"]).to eq 3086784
70
+ expect(@r["heap_before"]).to eq 454149
71
+ expect(@r["heap_total"]).to eq 4083584
72
+ expect(@r["gctime_user"]).to eq 0.09
73
+ expect(@r["gctime_sys"]).to eq 0.00
74
+ expect(@r["gctime_real"]).to eq 0.01
75
+ end
76
+ end
77
+
78
+ describe "FullGC-CMS-failure" do
79
+ before :each do
80
+ @line = "2015-05-20T12:24:11.125+0900: 224.659: [Full GC2015-05-20T12:24:11.126+0900: 224.659: [CMS2016-05-20T12:24:11.126+0900: 224.659: [CMS-concurrent-mark: 1.832/1.836 secs] [Times: user=1.51 sys=0.27, real=1.74 secs] (concurrent mode failure): 39203K->39203K(39204K), 1.8507640 secs] 15775K->58321K(315776K), [CMS Perm : 7066K->7066K(65544K)], 1.8509456 secs]"
81
+ @r = @jvmgclog.parse(@line)
82
+ end
83
+
84
+ it "should have expected values" do
85
+ expect(@r["time"]).to eq 1432092251
86
+ expect(@r["type"]).to eq "FullGC-CMS-failure"
87
+ expect(@r["uptime"]).to eq 224.659
88
+ expect(@r["gctime"]).to eq 1.8509456
89
+ end
90
+ end
91
+
92
+ describe "FullGC" do
93
+ before :each do
94
+ @line = "2014-08-19T14:44:08.807+0900: 513893.067: [Full GC [PSYoungGen: 43826K->0K(632832K)] [ParOldGen: 1375468K->149900K(1398272K)] 1419294K->149900K(2031104K) [PSPermGen: 95192K->95192K(95232K)], 0.6923610 secs] [Times: user=5.42 sys=0.00, real=0.69 secs] "
95
+ @r = @jvmgclog.parse(@line)
96
+ end
97
+
98
+ it "should have expected values" do
99
+ expect(@r["time"]).to eq 1408427048
100
+ expect(@r["type"]).to eq "FullGC"
101
+ expect(@r["uptime"]).to eq 513893.067
102
+ expect(@r["gctime"]).to eq 0.6923610
103
+ expect(@r["gctime_user"]).to eq 5.42
104
+ expect(@r["gctime_sys"]).to eq 0.00
105
+ expect(@r["gctime_real"]).to eq 0.69
106
+ end
107
+ end
108
+
109
+ describe "CMS-concurrent-mark-start" do
110
+ before :each do
111
+ @line = "2015-06-05T13:15:27.778+0900: 44.269: [CMS-concurrent-mark-start]"
112
+ @r = @jvmgclog.parse(@line)
113
+ end
114
+
115
+ it "should have expected values" do
116
+ expect(@r["time"]).to eq 1433477727
117
+ expect(@r["type"]).to eq "CMS-concurrent-mark-start"
118
+ expect(@r["uptime"]).to eq 44.269
119
+ end
120
+ end
121
+
122
+ describe "CMS-concurrent-mark" do
123
+ before :each do
124
+ @line = "2015-06-05T13:15:27.815+0900: 44.307: [CMS-concurrent-mark: 0.033/0.038 secs] [Times: user=0.08 sys=0.00, real=0.03 secs] "
125
+ @r = @jvmgclog.parse(@line)
126
+ end
127
+
128
+ it "should have expected values" do
129
+ expect(@r["time"]).to eq 1433477727
130
+ expect(@r["type"]).to eq "CMS-concurrent-mark"
131
+ expect(@r["uptime"]).to eq 44.307
132
+ expect(@r["time_cpu"]).to eq 0.033
133
+ expect(@r["time_wall"]).to eq 0.038
134
+ expect(@r["gctime_user"]).to eq 0.08
135
+ expect(@r["gctime_sys"]).to eq 0.00
136
+ expect(@r["gctime_real"]).to eq 0.03
137
+ end
138
+ end
139
+
140
+ describe "CMS-concurrent-preclean" do
141
+ before :each do
142
+ @line = "2015-06-05T13:15:27.835+0900: 44.326: [CMS-concurrent-preclean: 0.018/0.019 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] "
143
+ @r = @jvmgclog.parse(@line)
144
+ end
145
+
146
+ it "should have expected values" do
147
+ expect(@r["time"]).to eq 1433477727
148
+ expect(@r["type"]).to eq "CMS-concurrent-preclean"
149
+ expect(@r["uptime"]).to eq 44.326
150
+ expect(@r["time_cpu"]).to eq 0.018
151
+ expect(@r["time_wall"]).to eq 0.019
152
+ expect(@r["gctime_user"]).to eq 0.03
153
+ expect(@r["gctime_sys"]).to eq 0.00
154
+ expect(@r["gctime_real"]).to eq 0.02
155
+ end
156
+ end
157
+
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift File.expand_path("../", __FILE__)
2
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3
+
4
+ require "jvm_gclog"
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jvm_gclog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - stanaka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: JavaVM gc.log parser.
42
+ email:
43
+ - shinji.tanaka@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - jvm_gclog.gemspec
55
+ - lib/jvm_gclog.rb
56
+ - spec/jvm_gclog_spec.rb
57
+ - spec/spec_helper.rb
58
+ homepage: https://github.com/stanaka/jvm_gclog
59
+ licenses: []
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: JavaVM gc.log parser.
81
+ test_files:
82
+ - spec/jvm_gclog_spec.rb
83
+ - spec/spec_helper.rb