git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v1 1/2] api-trace2.txt: print config key-value pair

From
tenglong.tl <dyroneteng@gmail.com>
Date
Jul 22, 2022, 08:19 UTC
Message-ID
<32f8b9ae6bb6aff0ce55ee494c4c0d40c672752b.1658472474.git.dyroneteng@gmail.com>
In-Reply-To
<cover.1658472474.git.dyroneteng@gmail.com>
From: Teng Long <dyroneteng@gmail.com>

It's supported to print "interesting" config key-value paire to tr2 log by setting "GIT_TRACE2_CONFIG_PARAMS" environment variable and the "trace2.configparam" config, let's add the related docs in Documentaion/technical/api-trace2.txt.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
---
 Documentation/technical/api-trace2.txt | 32 ++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
diff --git a/Documentation/technical/api-trace2.txt b/Documentation/technical/api-trace2.txt
index 77a150b30e..ddc0bfb9c9 100644
--- a/Documentation/technical/api-trace2.txt
+++ b/Documentation/technical/api-trace2.txt
@@ -717,6 +717,7 @@ The "exec_id" field is a command-unique id and is only useful if the
 {
 	"event":"def_param",
 	...
+	"scope":"global",
 	"param":"core.abbrev",
 	"value":"7"
 }
@@ -1207,6 +1208,37 @@ at offset 508.
 This example also shows that thread names are assigned in a racy manner
 as each thread starts and allocates TLS storage.
 
+Print Configs::
+
+	  Dump "interesting" config values to trace2 log.
++
+The environment variable `GIT_TRACE2_CONFIG_PARAMS` and configuration
+`trace2.configparams` can be used to output config values which you care
+about(see linkgit:git-config[1). For example:
++
+----------------
+$ git config color.ui auto
+----------------
++
+Then, mark the config `color.ui` as "interesting" config with
+`GIT_TRACE2_CONFIG_PARAMS`:
++
+----------------
+$ export GIT_TRACE2_PERF_BRIEF=1
+$ export GIT_TRACE2_PERF=~/log.perf
+$ export GIT_TRACE2_CONFIG_PARAMS=color.ui
+$ git version
+...
+$ cat ~/log.perf
+d0 | main                     | version      |     |           |           |              | ...
+d0 | main                     | start        |     |  0.001642 |           |              | /usr/local/bin/git version
+d0 | main                     | cmd_name     |     |           |           |              | version (version)
+d0 | main                     | def_param    |     |           |           |              | color.ui:auto
+d0 | main                     | data         | r0  |  0.002100 |  0.002100 | fsync        | fsync/writeout-only:0
+d0 | main                     | data         | r0  |  0.002126 |  0.002126 | fsync        | fsync/hardware-flush:0
+d0 | main                     | exit         |     |  0.002142 |           |              | code:0
+d0 | main                     | atexit       |     |  0.002161 |           |              | code:0
+----------------
 == Future Work
 
 === Relationship to the Existing Trace Api (api-trace.txt)
-- 
2.37.1.1.g8cbb44ffc4.dirty
Previous: tenglong.tlNext: Ævar Arnfjörð Bjarmason
Message 7 of 22 in “tr2: shows the scope unconditionally with config”
  1. 0/2 tr2: shows the scope unconditionally with configtenglong.tl, Jul 21, 2022
  2. 1/2 api-trace2.txt: print config key-value pairtenglong.tl, Jul 21, 2022
  3. 2/2 tr2: shows scope unconditionally in addition to key-value pairtenglong.tl, Jul 21, 2022
  4. Junio C HamanoJul 21, 2022
  5. tenglong.tlJul 22, 2022
  6. 0/2 tr2: shows the scope unconditionally with configtenglong.tl, Jul 22, 2022
  7. 1/2 api-trace2.txt: print config key-value pairtenglong.tl, Jul 22, 2022
  8. Ævar Arnfjörð BjarmasonJul 22, 2022
  9. Junio C HamanoJul 25, 2022
  10. tenglong.tlAug 1, 2022
  11. Junio C HamanoAug 5, 2022
  12. Teng LongAug 8, 2022
  13. Junio C HamanoJul 22, 2022
  14. tenglong.tlJul 23, 2022
  15. Junio C HamanoJul 23, 2022
  16. tenglong.tlJul 25, 2022
  17. 2/2 tr2: shows scope unconditionally in addition to key-value pairtenglong.tl, Jul 22, 2022
  18. 0/2 tr2: shows the scope unconditionally with configTeng Long, Aug 12, 2022
  19. 1/2 api-trace2.txt: print config key-value pairTeng Long, Aug 12, 2022
  20. 2/2 tr2: shows scope unconditionally in addition to key-value pairTeng Long, Aug 12, 2022
  21. Junio C HamanoAug 12, 2022
  22. Junio C HamanoAug 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.