]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Tweak manuals and code related to tracing
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Apr 2019 20:12:06 +0000 (22:12 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Apr 2019 20:12:06 +0000 (22:12 +0200)
LICENSE.adoc
doc/DEVELOPER.md
src/ccache.c

index 7b0b33df76dfc107255392323971474b848eacbf..30848f40d405627601830cecbd1655688848a93d 100644 (file)
@@ -448,7 +448,7 @@ src/minitrace.[hc]
 ~~~~~~~~~~~~~~~~~~
 
 A library for producing JSON traces suitable for Chrome's built-in trace viewer
-(chrome://tracing). Downloaded from <https://github.com/hrydgard/minitrace>
+(chrome://tracing). Downloaded from <https://github.com/hrydgard/minitrace>.
 
 -------------------------------------------------------------------------------
 The MIT License (MIT)
index fca6b01449a4eea7901b64b035235ae393e3b6de..318dc6fac13ea78110338f7826f0294070199b3f 100644 (file)
@@ -1,31 +1,35 @@
-Developer Manual
+Developer manual
 ================
 
 Tracing
 -------
 
-In order to see what ccache is doing, it is possible to enable microsecond tracing.
-This needs to be done when compiling ccache, using the `--enable-tracing` feature.
+In order to see what ccache is doing, it is possible to enable microsecond
+tracing. This needs to be done when compiling ccache using the
+`--enable-tracing` configure option.
 
-By setting *CCACHE_INTERNAL_TRACE*, one can obtain a trace of an individual compile.
-This trace can then be loaded into the `chrome://tracing` page of Chromium/Chrome.
+By setting `CCACHE_INTERNAL_TRACE` one can obtain a trace of an individual
+compile. This trace can then be loaded into the `chrome://tracing` page of
+Chromium/Chrome.
 
-The current event categories are: config, main, hash, manifest, cache, file, execute
+The current event categories are config, main, hash, manifest, cache, file,
+execute.
 
-With a unique file per compile, there is a script to combine them all into one trace:
+There is a script to combine trace logs from multiple compilations into one:
 
-`misc/combine_events.py file1.json file2.json file3.json | gzip > ccache.trace.gz`
+    misc/combine_events.py file_1.json ... file_n.json | gzip > ccache.trace.gz
 
-This will offset each invididual trace by starting time, to make one combined trace.
+This will offset each invididual trace by starting time to make one combined
+trace.
 
-If you set the variable, the trace JSON output will be put next to the object file:
+When you set the `CCACHE_INTERNAL_TRACE` variable, the trace JSON output will
+be put next to the object file, e.g. as `output.o.ccache-trace`. This is done
+by first generating a temporary file until the output name is known.
 
-e.g. `output.o.ccache-trace`
+There is also another script to generate a summary (per job slot) of all the
+ccache runs:
 
-This is done by first generating a temporary file, until the output name is known.
+    misc/combine_events.py *.ccache-trace | misc/summarize_events.py 1 > ccache.trace
 
-There is another script, to generate a summary (per job slot) of all the ccache runs:
-
-`misc/combine_events.py *.ccache-trace | misc/summarize_events.py 1 > ccache.trace`
-
-You will need to give the number of job slots used (`make -j`), as input to the script.
+You will need to give the number of job slots used (`make -j`) as input to the
+script.
index e585b058e58abcc22196e34ae3b37d5e771ec8d1..1433eb179da6ce722c13274a09d4b596136c1b1e 100644 (file)
@@ -3540,10 +3540,9 @@ create_initial_config_file(const char *path)
 #ifdef MTR_ENABLED
 static void *trace_id;
 static const char *trace_file;
-#endif
 
-#ifdef MTR_ENABLED
-static void trace_init(const char *json)
+static void
+trace_init(const char *json)
 {
        trace_file = json;
        mtr_init(json);
@@ -3551,7 +3550,8 @@ static void trace_init(const char *json)
        MTR_INSTANT_C("", "", "time", s);
 }
 
-static void trace_start(const char *json)
+static void
+trace_start(const char *json)
 {
        trace_file = json;
        cc_log("Starting tracing: %s", json);
@@ -3560,7 +3560,8 @@ static void trace_start(const char *json)
        MTR_START("program", "ccache", trace_id);
 }
 
-static void trace_stop(void *context)
+static void
+trace_stop(void *context)
 {
        const char *json = (const char *) context;
        if (str_eq(json, "")) {
@@ -3592,7 +3593,8 @@ tmpdir()
 #endif
        return "/tmp";
 }
-#endif
+
+#endif // MTR_ENABLED
 
 // Read config file(s), populate variables, create configuration file in cache
 // directory if missing, etc.
@@ -3602,7 +3604,7 @@ initialize(void)
        char *tracefile = getenv("CCACHE_INTERNAL_TRACE");
        if (tracefile != NULL) {
 #ifdef MTR_ENABLED
-               // We don't have any conf yet, so we can't use temp_dir() here
+               // We don't have any conf yet, so we can't use temp_dir() here.
                tracefile = format("%s/trace.%d.json", tmpdir(), (int)getpid());
 
                trace_init(tracefile);