Skip to content

C/C++ library for generating traces for Chrome Tracing View

Notifications You must be signed in to change notification settings

dmarquant/dmq_trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dmq trace

C/C++ library for generating traces for Chrome Tracing View

Generating a Trace File

To use the library include dmq_trace.h and add dmq_trace.c to your compiled files. Use DMQ_TRACE_BEGIN and DMQ_TRACE_END to start and finalize the trace. You can only add trace events between those calls. With DMQ_TRACE_START_EVENT and DMQ_TRACE_STOP_EVENT an event can be stored in the profile. The generated trace file is stored in profile.json.

DMQ_TRACE_BEGIN();

dmq_trace_event e;
DMQ_TRACE_START_EVENT(&e, "Generate Dataset");

// Generate dataset

DMQ_TRACE_STOP_EVENT(&e);

DMQ_TRACE_END();

Or you can use the C++ API by including dmq_trace.hpp. You can create a timer object that will start a trace event. You can stop the timer or let the destructor stop the timer automatically.

DMQ_TRACE_BEGIN();

{
dmq::Timer timer("Generate Dataset");
// Generate dataset
}

dmq::Timer timer("Finalize");
// Finalize
timer.stop();

DMQ_TRACE_END();

Viewing the Trace

Open chrome and enter chrome://tracing in the URL bar. In the Chrome Trace View click on load and select the generated trace.

Example of Chrome Trace View

Disabling the Trace

You can disable the trace by defining DMQ_DISABLE_TRACE.

About

C/C++ library for generating traces for Chrome Tracing View

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published