Skip to content

A simple profiling library for Java that uses Chromium tracing frame viewer for data visualization.

License

Notifications You must be signed in to change notification settings

robert-harbison/JTracingProfiler

Repository files navigation

JTracingProfiler is a simple profiling library for Java that uses Chromium tracing frame viewer for data visualization.

How To Use

VM arguments must use -Dprofile=true in order to run profiling. When -Dprofile is set to false profiling will be disabled.

Basic Example

public static void main(String[] args) {
	/*
	 * Creates and starts a new session with a custom name. This name is also used\
	 * in the output files name
	 */
	JTracingProfiler.startSession(JTracingProfiler.createProfilerSession("example"));

	method();

	// Stop the session when you are done to ensure the data gets saved correctly.
	JTracingProfiler.stopSession();
}

public static void method() {
	/*
	 * Creates a new profile using the default naming scheme [file]:[method]:[line].
	 * You can also pass in a String to use as name instead.
	 */
	Profile profile = new Profile();
	
	// [YOUR CODE HERE]
	
	// Stops the profiler and writes to the file.
	profile.stop();
}

Viewing Data

Currently the data will output to a JSON file in the programs root directory. If you open up a Chromium based browser and type in chrome://tracing/ to the URL bar then drag the JSON file into it you will get a visual representation of the data.

About

A simple profiling library for Java that uses Chromium tracing frame viewer for data visualization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages