<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/trace.c, branch v2.2.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.2.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.2.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-10-16T21:16:45Z</updated>
<entry>
<title>Merge branch 'bw/trace-no-inline-getnanotime'</title>
<updated>2014-10-16T21:16:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-10-16T21:16:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c11dc64722fc0bb496efb1b6de87012a132c04fc'/>
<id>urn:sha1:c11dc64722fc0bb496efb1b6de87012a132c04fc</id>
<content type='text'>
No file-scope static variables in an inlined function, please.

* bw/trace-no-inline-getnanotime:
  trace.c: do not mark getnanotime() as "inline"
</content>
</entry>
<entry>
<title>trace.c: do not mark getnanotime() as "inline"</title>
<updated>2014-09-29T23:13:58Z</updated>
<author>
<name>Ben Walton</name>
<email>bdwalton@gmail.com</email>
</author>
<published>2014-09-28T07:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6433d569753e8d33d3f7beca16a65f2fc481aade'/>
<id>urn:sha1:6433d569753e8d33d3f7beca16a65f2fc481aade</id>
<content type='text'>
Oracle Studio compilers don't allow for static variables in
functions that are defined to be inline. GNU C does permit this.

Let's reference the C99 standard though, which doesn't allow for
inline functions to contain modifiable static variables.

Signed-off-by: Ben Walton &lt;bdwalton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'kb/perf-trace'</title>
<updated>2014-09-19T18:38:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ee9c9d068d841908c7022aad566096be8a439a9'/>
<id>urn:sha1:9ee9c9d068d841908c7022aad566096be8a439a9</id>
<content type='text'>
Compilation fix for some compilers.

* kb/perf-trace:
  trace: correct trace_strbuf() parameter type for !HAVE_VARIADIC_MACROS
</content>
</entry>
<entry>
<title>trace: correct trace_strbuf() parameter type for !HAVE_VARIADIC_MACROS</title>
<updated>2014-09-08T18:08:04Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-09-06T20:53:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=792a646a194deb146de72022cf92882fe2fde8b9'/>
<id>urn:sha1:792a646a194deb146de72022cf92882fe2fde8b9</id>
<content type='text'>
Reported-by: dev &lt;dev@cor0.com&gt;
Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/strbuf-getcwd'</title>
<updated>2014-09-02T20:28:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-02T20:27:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf'/>
<id>urn:sha1:f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf</id>
<content type='text'>
Reduce the use of fixed sized buffer passed to getcwd() calls
by introducing xgetcwd() helper.

* rs/strbuf-getcwd:
  use strbuf_add_absolute_path() to add absolute paths
  abspath: convert absolute_path() to strbuf
  use xgetcwd() to set $GIT_DIR
  use xgetcwd() to get the current directory or die
  wrapper: add xgetcwd()
  abspath: convert real_path_internal() to strbuf
  abspath: use strbuf_getcwd() to remember original working directory
  setup: convert setup_git_directory_gently_1 et al. to strbuf
  unix-sockets: use strbuf_getcwd()
  strbuf: add strbuf_getcwd()
</content>
</entry>
<entry>
<title>use xgetcwd() to get the current directory or die</title>
<updated>2014-08-26T18:06:06Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-07-28T18:30:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=56b9f6e738af6f5238f57a29e96103cf61e3f8cd'/>
<id>urn:sha1:56b9f6e738af6f5238f57a29e96103cf61e3f8cd</id>
<content type='text'>
Convert several calls of getcwd() and die() to use xgetcwd() instead.
This way we get rid of fixed-size buffers (which can be too small
depending on the used file system) and gain consistent error messages.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git: add performance tracing for git's main() function to debug scripts</title>
<updated>2014-07-14T04:25:21Z</updated>
<author>
<name>Karsten Blees</name>
<email>karsten.blees@gmail.com</email>
</author>
<published>2014-07-12T00:07:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=578da0391a7958510b960eaf1ef30d13e791554e'/>
<id>urn:sha1:578da0391a7958510b960eaf1ef30d13e791554e</id>
<content type='text'>
Use trace_performance to measure and print execution time and command line
arguments of the entire main() function. In constrast to the shell's 'time'
utility, which measures total time of the parent process, this logs all
involved git commands recursively. This is particularly useful to debug
performance issues of scripted commands (i.e. which git commands were
called with which parameters, and how long did they execute).

Due to git's deliberate use of exit(), the implementation uses an atexit
routine rather than just adding trace_performance_since() at the end of
main().

Usage example: &gt; GIT_TRACE_PERFORMANCE=~/git-trace.log git stash list

