09 November 2016

Clock Sync Marker

From clock_gettime() with posix clock - systemTime(CLOCK_MONOTONIC) / 1000000000.0f - systemTime(CLOCK_REALTIME) / 1000000 Otherwise, gettimeofday()

Category Support

A category is supported only if all its required /sys/ files are writable and if enabling the category will enable one or more tracing tags or /sys/ files - found one of the required enable paths exists

Support for root - found one of the required enable paths is writable

Trace Properties

  • [] /d/tracing/trace

  • [] /d/tracing/tracing_on

  • [] /d/tracing/trace_clock

  • [] /d/tracing/buffer_size_kb

  • [] /d/tracing/options/overwrite

  • /d/tracing/current_tracer // nop, function_graph

  • /d/tracing/set_ftrace_filter

  • /d/tracing/options/funcgraph-abstime

  • /d/tracing/options/funcgraph-cpu

  • /d/tracing/options/funcgraph-proc

  • /d/tracing/options/funcgraph-flat

  • /d/tracing/options/funcgraph-duration

  • /d/tracing/trace_marker

  • /d/tracing/trace_pipe

  • /d/tracing/current_tracer

  • /d/tracing/options/print-tgid // set if present

File Utils

  • exists

  • truncate by creat

  • writable

Trace Clock

Any write to the trace_clock sysfs file will reset the buffer, so only update it if the requested value is not the current clock.

Setup Trace

  1. setCategoriesEnableFromFile(g_categoriesFile);

  2. setTraceOverwriteEnable(g_traceOverwrite);

  3. setTraceBufferSizeKB(g_traceBufferSizeKB);

  4. setGlobalClockEnable(true);

  5. setPrintTgidEnableIfPresent(true);

  6. setKernelTraceFuncs(g_kernelTraceFuncs);

  7. set enabled

Cleanup Trace

  1. disable all

  2. setTraceOverwriteEnable(true);

  3. setTraceBufferSizeKB(1);

  4. setGlobalClockEnable(false);

  5. setPrintTgidEnableIfPresent(false);

  6. setKernelTraceFuncs(NULL);

Start Trace

  1. start

  2. clear

  3. sync clock marker

  4. stop

  5. dump

  6. clear

  7. cleanup