[JAVA] Add the date to the GC statistics acquired by gcutil and output it.

Why i wrote this article

The t option shows the elapsed time since the JVM was executed, because I wanted to know the current time rather than that.

Advance preparation

Find out the ID of the java process you want to monitor with the jps command.

Start monitoring

The execution result is displayed every second, and the headline is displayed every 10 lines.

Execution command


jstat -gcutil -h 10 [java process id] 1000 | awk  -F, '{print strftime("%Y-%m-%d %H:%M:%S",systime()) $1}'

result

2019-03-17 11:39:38  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT    CGC    CGCT    CT
2019-03-17 11:39:38  0.00 100.00  17.39  12.32  95.68  86.38      5    0.035     0    0.000     2    0.005    0.040
2019-03-17 11:39:39  0.00 100.00  17.39  12.32  95.68  86.38      5    0.035     0    0.000     2    0.005    0.040
2019-03-17 11:39:40  0.00 100.00  17.39  12.32  95.68  86.38      5    0.035     0    0.000     2    0.005    0.040
2019-03-17 11:39:41  0.00 100.00  17.39  12.32  95.68  86.38      5    0.035     0    0.000     2    0.005    0.040
2019-03-17 11:39:42  0.00 100.00  17.39  12.32  95.68  86.38      5    0.035     0    0.000     2    0.005    0.040

Recommended Posts

Add the date to the GC statistics acquired by gcutil and output it.
Add the pre-built jar library to Android and call it in the framework
Format the date and time given by created_at
Add arbitrary parameters to the URL output by <h: outputScript> <h: outputStylesheet> of JSF
Convert the array of errors.full_messages to characters and output
Bind the request to any class and receive it
It is difficult to use the empty string or date of DBUnit, so fix it and use it.
[Code golf] Deflate the code and submit it to AtCoder [Compressed golf]
Add a shadow to the Swift Button (and also the circle)
[Java] Use ResolverStyle.LENIENT to handle the date and time nicely
How to pick up the input value by asynchronous communication and output the desired data from the server
4 Add println to the interpreter
Get the current date and time by specifying the time zone in Thymeleaf
Put the date (e.g. yyyy-MM-dd) in the log file output by logback
Method to add the number of years and get the end of the month
"Wait for the process to finish." And kill the process because it remains.
[Java] Output the result of ffprobe -show_streams in JSON and map it to an object with Jackson