From 3c0fe011526db17ea0d71be32aea8cf579e4def6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 5 Oct 2012 17:20:40 -0400 Subject: [PATCH] pull: Print elapsed time --- src/ostree/ostree-pull.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c index a618ee99..765976e9 100644 --- a/src/ostree/ostree-pull.c +++ b/src/ostree/ostree-pull.c @@ -1185,6 +1185,8 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) GKeyFile *remote_config = NULL; char **configured_branches = NULL; guint64 bytes_transferred; + guint64 start_time; + guint64 end_time; memset (pull_data, 0, sizeof (*pull_data)); @@ -1214,6 +1216,8 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) goto out; } + start_time = g_get_monotonic_time (); + pull_data->stdout_is_tty = isatty (1); pull_data->remote_name = g_strdup (argv[1]); @@ -1406,6 +1410,8 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) g_print ("remote %s is now %s\n", remote_ref, checksum); } + end_time = g_get_monotonic_time (); + bytes_transferred = ostree_fetcher_bytes_transferred (pull_data->fetcher); if (bytes_transferred > 0) { @@ -1414,10 +1420,11 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) shift = 1; else shift = 1024; - g_print ("%u metadata, %u content objects fetched; %" G_GUINT64_FORMAT " %s transferred\n", + g_print ("%u metadata, %u content objects fetched; %" G_GUINT64_FORMAT " %s transferred in %u seconds\n", pull_data->n_fetched_metadata, pull_data->n_fetched_content, (guint64)(bytes_transferred / shift), - shift == 1 ? "B" : "KiB"); + shift == 1 ? "B" : "KiB", + (guint) ((end_time - start_time) / G_USEC_PER_SEC)); } ret = TRUE;