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

Re: [PATCH v2 1/1] trace2: write to directory targets

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2019, 03:30 UTC
Message-ID
<xmqqpnqjr3g0.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<51e88650-8667-df1f-13ef-4537f2e70346@jeffhostetler.com>
Jeff Hostetler <git@jeffhostetler.com> writes:
Show 12 quoted lines
>>> +	for (attempt_count = 0; attempt_count < MAX_RANDOM_ATTEMPTS; attempt_count++) {
>>> +		strbuf_reset(&final_path);
>>> +		strbuf_addbuf(&final_path, &base_path);
>>> +		strbuf_addf(&final_path, ".%d", attempt_count);
>
> Since the last component of the SID is already very unique and
> we're unlikely to have collisions, maybe change the above line to:
>
> 		if (attempt_count > 0)
> 			strbuf_addf(&final_path, ".%d", attempt_count);
>
> and in reality expect to never have files with the suffix.
That's a nice property.
> Unless, that is, they turned on more than one of GIT_TR2,
> GIT_TR2_PERF, or GIT_TR2_EVENT and pointed them at the same
> directory, but I'm not sure if I care about that edge case
> or not.

That actually makes me wonder if the auto generated filenames want to have a common trait (e.g. suffix) that allows the readers to tell from which of these environment variables the names came from. It would not be very useful if two files with the same sid component had .1 suffix for GIT_TR2 trace for one session, and the same .1 suffix is used for GIT_TR2_PERF trace for a pair of files from another session.

But let's not worry about it for now. If people do not want them get mixed up and become hard to tell apart, they can always specify different directories for different traces.

Show 6 quoted lines
>
>>> +		fd = open(final_path.buf, O_WRONLY | O_CREAT | O_EXCL, 0666);
> [...]
>
> Nice.  Thanks for looking into this.
> Jeff
Previous: Jeff HostetlerNext: Jeff Hostetler
Message 23 of 34 in “Randomize / timestamp trace2 targets”
  1. 0/2 Randomize / timestamp trace2 targetsJosh Steadmon, Mar 13, 2019
  2. 1/2 date: make get_time() publicJosh Steadmon, Mar 13, 2019
  3. 2/2 trace2: randomize/timestamp trace2 targetsJosh Steadmon, Mar 13, 2019
  4. Ævar Arnfjörð BjarmasonMar 13, 2019
  5. Jeff HostetlerMar 15, 2019
  6. Ævar Arnfjörð BjarmasonMar 15, 2019
  7. Jeff HostetlerMar 15, 2019
  8. Josh SteadmonMar 15, 2019
  9. Josh SteadmonMar 15, 2019
  10. Junio C HamanoMar 18, 2019
  11. Jeff KingMar 19, 2019
  12. Jeff KingMar 14, 2019
  13. Junio C HamanoMar 14, 2019
  14. Johannes SchindelinMar 14, 2019
  15. Josh SteadmonMar 15, 2019
  16. Jeff HostetlerMar 15, 2019
  17. Josh SteadmonMar 15, 2019
  18. Jeff HostetlerMar 18, 2019
  19. 0/1 Write trace2 output to directoriesJosh Steadmon, Mar 21, 2019
  20. 1/1 trace2: write to directory targetsJosh Steadmon, Mar 21, 2019
  21. Junio C HamanoMar 21, 2019
  22. Jeff HostetlerMar 21, 2019
  23. Junio C HamanoMar 22, 2019
  24. Jeff HostetlerMar 22, 2019
  25. 0/1 Write trace2 output to directoriesJosh Steadmon, Mar 21, 2019
  26. 1/1 trace2: write to directory targetsJosh Steadmon, Mar 21, 2019
  27. Ævar Arnfjörð BjarmasonMar 23, 2019
  28. Junio C HamanoMar 24, 2019
  29. Ævar Arnfjörð BjarmasonMar 24, 2019
  30. Junio C HamanoMar 25, 2019
  31. Ævar Arnfjörð BjarmasonMar 25, 2019
  32. Jeff HostetlerMar 25, 2019
  33. Jeff HostetlerMar 21, 2019
  34. Junio C HamanoMar 22, 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.