Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Go GC logging #196

Merged
merged 1 commit into from
Jul 26, 2018
Merged

Add support for Go GC logging #196

merged 1 commit into from
Jul 26, 2018

Conversation

rillig
Copy link
Contributor

@rillig rillig commented Feb 18, 2018

The Go programming language has a very dense GC logging format, which
is difficult to read for humans. It looks like this:

gc 1 @0.027s 35%: 15+3.3+0.41 ms clock, 46+0.66/2.3/3.0+1.2 ms cpu...
gc 2 @0.060s 28%: 3.6+7.6+0.37 ms clock, 10+0.33/0/6.5+1.1 ms cpu,...
gc 3 @0.079s 26%: 0.072+6.7+0.68 ms clock, 0.21+3.9/0.060/11+2.0 m...
gc 4 @0.104s 21%: 0.16+14+0.31 ms clock, 0.48+5.2/0.16/14+0.94 ms ...
gc 5 @0.140s 18%: 0.12+14+0.73 ms clock, 0.36+3.8/4.1/16+2.1 ms cp...
gc 6 @0.179s 17%: 0.20+15+0.48 ms clock, 0.62+5.1/10/19+1.4 ms cpu...
gc 7 @0.222s 16%: 0.12+19+0.21 ms clock, 0.37+11/0.064/19+0.64 ms ...
gc 8 @0.292s 15%: 0.10+13+0.34 ms clock, 0.32+10/11/13+1.0 ms cpu,...
gc 9 @0.936s 4%: 0.053+25+0.67 ms clock, 0.16+0.30/0.36/30+2.0 ms ...
gc 10 @1.123s 5%: 0.073+30+0.52 ms clock, 0.22+1.7/29/1.4+1.5 ms c...
gc 11 @1.369s 4%: 0.066+34+0.47 ms clock, 0.19+10/20/2.1+1.4 ms cp...

It fits well into the GCViewer model, although Go has nothing to do with
the JVM.

@codecov-io
Copy link

codecov-io commented Feb 18, 2018

Codecov Report

Merging #196 into develop will increase coverage by 0.02%.
The diff coverage is 74.28%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #196      +/-   ##
=============================================
+ Coverage      67.15%   67.18%   +0.02%     
- Complexity      1428     1434       +6     
=============================================
  Files            144      145       +1     
  Lines           8319     8354      +35     
  Branches        1335     1343       +8     
=============================================
+ Hits            5587     5613      +26     
- Misses          2161     2163       +2     
- Partials         571      578       +7
Impacted Files Coverage Δ Complexity Δ
.../tagtraum/perf/gcviewer/imp/DataReaderFactory.java 60.83% <0%> (-1.56%) 33 <0> (ø)
...java/com/tagtraum/perf/gcviewer/model/GCModel.java 85.45% <100%> (+0.03%) 129 <0> (ø) ⬇️
...a/com/tagtraum/perf/gcviewer/imp/DataReaderGo.java 80.64% <80.64%> (ø) 6 <6> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ec56ac...23d0551. Read the comment docs.

@chewiebug
Copy link
Owner

chewiebug commented Feb 25, 2018 via email

The Go programming language has a very dense GC logging format, which
is difficult to read for humans. It looks like this:

gc 1 @0.027s 35%: 15+3.3+0.41 ms clock, 46+0.66/2.3/3.0+1.2 ms cpu...
gc 2 @0.060s 28%: 3.6+7.6+0.37 ms clock, 10+0.33/0/6.5+1.1 ms cpu,...
gc 3 @0.079s 26%: 0.072+6.7+0.68 ms clock, 0.21+3.9/0.060/11+2.0 m...
gc 4 @0.104s 21%: 0.16+14+0.31 ms clock, 0.48+5.2/0.16/14+0.94 ms ...
gc 5 @0.140s 18%: 0.12+14+0.73 ms clock, 0.36+3.8/4.1/16+2.1 ms cp...
gc 6 @0.179s 17%: 0.20+15+0.48 ms clock, 0.62+5.1/10/19+1.4 ms cpu...
gc 7 @0.222s 16%: 0.12+19+0.21 ms clock, 0.37+11/0.064/19+0.64 ms ...
gc 8 @0.292s 15%: 0.10+13+0.34 ms clock, 0.32+10/11/13+1.0 ms cpu,...
gc 9 @0.936s 4%: 0.053+25+0.67 ms clock, 0.16+0.30/0.36/30+2.0 ms ...
gc 10 @1.123s 5%: 0.073+30+0.52 ms clock, 0.22+1.7/29/1.4+1.5 ms c...
gc 11 @1.369s 4%: 0.066+34+0.47 ms clock, 0.19+10/20/2.1+1.4 ms cp...

It fits well into the GCViewer model, although Go has nothing to do with
the JVM.
@rillig
Copy link
Contributor Author

rillig commented Feb 25, 2018

I added an example log file to the test resources and also added a unit test for it.

@chewiebug
Copy link
Owner

chewiebug commented Feb 25, 2018 via email

@rillig
Copy link
Contributor Author

rillig commented Feb 25, 2018

You didn't miss anything. I had just added the example file.

Copy link
Owner

@chewiebug chewiebug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand pause times of the go gc log.

private AbstractGCEvent<?> parseMatch(Matcher matcher) {
double relativeTime = Double.parseDouble(matcher.group(2));
double stopTheWorld1Time = Double.parseDouble(matcher.group(4)) / 1000.0;
double stopTheWorld2Time = Double.parseDouble(matcher.group(6)) / 1000.0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you only using groups 4 + 6 for the pause time? What is group 5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group 5 is the "concurrent mark and scan". I left it out because I only considered the stop-the-world times relevant. Maybe I'm wrong, though. I was missing some Javadoc on the fields of the GCEvent class, therefore I could only guess what is important and what is not.

The full documentation is at https://golang.org/pkg/runtime/#hdr-Environment_Variables, the paragraph starting with gctrace:. I thought mentioning the above URL in the Javadoc would be sufficient. But sure, it wouldn't hurt to document each capturing group.

public void test() throws IOException {
String gcLog = ""
+ "gc starting...\n" // Such a line is not produced by the Go GC; it is just for testing
+ "gc 1 @997.597s 3%: 68+0.36+0.51 ms clock, 205+0/16/89+1.5 ms cpu, 84->84->42 MB, 86 MB goal, 3 P\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the pause for this event is 68 + 0.51 ms. What about the 0.36 ms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0.36 ms is part of the GC time. I did not count it since I was only interested in the stop-the-world time. You can add it if you want. As I said above, the GC fields were not documented enough for me to decide which duration to include and which to omit.

@chewiebug
Copy link
Owner

chewiebug commented May 13, 2018 via email

@chewiebug chewiebug merged commit 23d0551 into chewiebug:develop Jul 26, 2018
chewiebug added a commit that referenced this pull request Jul 26, 2018
chewiebug added a commit that referenced this pull request Jul 26, 2018
@chewiebug
Copy link
Owner

Finally! The pull request is merged and your name is added to the list of contributors.

@chewiebug chewiebug added this to the 1.36 milestone Jul 26, 2018
@rillig rillig deleted the golang branch July 27, 2018 23:08
sparrowzoo pushed a commit to sparrowzoo/GCViewer that referenced this pull request Dec 28, 2020
sparrowzoo pushed a commit to sparrowzoo/GCViewer that referenced this pull request Dec 28, 2020
sparrowzoo pushed a commit to sparrowzoo/GCViewer that referenced this pull request Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants