aboutsummaryrefslogtreecommitdiffstats
path: root/progress.c
diff options
context:
space:
mode:
authorEmily Shaffer <emilyshaffer@google.com>2020-05-12 14:44:20 -0700
committerJunio C Hamano <gitster@pobox.com>2020-05-12 15:30:39 -0700
commit98a136474082cdc7228d7e0e45672c5274fab701 (patch)
tree008d37ad3da3f53594d21a992a92ad1bda10aa98 /progress.c
parentb994622632154fc3b17fb40a38819ad954a5fb88 (diff)
downloadgit-98a136474082cdc7228d7e0e45672c5274fab701.tar.gz
trace2: log progress time and throughput
Rather than teaching only one operation, like 'git fetch', how to write down throughput to traces, we can learn about a wide range of user operations that may seem slow by adding tooling to the progress library itself. Operations which display progress are likely to be slow-running and the kind of thing we want to monitor for performance anyways. By showing object counts and data transfer size, we should be able to make some derived measurements to ensure operations are scaling the way we expect. Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'progress.c')
-rw-r--r--progress.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/progress.c b/progress.c
index 75633e9c5e..6d2dcff0b6 100644
--- a/progress.c
+++ b/progress.c
@@ -265,6 +265,7 @@ static struct progress *start_progress_delay(const char *title, uint64_t total,
progress->title_len = utf8_strwidth(title);
progress->split = 0;
set_progress_signal();
+ trace2_region_enter("progress", title, the_repository);
return progress;
}
@@ -320,6 +321,22 @@ void stop_progress(struct progress **p_progress)
{
finish_if_sparse(*p_progress);
+ if (p_progress && *p_progress) {
+ trace2_data_intmax("progress", the_repository, "total_objects",
+ (*p_progress)->total);
+
+ if ((*p_progress)->throughput)
+ trace2_data_intmax("progress", the_repository,
+ "total_bytes",
+ (*p_progress)->throughput->curr_total);
+ }
+
+ trace2_region_leave("progress",
+ p_progress && *p_progress
+ ? (*p_progress)->title
+ : NULL,
+ the_repository);
+
stop_progress_msg(p_progress, _("done"));
}