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

Re: [PATCH v3 5/5] bitmap: add trace2 outputs during open "bitmap" file

From
Teng Long <dyroneteng@gmail.com>
Date
Jun 23, 2022, 09:38 UTC
Message-ID
<20220623093836.113288-1-dyroneteng@gmail.com>
In-Reply-To
<78966fb1-d5be-2fb5-0f68-0fce0b93d249@jeffhostetler.com>
On Wed, 22 Jun 2022 08:51:18 -0400, Jeff Hostetler wrote:
> We should not be doing.  This would dump every repo-related
> boolean value on every command.

Yes. in v4 patch I use a new arg in repo_cfg_bool to decide whether to trace or not, but after the above you mentioned, I think it's still not a correct solution in my v4.

> I already have a GIT_TRACE2_CONFIG_PARAMS and trace2.configparams
> that will dump "interesting" config values to the trace2 log.
> Just set one of them to a list of regex's.  Look at the comment above
> trace2_cmd_list_config() in trace2.h for details.
That's fresh for me, thanks for telling me that.

I remove the changes of "repo_config_bool" from my v4 patch then I try to know about "GIT_TRACE2_CONFIG_PARAMS" and "trace2.configparams". Thereby, when I:

Execute "GIT_TRACE2_PERF=1 GIT_TRACE2_CONFIG_PARAMS=core.multipackIndex git rev-list  --test-bitmap HEAD"

15:21:38.812782 git.c:461 | d0 | main | def_param | | | | | core.multipackindex:false 15:21:38.812797 git.c:461 | d0 | main | def_param | | | | | core.multipackindex:false

I checked my configs, I found if there exists multiple level configs. it'll print multiple times. Like If I config all the global, system and local on "core.multipackIndex=false" , the output will be:

15:41:50.614108 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:false 15:41:50.614123 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:false 15:41:50.614136 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:false

And if I modified the local scope of core.multipackIndex to "true", the output will be:

15:45:39.200172 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:false 15:45:39.200186 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:false 15:45:39.200200 git.c:462 | d0 | main | def_param | | | | | core.multipackindex:true

I'm not sure it's an intentional design or here should be only print the final value that takes effect or should print all the values if config multiple scopes on the same config.

Hence, I made a temporary patch below to try to add some identifying information to know why we output these lines, like:

diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c
index c5c8cfbbaa..37a3163be1 100644
--- a/trace2/tr2_tgt_event.c
+++ b/trace2/tr2_tgt_event.c
@@ -479,9 +479,12 @@ static void fn_param_fl(const char *file, int line, const char *param,
 {
        const char *event_name = "def_param";
        struct json_writer jw = JSON_WRITER_INIT;
+       enum config_scope scope = current_config_scope();
+       const char *scope_name = config_scope_name(scope);
 
commit a089800b9dbc93a5dff9a46da7e66111e6e4343e (HEAD -> master, dyrone/master, dyrone/HEAD)
Author: Teng Long <dyroneteng@gmail.com>
Date:   Thu Jun 23 17:24:15 2022 +0800

    tr2: append scope info when same configs exist in multiple scopes
    
    Signed-off-by: Teng Long <dyroneteng@gmail.com>

diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c
index c5c8cfbbaa..37a3163be1 100644
--- a/trace2/tr2_tgt_event.c
+++ b/trace2/tr2_tgt_event.c
@@ -479,9 +479,12 @@ static void fn_param_fl(const char *file, int line, const char *param,
 {
        const char *event_name = "def_param";
        struct json_writer jw = JSON_WRITER_INIT;
+       enum config_scope scope = current_config_scope();
+       const char *scope_name = config_scope_name(scope);
 
        struct json_writer jw = JSON_WRITER_INIT;
+       enum config_scope scope = current_config_scope();
+       const char *scope_name = config_scope_name(scope);
 
        jw_object_begin(&jw, 0);
        event_fmt_prepare(event_name, file, line, NULL, &jw);
+       jw_object_string(&jw, "scope", scope_name);
        jw_object_string(&jw, "param", param);
        jw_object_string(&jw, "value", value);
        jw_end(&jw);
diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c
index c42fbade7f..e1b036a60c 100644
--- a/trace2/tr2_tgt_normal.c
+++ b/trace2/tr2_tgt_normal.c
@@ -298,8 +298,10 @@ static void fn_param_fl(const char *file, int line, const char *param,
                        const char *value)
 {
        struct strbuf buf_payload = STRBUF_INIT;
+       enum config_scope scope = current_config_scope();
+       const char *scope_name = config_scope_name(scope);
 
-       strbuf_addf(&buf_payload, "def_param %s=%s", param, value);
+       strbuf_addf(&buf_payload, "def_param scope:%s %s=%s", scope_name, param, value);
        normal_io_write_fl(file, line, &buf_payload);
        strbuf_release(&buf_payload);
 }
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c
index a1eff8bea3..c21bf8e651 100644
--- a/trace2/tr2_tgt_perf.c
+++ b/trace2/tr2_tgt_perf.c
@@ -441,10 +441,12 @@ static void fn_param_fl(const char *file, int line, const char *param,
 {
        const char *event_name = "def_param";
        struct strbuf buf_payload = STRBUF_INIT;
+       enum config_scope scope = current_config_scope();
+       const char *scope_name = config_scope_name(scope);
 
        strbuf_addf(&buf_payload, "%s:%s", param, value);
 
-       perf_io_write_fl(file, line, event_name, NULL, NULL, NULL, NULL,


----
The partial tr2 log looks like:

PERF:
17:00:35.933094 git.c:462                    | d0 | main                     | def_param    |     |           |           | system       | core.multipackindex:false
17:00:35.933110 git.c:462                    | d0 | main                     | def_param    |     |           |           | global       | core.multipackindex:false
17:00:35.933128 git.c:462                    | d0 | main                     | def_param    |     |           |           | local        | core.multipackindex:true

NORMAL:
17:14:32.905359 git.c:462                         def_param scope:system core.multipackindex=false
17:14:32.905370 git.c:462                         def_param scope:global core.multipackindex=false
17:14:32.905383 git.c:462                         def_param scope:local core.multipackindex=true

EVENT:
{"event":"def_param","sid":"20220623T092115.703660Z-H82fddc29-P0001812a","thread":"main","time":"2022-06-23T09:21:15.703920Z","file":"git.c","line":462,"scope":"system","param":"core.multipackindex","value":"false"}
{"event":"def_param","sid":"20220623T092115.703660Z-H82fddc29-P0001812a","thread":"main","time":"2022-06-23T09:21:15.703936Z","file":"git.c","line":462,"scope":"global","param":"core.multipackindex","value":"false"}
{"event":"def_param","sid":"20220623T092115.703660Z-H82fddc29-P0001812a","thread":"main","time":"2022-06-23T09:21:15.703952Z","file":"git.c","line":462,"scope":"local","param":"core.multipackindex","value":"true"}


> We also have GIT_TRACE2_ENV_VARS and trace2.envvars that will dump
> the values of "interesting" env vars.

> You can use these in your testing to log the config and env var
> values that you are interested in.

Wow, cool as GIT_TRACE2_CONFIG_PARAMS and trace2.configparams
you mentioned before. 

Thanks.
Previous: Jeff HostetlerNext: Jeff Hostetler
Message 50 of 128 in “trace2 output for bitmap decision path”
  1. 0/3 trace2 output for bitmap decision pathTeng Long, Mar 24, 2022
  2. 1/3 pack-bitmap.c: use "ret" in "open_midx_bitmap()"Teng Long, Mar 24, 2022
  3. Taylor BlauMar 24, 2022
  4. Teng LongMar 28, 2022
  5. Taylor BlauMar 30, 2022
  6. 2/3 pack-bitmap.c: add "break" statement in "open_pack_bitmap()"Teng Long, Mar 24, 2022
  7. Junio C HamanoMar 24, 2022
  8. Taylor BlauMar 24, 2022
  9. Taylor BlauMar 24, 2022
  10. Teng LongMar 29, 2022
  11. Taylor BlauMar 30, 2022
  12. Teng LongTeng Long, Mar 30, 2022
  13. Ævar Arnfjörð BjarmasonMar 30, 2022
  14. 3/3 bitmap: add trace outputs during open "bitmap" fileTeng Long, Mar 24, 2022
  15. Junio C HamanoMar 24, 2022
  16. Ævar Arnfjörð BjarmasonMar 24, 2022
  17. Teng LongTeng Long, Mar 29, 2022
  18. Ævar Arnfjörð BjarmasonMar 29, 2022
  19. 0/5 trace2 output for bitmap decision pathTeng Long, Apr 21, 2022
  20. 1/5 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Apr 21, 2022
  21. Taylor BlauMay 11, 2022
  22. 2/5 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Apr 21, 2022
  23. Taylor BlauMay 11, 2022
  24. 3/5 pack-bitmap.c: make warnings more detailed when opening bitmapTeng Long, Apr 21, 2022
  25. Taylor BlauApr 21, 2022
  26. Teng LongMay 6, 2022
  27. 5/5 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Apr 21, 2022
  28. Ævar Arnfjörð BjarmasonApr 21, 2022
  29. Teng LongMay 6, 2022
  30. 4/5 bitmap: add trace2 outputs during open "bitmap" fileTeng Long, Apr 21, 2022
  31. Ævar Arnfjörð BjarmasonApr 21, 2022
  32. Teng LongMay 6, 2022
  33. Teng LongMay 6, 2022
  34. Jeff HostetlerApr 21, 2022
  35. Teng LongMay 6, 2022
  36. Jeff HostetlerMay 10, 2022
  37. 0/5 trace2 output for bitmap decision pathTeng Long, Jun 12, 2022
  38. 1/5 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Jun 12, 2022
  39. 3/5 pack-bitmap.c: make warnings support i18N when opening bitmapTeng Long, Jun 12, 2022
  40. 2/5 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Jun 12, 2022
  41. 4/5 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Jun 12, 2022
  42. Taylor BlauJun 14, 2022
  43. Teng LongJun 20, 2022
  44. 5/5 bitmap: add trace2 outputs during open "bitmap" fileTeng Long, Jun 12, 2022
  45. Junio C HamanoJun 13, 2022
  46. Teng LongJun 20, 2022
  47. Taylor BlauJun 14, 2022
  48. Teng LongJun 21, 2022
  49. Jeff HostetlerJun 22, 2022
  50. Teng LongJun 23, 2022
  51. Jeff HostetlerJun 23, 2022
  52. Teng LongJun 24, 2022
  53. 0/5 trace2 output for bitmap decision pathTeng Long, Jun 21, 2022
  54. 1/5 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Jun 21, 2022
  55. 3/5 pack-bitmap.c: make warnings support i18N when opening bitmapTeng Long, Jun 21, 2022
  56. 2/5 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Jun 21, 2022
  57. 5/5 bitmap: add trace2 outputs during open "bitmap" fileTeng Long, Jun 21, 2022
  58. Jeff HostetlerJun 22, 2022
  59. Junio C HamanoJun 22, 2022
  60. 4/5 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Jun 21, 2022
  61. 0/5 tr2: avoid to print "interesting" config repeatedlyTeng Long, Jun 28, 2022
  62. 1/5 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Jun 28, 2022
  63. 2/5 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Jun 28, 2022
  64. 3/5 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Jun 28, 2022
  65. Junio C HamanoJun 28, 2022
  66. Teng LongJul 5, 2022
  67. Junio C HamanoJul 5, 2022
  68. 4/5 pack-bitmap.c: retrieve missing i18n translationsTeng Long, Jun 28, 2022
  69. Ævar Arnfjörð BjarmasonJun 28, 2022
  70. Eric SunshineJun 28, 2022
  71. Teng LongJul 6, 2022
  72. Teng LongJul 6, 2022
  73. Junio C HamanoJun 28, 2022
  74. Teng LongJul 7, 2022
  75. Junio C HamanoJul 7, 2022
  76. Teng LongJul 11, 2022
  77. 5/5 tr2: avoid to print "interesting" config repeatedlyTeng Long, Jun 28, 2022
  78. Ævar Arnfjörð BjarmasonJun 28, 2022
  79. Junio C HamanoJun 28, 2022
  80. Jeff HostetlerJul 1, 2022
  81. Teng LongJul 11, 2022
  82. Teng LongJul 11, 2022
  83. 0/7 trace2: dump scope when print "interesting" configTeng Long, Jul 11, 2022
  84. 1/7 clean: fixed issues related to text output formatTeng Long, Jul 11, 2022
  85. Junio C HamanoJul 11, 2022
  86. Teng LongJul 13, 2022
  87. 2/7 pack-bitmap.c: mark more strings for translationsTeng Long, Jul 11, 2022
  88. 3/7 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Jul 11, 2022
  89. 4/7 pack-bitmap.c: don't ignore ENOENT silentlyTeng Long, Jul 11, 2022
  90. Ævar Arnfjörð BjarmasonJul 11, 2022
  91. Teng LongJul 13, 2022
  92. Junio C HamanoJul 11, 2022
  93. Teng LongJul 14, 2022
  94. 5/7 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Jul 11, 2022
  95. Ævar Arnfjörð BjarmasonJul 11, 2022
  96. Teng LongJul 15, 2022
  97. 6/7 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Jul 11, 2022
  98. 7/7 tr2: dump names if config exist in multiple scopesTeng Long, Jul 11, 2022
  99. Ævar Arnfjörð BjarmasonJul 11, 2022
  100. Jeff HostetlerJul 11, 2022
  101. Ævar Arnfjörð BjarmasonJul 11, 2022
  102. Teng LongJul 18, 2022
  103. 0/7 trace2: dump scope when print "interesting" configTeng Long, Jul 18, 2022
  104. 1/7 pack-bitmap.c: fix formatting of error messagesTeng Long, Jul 18, 2022
  105. 2/7 pack-bitmap.c: mark more strings for translationsTeng Long, Jul 18, 2022
  106. 3/7 pack-bitmap.c: rename "idx_name" to "bitmap_name"Teng Long, Jul 18, 2022
  107. 4/7 pack-bitmap.c: do not ignore error when opening a bitmap fileTeng Long, Jul 18, 2022
  108. 5/7 pack-bitmap.c: using error() instead of silently returning -1Teng Long, Jul 18, 2022
  109. 6/7 pack-bitmap.c: continue looping when first MIDX bitmap is foundTeng Long, Jul 18, 2022
  110. 7/7 tr2: dump names if config exist in multiple scopesTeng Long, Jul 18, 2022
  111. Jeff HostetlerJul 18, 2022
  112. tenglong.tlJul 19, 2022
  113. Junio C HamanoJul 19, 2022
  114. tenglong.tlJul 20, 2022
  115. Junio C HamanoJul 18, 2022
  116. Ævar Arnfjörð BjarmasonJul 18, 2022
  117. tenglong.tlJul 19, 2022
  118. Ævar Arnfjörð BjarmasonJul 19, 2022
  119. tenglong.tlJul 19, 2022
  120. 0/6 pack-bitmap.c: optimize error messagestenglong.tl, Jul 21, 2022
  121. 1/6 pack-bitmap.c: fix formatting of error messagestenglong.tl, Jul 21, 2022
  122. 2/6 pack-bitmap.c: mark more strings for translationstenglong.tl, Jul 21, 2022
  123. 3/6 pack-bitmap.c: rename "idx_name" to "bitmap_name"tenglong.tl, Jul 21, 2022
  124. 4/6 pack-bitmap.c: do not ignore error when opening a bitmap filetenglong.tl, Jul 21, 2022
  125. 5/6 pack-bitmap.c: using error() instead of silently returning -1tenglong.tl, Jul 21, 2022
  126. 6/6 pack-bitmap.c: continue looping when first MIDX bitmap is foundtenglong.tl, Jul 21, 2022
  127. Junio C HamanoJul 21, 2022
  128. tenglong.tlJul 22, 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.