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

Re: [PATCH 01/14] trace2: Documentation/technical/api-trace2.txt

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 23, 2019, 20:51 UTC
Message-ID
<xmqqbm47ayhv.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<1a90de9dab0dd836e54fee9e08ab9e2284e1027a.1548192131.git.gitgitgadget@gmail.com>
"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
> +These high-level events are written to one or more Trace2 Targets
> +in a target-specific format.  Each Trace2 Target defines a different
> +purpose-specific view onto the event data stream.  In this mannor,
"In this manner"
Show 14 quoted lines
> +a single set of Trace2 API event calls in the Git source can drive
> +different types of analysis.
> +
> ...
> +$ cat ~/log.perf
> +12:28:42.620675 common-main.c:38                  | d0 | main                     | version      |     |           |           |            | 2.20.1.155.g426c96fcdb
> +12:28:42.621001 common-main.c:39                  | d0 | main                     | start        |     |           |           |            | git version
> +12:28:42.621111 git.c:432                         | d0 | main                     | cmd_verb     |     |           |           |            | version (version)
> +12:28:42.621225 git.c:662                         | d0 | main                     | exit         |     |  0.001227 |           |            | code:0
> +12:28:42.621259 trace2/tr2_tgt_perf.c:211         | d0 | main                     | atexit       |     |  0.001265 |           |            | code:0
> +------------
> ...
> +
> +trace2_def_param(...)
Not limited to this single one, but please either
 - omit "..." in parens, unless all of these functions take varargs
   of unspecified type (which I do not think is the case), or
 - write a proper prototype for these functions, explain what the
   function itself and what the parameters are for.
I'll complain about lack of info around here later X-<.
> +trace2_def_repo(...)
Show 23 quoted lines
> +----------------
> +
> +Git Child Process Events::
> +
> +	These are concerned with the various spawned child processes,
> +	including sub-git processes and hooks,
> ++
> +----------------
> +trace2_child_start(...)
> +trace2_child_exit(...)
> +
> +trace2_exec(...)
> +trace2_exec_result(...)
> +----------------
> +
> +Git Thread Events::
> +
> +	These are concerned with Git thread usage.
> ++
> +----------------
> +trace2_thread_start(...)
> +trace2_thread_exit(...)
> +----------------

Lack of _wait()/_join() feels a bit curious, but _exit() from what is being waited would suffice as a substitute.