Creates a log file like this:
23:57:38.638765 trace.c:405 performance: 0.000310107 s: git command: 'git' 'rev-parse' '--git-dir'
23:57:38.644387 trace.c:405 performance: 0.000261759 s: git command: 'git' 'rev-parse' '--show-toplevel'
23:57:38.646207 trace.c:405 performance: 0.000304468 s: git command: 'git' 'config' '--get-colorbool' 'color.interactive'
23:57:38.648491 trace.c:405 performance: 0.000241667 s: git command: 'git' 'config' '--get-color' 'color.interactive.help' 'red bold'
23:57:38.650465 trace.c:405 performance: 0.000243063 s: git command: 'git' 'config' '--get-color' '' 'reset'
23:57:38.654850 trace.c:405 performance: 0.025126313 s: git command: 'git' 'stash' 'list'

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trace: add trace_performance facility to debug performance issues</title>
<updated>2014-07-14T04:25:20Z</updated>
<author>
<name>Karsten Blees</name>
<email>karsten.blees@gmail.com</email>
</author>
<published>2014-07-12T00:06:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09b2c1c769a69d3ff03ee7913fa50fa05b4f5a46'/>
<id>urn:sha1:09b2c1c769a69d3ff03ee7913fa50fa05b4f5a46</id>
<content type='text'>
Add trace_performance and trace_performance_since macros that print a
duration and an optional printf-formatted text to the file specified in
environment variable GIT_TRACE_PERFORMANCE.

These macros, in conjunction with getnanotime(), are intended to simplify
performance measurements from within the application (i.e. profiling via
manual instrumentation, rather than using an external profiling tool).

Unless enabled via GIT_TRACE_PERFORMANCE, these macros have no noticeable
impact on performance, so that test code for well known time killers may
be shipped in release builds. Alternatively, a developer could provide an
additional performance patch (not meant for master) that allows reviewers
to reproduce performance tests more easily, e.g. on other platforms or
using their own repositories.

Usage examples:

Simple use case (measure one code section):

  uint64_t start = getnanotime();
  /* code section to measure */
  trace_performance_since(start, "foobar");

Complex use case (measure repetitive code sections):

  uint64_t t = 0;
  for (;;) {
    /* ignore */
    t -= getnanotime();
    /* code section to measure */
    t += getnanotime();
    /* ignore */
  }
  trace_performance(t, "frotz");

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trace: add high resolution timer function to debug performance issues</title>
<updated>2014-07-14T04:25:20Z</updated>
<author>
<name>Karsten Blees</name>
<email>karsten.blees@gmail.com</email>
</author>
<published>2014-07-12T00:05:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=148d6771bf5e00aa1d7fa2221507a3dfe4c1e37f'/>
<id>urn:sha1:148d6771bf5e00aa1d7fa2221507a3dfe4c1e37f</id>
<content type='text'>
Add a getnanotime() function that returns nanoseconds since 01/01/1970 as
unsigned 64-bit integer (i.e. overflows in july 2554). This is easier to
work with than e.g. struct timeval or struct timespec. Basing the timer on
the epoch allows using the results with other time-related APIs.

To simplify adaption to different platforms, split the implementation into
a common getnanotime() and a platform-specific highres_nanos() function.

The common getnanotime() function handles errors, falling back to
gettimeofday() if highres_nanos() isn't implemented or doesn't work.

getnanotime() is also responsible for normalizing to the epoch. The offset
to the system clock is calculated only once on initialization, i.e.
manually setting the system clock has no impact on the timer (except if
the fallback gettimeofday() is in use). Git processes are typically short
lived, so we don't need to handle clock drift.

The highres_nanos() function returns monotonically increasing nanoseconds
relative to some arbitrary point in time (e.g. system boot), or 0 on
failure. Providing platform-specific implementations should be relatively
easy, e.g. adapting to clock_gettime() as defined by the POSIX realtime
extensions is seven lines of code.

This version includes highres_nanos() implementations for:
 * Linux: using clock_gettime(CLOCK_MONOTONIC)
 * Windows: using QueryPerformanceCounter()

Todo:
 * enable clock_gettime() on more platforms
 * add Mac OSX version, e.g. using mach_absolute_time + mach_timebase_info

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>trace: add 'file:line' to all trace output</title>
<updated>2014-07-14T04:25:20Z</updated>
<author>
<name>Karsten Blees</name>
<email>karsten.blees@gmail.com</email>
</author>
<published>2014-07-12T00:05:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e05bed960d3bf3bcfd0f27ab882df3da93e118ed'/>
<id>urn:sha1:e05bed960d3bf3bcfd0f27ab882df3da93e118ed</id>
<content type='text'>
This is useful to see where trace output came from.

Add 'const char *file, int line' parameters to the printing functions and
rename them to *_fl.

Add trace_printf* and trace_strbuf macros resolving to the *_fl functions
and let the preprocessor fill in __FILE__ and __LINE__.

As the trace_printf* functions take a variable number of arguments, this
requires variadic macros (i.e. '#define foo(...) foo_impl(__VA_ARGS__)'.
Though part of C99, it is unclear whether older compilers support this.
Thus keep the old functions and only enable variadic macros for GNUC and
MSVC 2005+ (_MSC_VER 1400). This has the nice side effect that the old
C-style declarations serve as documentation how the macros are to be used.

Print 'file:line ' as prefix to each trace line. Align the remaining trace
output at column 40 to accommodate 18 char file names + 4 digit line
number (currently there are 30 *.c files of length 18 and just 11 of 19).
Trace output from longer source files (e.g. builtin/receive-pack.c) will
not be aligned.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
