From: Karsten Blees <karsten.blees@gmail.com>
To: Git List <git@vger.kernel.org>
Subject: [PATCH (performance tracing)] test git-status performance
Date: Wed, 25 Jun 2014 00:56:40 +0200 [thread overview]
Message-ID: <53AA0228.4080600@gmail.com> (raw)
In-Reply-To: <53AA0129.1080109@gmail.com>
Add trace_performance output to functions involved in git-status.
Signed-off-by: Karsten Blees <blees@dcon.de>
---
Applies on top of performance-tracing topic.
builtin/commit.c | 8 ++++++++
preload-index.c | 4 ++++
read-cache.c | 2 ++
wt-status.c | 11 +++++++++++
4 files changed, 25 insertions(+)
diff --git a/builtin/commit.c b/builtin/commit.c
index 94eb8a3..6a38fa2 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1322,9 +1322,11 @@ static int git_status_config(const char *k, const char *v, void *cb)
int cmd_status(int argc, const char **argv, const char *prefix)
{
+ uint64_t start = getnanotime();
static struct wt_status s;
int fd;
unsigned char sha1[20];
+
static struct option builtin_status_options[] = {
OPT__VERBOSE(&verbose, N_("be verbose")),
OPT_SET_INT('s', "short", &status_format,
@@ -1369,13 +1371,19 @@ int cmd_status(int argc, const char **argv, const char *prefix)
PATHSPEC_PREFER_FULL,
prefix, argv);
+ trace_performance_since(start, "cmd_status:setup");
+
read_cache_preload(&s.pathspec);
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
+ start = getnanotime();
+
fd = hold_locked_index(&index_lock, 0);
if (0 <= fd)
update_index_if_able(&the_index, &index_lock);
+ trace_performance_since(start, "cmd_status:update_index");
+
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
s.ignore_submodule_arg = ignore_submodule_arg;
wt_status_collect(&s);
diff --git a/preload-index.c b/preload-index.c
index 968ee25..189c5a4 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -33,6 +33,7 @@ struct thread_data {
static void *preload_thread(void *_data)
{
+ uint64_t start = getnanotime();
int nr;
struct thread_data *p = _data;
struct index_state *index = p->index;
@@ -64,6 +65,7 @@ static void *preload_thread(void *_data)
continue;
ce_mark_uptodate(ce);
} while (--nr > 0);
+ trace_performance_since(start, "preload_thread");
return NULL;
}
@@ -106,8 +108,10 @@ static void preload_index(struct index_state *index,
int read_index_preload(struct index_state *index,
const struct pathspec *pathspec)
{
+ uint64_t start = getnanotime();
int retval = read_index(index);
preload_index(index, pathspec);
+ trace_performance_since(start, "read_index_preload");
return retval;
}
diff --git a/read-cache.c b/read-cache.c
index 132d032..5c6b763 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1136,6 +1136,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
const struct pathspec *pathspec,
char *seen, const char *header_msg)
{
+ uint64_t start = getnanotime();
int i;
int has_errors = 0;
int really = (flags & REFRESH_REALLY) != 0;
@@ -1222,6 +1223,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
replace_index_entry(istate, i, new);
}
+ trace_performance_since(start, "refresh_index");
return has_errors;
}
diff --git a/wt-status.c b/wt-status.c
index 318a191..a744565 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -623,13 +623,24 @@ static void wt_status_collect_untracked(struct wt_status *s)
void wt_status_collect(struct wt_status *s)
{
+ uint64_t start = getnanotime();
+
wt_status_collect_changes_worktree(s);
+ trace_performance_since(start, "wt_status_collect_changes_worktree");
+ start = getnanotime();
+
if (s->is_initial)
wt_status_collect_changes_initial(s);
else
wt_status_collect_changes_index(s);
+
+ trace_performance_since(start, "wt_status_collect_changes_index");
+ start = getnanotime();
+
wt_status_collect_untracked(s);
+
+ trace_performance_since(start, "wt_status_collect_untracked");
}
static void wt_status_print_unmerged(struct wt_status *s)
--
1.9.4.msysgit.0.1.gc8a51b4
next prev parent reply other threads:[~2014-06-24 22:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 22:52 Git-status / preload_index() performance Karsten Blees
2014-06-24 22:53 ` [PATCH] preload-index: optimize for sequential IO Karsten Blees
2014-06-24 22:54 ` [PATCH (experimental)] preload-index: make parallel IO configurable Karsten Blees
2014-06-24 22:56 ` Karsten Blees [this message]
2014-06-26 12:30 ` [PATCH (performance tracing)] test git-status performance Duy Nguyen
2014-07-26 9:59 ` Duy Nguyen
2014-07-26 10:33 ` Duy Nguyen
2014-06-24 23:12 ` Git-status / preload_index() performance David Turner
2014-06-24 23:25 ` Karsten Blees
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53AA0228.4080600@gmail.com \
--to=karsten.blees@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).