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

Re: [PATCH v2] trace2: don't include "fsync" events in all trace2 logs

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 30, 2022, 20:45 UTC
Message-ID
<xmqqczepev8e.fsf@gitster.g>
In-Reply-To
<patch-v2-1.1-a1fc37de947-20220630T084607Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> As we're needing to indent the trace2_data_intmax() lines let's
> introduce helper variables to ensure that our resulting lines (which
> were already too) don't exceed the recommendations of the
too -> too something
Show 5 quoted lines
> +    elsif ($event eq 'data_json') {
> +	# NEEDSWORK: Ignore due to
> +	# compat/win32/trace2_win32_process_info.c, which should log a
> +	# "cmd_ancestry" event instead.
> +    }
This does read better.
Show 12 quoted lines
>  void trace_git_fsync_stats(void)
>  {
> -	trace2_data_intmax("fsync", the_repository, "fsync/writeout-only", count_fsync_writeout_only);
> -	trace2_data_intmax("fsync", the_repository, "fsync/hardware-flush", count_fsync_hardware_flush);
> +	const struct repository *r = the_repository;
> +	const intmax_t cfwo = count_fsync_writeout_only;
> +	const intmax_t cfhf = count_fsync_hardware_flush;
> +
> +	if (cfwo)
> +		trace2_data_intmax("fsync", r, "fsync/writeout-only", cfwo);
> +	if (cfhf)
> +		trace2_data_intmax("fsync", r, "fsync/hardware-flush", cfhf);

I would have wrapped the lines instead of introducing these extra variables; the key observation is that it would make a much easier pattern to follow for a future developer who needs to add the third kind of "fsync" on top of the existing wo and hf.

But we can address that when somebody actually adds the third one, so let's take the patch as-is.

Thanks.
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 5 of 8 in “trace2: don't include "fsync" events in all trace2 logs”
  1. trace2: don't include "fsync" events in all trace2 logsÆvar Arnfjörð Bjarmason, Jun 23, 2022
  2. Neeraj Singh (WINDOWS-SFS)Jun 23, 2022
  3. Junio C HamanoJun 23, 2022
  4. trace2: don't include "fsync" events in all trace2 logsÆvar Arnfjörð Bjarmason, Jun 30, 2022
  5. Junio C HamanoJun 30, 2022
  6. trace2: only include "fsync" events if we git_fsync()Ævar Arnfjörð Bjarmason, Jul 18, 2022
  7. Junio C HamanoJul 18, 2022
  8. Neeraj Singh (WINDOWS-SFS)Jul 18, 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.