Show 15 quoted lines
> +Initialization::
> +
> +	Initialization happens in `main()`.  The initialization code
> +	determines which, if any, Trace2 Targets should be enabled and
> +	emits the `version`, `start`, and `exit` events.  It causes an
> +	`atexit` function and `signal` handler to be registered that
> +	will emit `atexit` and `signal` events.
> ++
> +----------------
> +int main(int argc, const char **argv)
> +{
> +	int exit_code;
> +
> +	trace2_initialize();
> +	trace2_cmd_start(argv);

Nobody other than trace2 integration would make a call to this helper, so it may not matter, but sending av alone without ac, even though ac is almost always redundant, feels somewhat unexpected.

Show 12 quoted lines
> +Command Details::
> +
> +	After the basics are established, additional process
> +	information can be sent to Trace2 as it is discovered, such as
> +	the command verb, alias expansion, interesting config
> +	settings, the repository worktree, error messages, and etc.
> ++
> +----------------
> +int cmd_checkout(int argc, const char **argv)
> +{
> +	// emit a single "def_param" event
> +	trace2_def_param("core.editor", "emacs");

Without knowing what "def_param event" is, this example is hard to fathom. At this point in the doc, the reader does not even know what "def" stands for. Is this call to define a param called core.editor? Is it reporting that the default value for core.editor is emacs?

> +	// emit def_params for any config setting matching a pattern
> +	// in GIT_TR2_CONFIG_PARAMS.
> +	trace2_cmd_list_config();

As the reader does not know what def_param is, this is also hard to follow.

> +	trace2_cmd_verb("checkout");
> +	trace2_cmd_subverb("branch");

These are guessable. It probably reports what the codepath is doing.

> +	trace2_def_repo(the_repository);

Again, this is not easy to guess. Is it reporting what the default repository is?

> +	if (do_something(...))
> +	    trace2_cmd_error("Path '%s': cannot do something", path);
This is guessable, which is good.
Show 9 quoted lines
> +void run_child(...)
> +{
> +	int child_exit_code;
> +	struct child_process cmd = CHILD_PROCESS_INIT;
> +	...
> +
> +	trace2_child_start(&cmd);
> +	child_exit_code = ...();
> +	trace2_child_exit(&cmd, child_exit_code);

Even though child_exit() has not been explained just like def_param(), this is far more guessable. I wonder why it is. The name of the variable passed to it in the example certainly helps, as it is totally unclear where the string constant "emacs" in the earlier example came from (e.g. is it hardcoded in the program? is it merely illustrating "here is how you report the value you have decided to use for 'core.editor' variable"?).

Show 8 quoted lines
> ...
> +$ cat ~/log.perf
> +d0 | main                     | version      |     |           |           |            | 2.20.1.160.g5676107ecd.dirty
> +d0 | main                     | start        |     |           |           |            | git status
> +d0 | main                     | def_repo     | r1  |           |           |            | worktree:/Users/jeffhost/work/gfw
> +d0 | main                     | cmd_verb     |     |           |           |            | status (status)
> +...
> +d0 | main                     | region_enter | r1  |  0.010988 |           | status     | label:worktrees
It is hard to guess what "d0" and "r1" stand for here.  

In an earlier example we also saw an unexplained "d0" there, which I think was OK because the illustration was merely to give the "feel" of the format up there. But now we are giving a bit more detailed explanation, we probably would want to at least briefly mention what each column means.

I'd stop here for now, as I am more interested in reading the code ;-)

Previous: Jeff Hostetler via GitGitGadgetNext: Jeff Hostetler
Message 19 of 154 in “Trace2 tracing facility”
  1. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 22, 2019
  2. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 22, 2019
  3. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 22, 2019
  4. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  5. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  6. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  7. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 22, 2019
  8. SZEDER GáborJan 25, 2019
  9. Junio C HamanoJan 25, 2019
  10. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 22, 2019
  11. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 22, 2019
  12. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 22, 2019
  13. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 22, 2019
  14. Derrick StoleeJan 23, 2019
  15. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 22, 2019
  16. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 22, 2019
  17. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 22, 2019
  18. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 22, 2019
  19. Junio C HamanoJan 23, 2019
  20. Jeff HostetlerJan 25, 2019
  21. SZEDER GáborJan 25, 2019
  22. Josh SteadmonJan 25, 2019
  23. Junio C HamanoJan 22, 2019
  24. Josh SteadmonJan 25, 2019
  25. Jeff HostetlerJan 30, 2019
  26. Jeff HostetlerJan 28, 2019
  27. Junio C HamanoJan 28, 2019
  28. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 28, 2019
  29. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 28, 2019
  30. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 28, 2019
  31. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  32. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  33. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  34. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 28, 2019
  35. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 28, 2019
  36. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 28, 2019
  37. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 28, 2019
  38. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 28, 2019
  39. Junio C HamanoJan 28, 2019
  40. Jeff HostetlerJan 29, 2019
  41. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 28, 2019
  42. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 28, 2019
  43. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 28, 2019
  44. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 28, 2019
  45. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  46. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 30, 2019
  47. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 30, 2019
  48. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 30, 2019
  49. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  50. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  51. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 30, 2019
  52. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 30, 2019
  53. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  54. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  55. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  56. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 30, 2019
  57. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  58. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 30, 2019
  59. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  60. 00/14 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  61. 13/14 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Jan 30, 2019
  62. 14/14 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Jan 30, 2019
  63. SZEDER GáborJan 31, 2019
  64. Junio C HamanoJan 31, 2019
  65. Jeff HostetlerFeb 1, 2019
  66. 12/14 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  67. 11/14 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Jan 30, 2019
  68. 02/14 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Jan 30, 2019
  69. 09/14 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Jan 30, 2019
  70. 10/14 pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Jan 30, 2019
  71. 07/14 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  72. 08/14 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  73. 06/14 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  74. 05/14 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Jan 30, 2019
  75. 04/14 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Jan 30, 2019
  76. 03/14 trace2: collect platform-specific process informationJeff Hostetler via GitGitGadget, Jan 30, 2019
  77. SZEDER GáborJan 31, 2019
  78. Jeff HostetlerFeb 1, 2019
  79. 01/14 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Jan 30, 2019
  80. SZEDER GáborJan 31, 2019
  81. Jeff HostetlerJan 31, 2019
  82. Junio C HamanoJan 31, 2019
  83. Junio C HamanoJan 31, 2019
  84. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 1, 2019
  85. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 1, 2019
  86. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 1, 2019
  87. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 1, 2019
  88. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  89. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  90. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 1, 2019
  91. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 1, 2019
  92. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 1, 2019
  93. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 1, 2019
  94. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 1, 2019
  95. Ævar Arnfjörð BjarmasonFeb 13, 2019
  96. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 1, 2019
  97. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 1, 2019
  98. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 1, 2019
  99. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  100. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 1, 2019
  101. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 6, 2019
  102. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 6, 2019
  103. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 6, 2019
  104. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  105. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  106. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  107. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 6, 2019
  108. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 6, 2019
  109. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 6, 2019
  110. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 6, 2019
  111. Ævar Arnfjörð BjarmasonFeb 15, 2019
  112. Jeff HostetlerFeb 15, 2019
  113. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 6, 2019
  114. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 6, 2019
  115. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 6, 2019
  116. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 6, 2019
  117. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 6, 2019
  118. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 6, 2019
  119. Ævar Arnfjörð BjarmasonFeb 14, 2019
  120. Jeff HostetlerFeb 15, 2019
  121. Ævar Arnfjörð BjarmasonMar 17, 2019
  122. Johannes SchindelinMar 21, 2019
  123. Ævar Arnfjörð BjarmasonMar 21, 2019
  124. Johannes SchindelinMar 22, 2019
  125. Jeff HostetlerMar 22, 2019
  126. Ævar Arnfjörð BjarmasonMar 22, 2019
  127. Jeff HostetlerMar 22, 2019
  128. 00/15 Trace2 tracing facilityJeff Hostetler via GitGitGadget, Feb 22, 2019
  129. 03/15 trace2: collect Windows-specific process informationJeff Hostetler via GitGitGadget, Feb 22, 2019
  130. 01/15 trace2: Documentation/technical/api-trace2.txtJeff Hostetler via GitGitGadget, Feb 22, 2019
  131. 07/15 trace2:data: add trace2 transport child classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  132. 08/15 trace2:data: add trace2 hook classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  133. 11/15 trace2:data: add subverb to checkout commandJeff Hostetler via GitGitGadget, Feb 22, 2019
  134. 13/15 trace2:data: add subverb for rebaseJeff Hostetler via GitGitGadget, Feb 22, 2019
  135. 15/15 trace2: add for_each macros to clang-formatJeff Hostetler via GitGitGadget, Feb 22, 2019
  136. 09/15 trace2:data: add trace2 instrumentation to index read/writeJeff Hostetler via GitGitGadget, Feb 22, 2019
  137. trace2: fix up a missing "leave" entry pointÆvar Arnfjörð Bjarmason, May 10, 2019
  138. Derrick StoleeMay 10, 2019
  139. Jeff HostetlerMay 20, 2019
  140. 14/15 trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.shJeff Hostetler via GitGitGadget, Feb 22, 2019
  141. 10/15 trace2:data: pack-objects: add trace2 regionsDerrick Stolee via GitGitGadget, Feb 22, 2019
  142. 12/15 trace2:data: add subverb to reset commandJeff Hostetler via GitGitGadget, Feb 22, 2019
  143. 02/15 trace2: create new combined trace facilityJeff Hostetler via GitGitGadget, Feb 22, 2019
  144. SZEDER GáborMay 10, 2019
  145. Derrick StoleeMay 10, 2019
  146. 06/15 trace2:data: add trace2 sub-process classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  147. 05/15 trace2:data: add editor/pager child classificationJeff Hostetler via GitGitGadget, Feb 22, 2019
  148. 04/15 trace2:data: add trace2 regions to wt-statusJeff Hostetler via GitGitGadget, Feb 22, 2019
  149. SZEDER GáborJan 31, 2019
  150. Jeff HostetlerJan 31, 2019
  151. Junio C HamanoJan 31, 2019
  152. Jeff HostetlerJan 31, 2019
  153. Jeff HostetlerJan 31, 2019
  154. Junio C HamanoJan 31, 2019

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.