From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Drastic jump in the time required for the test suite
Date: Thu, 20 Oct 2016 17:00:13 -0400 [thread overview]
Message-ID: <20161020210013.57wkyhmf2ism6vt2@sigill.intra.peff.net> (raw)
In-Reply-To: <CAGZ79ka_McRkOyKH3diCXJSdCm+4pNZfqAqJW_tQLFdhb26tRQ@mail.gmail.com>
On Thu, Oct 20, 2016 at 09:30:27AM -0700, Stefan Beller wrote:
> On Thu, Oct 20, 2016 at 5:31 AM, Jeff King <peff@peff.net> wrote:
>
> >
> > $ perl -lne '/execve\("(.*?)"/ and print $1' /tmp/foo.out | sort | uniq -c | sort -rn | head
> > 152271 /home/peff/compile/git/git
> > 57340 /home/peff/compile/git/t/../bin-wrappers/git
> > 16865 /bin/sed
> > 12650 /bin/rm
> > 11257 /bin/cat
> > 9326 /home/peff/compile/git/git-sh-i18n--envsubst
> > 9079 /usr/bin/diff
> > 8013 /usr/bin/wc
> > 5924 /bin/mv
> > 4566 /bin/grep
> >
>
> I am not an expert on perl nor tracing, but is it feasible to find out
> how many internal calls there are? i.e. either some shell script (rebase,
> submodule) calling git itself a couple of times or even from compile/git/git
> itself, e.g. some submodule operations use forking in there.
The script below is my attempt, though I think it is not quite right, as
"make" should be the single apex of the graph. You can run it like:
strace -f -o /tmp/foo.out -e clone,execve make test
perl graph.pl /tmp/foo.out | less -S
One thing that it counts (that was not counted above) is the number of
forks for subshells, which is considerable. I don't know how expensive
that is versus, say, running "cat" (if your fork() doesn't
copy-on-write, and you implement sub-programs via an efficient spawn()
call, it's possible that the subshells are significantly more
expensive).
-Peff
-- >8 --
#!/usr/bin/perl
my %clone;
my %exec;
my %is_child;
my %counter;
while (<>) {
# <pid> execve("some-prog", ...
if (/^(\d+)\s+execve\("(.*?)"/) {
push @{$exec{node($1)}}, $2;
}
# <pid> clone(...) = <child>
# or
# <pid> <... clone resumed> ...) = <child>
elsif (/^(\d+)\s+.*clone.*\) = (\d+)$/) {
push @{$clone{node($1)}}, node($2);
$is_child{node($2)} = 1;
}
# <pid> +++ exited with <code> +++
# We have to keep track of this because pids get recycled,
# and so are not unique node names in our graph.
elsif (/^(\d+)\s+.*exited with/) {
$counter{$1}++;
}
}
show($_, 0) for grep { !$is_child{$_} } keys(%clone);
sub show {
my ($pid, $indent) = @_;
my @progs = @{$exec{$pid}};
if (!@progs) {
@progs = ("(fork)");
}
print ' ' x $indent;
print "$pid: ", shift @progs;
print " => $_" for @progs;
print "\n";
show($_, $indent + 2) for @{$clone{$pid}};
}
sub node {
my $pid = shift;
my $c = $counter{$pid} || "0";
return "$pid-$c";
}
next prev parent reply other threads:[~2016-10-20 21:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 9:18 Drastic jump in the time required for the test suite Johannes Schindelin
2016-10-19 17:32 ` Junio C Hamano
2016-10-19 20:56 ` Jeff King
2016-10-20 10:50 ` Johannes Schindelin
2016-10-20 11:39 ` Jeff King
2016-10-20 19:54 ` Stefan Beller
2016-10-20 21:38 ` Jeff King
2016-10-20 21:53 ` Stefan Beller
2016-10-20 21:57 ` Jeff King
2016-10-20 21:56 ` Jeff King
2016-10-21 5:27 ` Johannes Sixt
2016-10-21 8:24 ` Jeff King
2016-10-20 10:17 ` Johannes Schindelin
2016-10-20 12:31 ` Jeff King
2016-10-20 16:30 ` Stefan Beller
2016-10-20 21:00 ` Jeff King [this message]
2016-10-20 23:20 ` Jeff King
2016-10-20 20:38 ` Johannes Sixt
2016-10-20 21:03 ` Jeff King
2016-10-20 20:40 ` Dennis Kaarsemaker
2016-10-21 11:03 ` Duy Nguyen
2016-10-20 16:16 ` Junio C Hamano
2016-10-20 17:13 ` Matthieu Moy
2016-10-20 11:02 ` Duy Nguyen
2016-10-20 16:40 ` René Scharfe
2016-10-21 10:59 ` Duy Nguyen
2016-10-21 20:28 ` René Scharfe
2016-10-21 13:10 ` Matthieu Moy
2016-10-21 19:57 ` René Scharfe
2016-10-27 20:41 ` Eric Wong
2016-10-28 6:38 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161020210013.57wkyhmf2ism6vt2@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).