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

Re: [RFC/PATCH v4 3/3] add command performance tracing to debug scripted commands

From
Junio C Hamano <gitster@pobox.com>
Date
May 21, 2014, 17:38 UTC
Message-ID
<xmqq1tvnqbga.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140521165508.GC2040@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Tue, May 20, 2014 at 09:11:24PM +0200, Karsten Blees wrote:
>
>> Add performance tracing to identify which git commands are called and how
>> long they execute. This is particularly useful to debug performance issues
>> of scripted commands.
>> 
>> Usage example: > GIT_TRACE_PERFORMANCE=~/git-trace.log git stash list
>> 
>> Creates a log file like this:
>> performance: at trace.c:319, time: 0.000303280 s: git command: 'git' 'rev-parse' '--git-dir'
>> performance: at trace.c:319, time: 0.000334409 s: git command: 'git' 'rev-parse' '--is-inside-work-tree'
>> performance: at trace.c:319, time: 0.000215243 s: git command: 'git' 'rev-parse' '--show-toplevel'
>> performance: at trace.c:319, time: 0.000410639 s: git command: 'git' 'config' '--get-colorbool' 'color.interactive'
>> performance: at trace.c:319, time: 0.000394077 s: git command: 'git' 'config' '--get-color' 'color.interactive.help' 'red bold'
>> performance: at trace.c:319, time: 0.000280701 s: git command: 'git' 'config' '--get-color' '' 'reset'
>> performance: at trace.c:319, time: 0.000908185 s: git command: 'git' 'rev-parse' '--verify' 'refs/stash'
>> performance: at trace.c:319, time: 0.028827774 s: git command: 'git' 'stash' 'list'
>
> Neat. I actually wanted something like this just yesterday. It looks
> like you are mainly tracing the execution of programs. Would it make
> sense to just tie this to regular trace_* calls, and if
> GIT_TRACE_PERFORMANCE is set, add a timestamp to each line?

Yeah, I very much like both, the output and your suggestion to hook it into the existing infrastructure.

Show 7 quoted lines
> Then we would not need to add separate trace_command_performance calls,
> and other parts of the code that are already instrumented with GIT_TRACE
> would get the feature for free.
>
> -Peff
>
> -- 
Previous: Jeff KingNext: Karsten Blees
Message 13 of 17 in “add high resolution timer function to debug performance issues”
  1. 1/3 add high resolution timer function to debug performance issuesKarsten Blees, May 20, 2014
  2. Noel GrandinMay 21, 2014
  3. Karsten BleesMay 21, 2014
  4. Richard HansenMay 21, 2014
  5. Richard HansenMay 21, 2014
  6. Karsten BleesMay 22, 2014
  7. 2/3 add trace_performance facility to debug performance issuesKarsten Blees, May 20, 2014
  8. Jeff KingMay 21, 2014
  9. Karsten BleesMay 21, 2014
  10. Jeff KingMay 21, 2014
  11. 3/3 add command performance tracing to debug scripted commandsKarsten Blees, May 20, 2014
  12. Jeff KingMay 21, 2014
  13. Junio C HamanoMay 21, 2014
  14. Karsten BleesMay 22, 2014
  15. Jeff KingMay 22, 2014
  16. Karsten BleesMay 23, 2014
  17. Jeff KingMay 23, 2014

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.