[ostree] pull: Print elapsed time
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Print elapsed time
- Date: Fri, 5 Oct 2012 21:21:35 +0000 (UTC)
commit 3c0fe011526db17ea0d71be32aea8cf579e4def6
Author: Colin Walters <walters verbum org>
Date: Fri Oct 5 17:20:40 2012 -0400
pull: Print elapsed time
src/ostree/ostree-pull.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index a618ee9..765976e 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]