Package org.bootchart.common
Class Common
java.lang.Object
org.bootchart.common.Common
Common methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFile name filter for bootchart log files. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatCommand(String cmd) Format the specified command line.static StringgetProcessDesc(Process proc, Date startTime) Returns the text to include in the process description pop-up.static BufferedReadergetReader(InputStream is) Returns a buffered reader suitable for reading the input stream.static booleanWhether the running JVM supports PNG encoding.static StringLoads the contents of the file.static doubleReturns a newdoubleinitialized to the value represented by the specifiedString.
-
Field Details
-
VERSION
Program version.- See Also:
-
LOCALE
Default locale. -
PROC_PARAM
A list of processes which should include parameters in their command lines. -
MAX_PARSE_SAMPLES
public static final int MAX_PARSE_SAMPLESThe maximum number of samples to parse.- See Also:
-
-
Constructor Details
-
Common
public Common()
-
-
Method Details
-
loadFile
Loads the contents of the file. The file is either read from the file system or retrieved as resource stream.- Parameters:
file- the file to read- Returns:
- file contents string
- Throws:
IOException- if an I/O error occurs
-
getReader
Returns a buffered reader suitable for reading the input stream.- Parameters:
is- input stream to read- Returns:
- buffered reader
- Throws:
IOException- if an I/O error occurs
-
parseDouble
Returns a newdoubleinitialized to the value represented by the specifiedString. Any decimal commas in the string are replaced with dots.- Parameters:
s- the string to be parsed- Returns:
- the double value represented by the string argument
-
formatCommand
Format the specified command line. Shell invocations, paths and parameters are removed (e.g. "/bin/bash /etc/rc.d/rc.sysinit" -> "rc.sysinit"). Paramaters are included for certain commands (e.g. modprobe and rc).- Parameters:
cmd- command line- Returns:
- a trimed command line
-
getProcessDesc
Returns the text to include in the process description pop-up. The description includes the PID, command name, start time, duration and any user-specified description (e.g. script stack trace).- Parameters:
proc- the process to get description forstartTime- process tree start time- Returns:
- a multiline process description text
-
isPNGSupported
public static boolean isPNGSupported()Whether the running JVM supports PNG encoding. Some runtime environments (e.g. those based on GNU Classpath) don't have the necessary Graphics2D support.- Returns:
- whether this JVM supports PNG encoding
-