summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-11-09 14:16:21 +0000
committerRichard Jones <rjones@redhat.com>2009-11-10 16:32:20 +0000
commit3ae742c1498b8839250be295173d76b9c5731ed1 (patch)
tree3547860ed9d985b59b4f3465dec2cbc09dd1fd69 /src
parent28d74ee234bebaab552a662eb0700a36413b68b5 (diff)
downloadlibguestfs-3ae742c1498b8839250be295173d76b9c5731ed1.tar.gz
libguestfs-3ae742c1498b8839250be295173d76b9c5731ed1.tar.xz
libguestfs-3ae742c1498b8839250be295173d76b9c5731ed1.zip
Record time of guest launch.
The guest handle field start_t was previously used (when we had the wait_ready call), but had fallen into disuse. Note that it could never be accessed through the API. Rename this field as launch_t, convert it to a timeval, and use it to measure the time since guestfs_launch was called so that we can start profiling guest launch.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index 65c68c88..db291bdc 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -107,7 +107,8 @@ struct guestfs_h
int sock; /* Daemon communications socket. */
pid_t pid; /* Qemu PID. */
pid_t recoverypid; /* Recovery process PID. */
- time_t start_t; /* The time when we started qemu. */
+
+ struct timeval launch_t; /* The time that we called guestfs_launch. */
char *tmpdir; /* Temporary directory containing socket. */
@@ -876,6 +877,9 @@ guestfs__launch (guestfs_h *g)
char unixsock[256];
struct sockaddr_un addr;
+ /* Start the clock ... */
+ gettimeofday (&g->launch_t, NULL);
+
#ifdef P_tmpdir
tmpdir = P_tmpdir;
#else
@@ -1264,9 +1268,6 @@ guestfs__launch (guestfs_h *g)
g->recoverypid = r;
}
- /* Start the clock ... */
- time (&g->start_t);
-
if (!g->direct) {
/* Close the other ends of the pipe. */
close (wfd[0]);
@@ -1414,7 +1415,7 @@ guestfs__launch (guestfs_h *g)
g->fd[1] = -1;
g->pid = 0;
g->recoverypid = 0;
- g->start_t = 0;
+ memset (&g->launch_t, 0, sizeof g->launch_t);
cleanup0:
if (g->sock >= 0) {
@@ -1840,7 +1841,7 @@ child_cleanup (guestfs_h *g)
g->sock = -1;
g->pid = 0;
g->recoverypid = 0;
- g->start_t = 0;
+ memset (&g->launch_t, 0, sizeof g->launch_t);
g->state = CONFIG;
if (g->subprocess_quit_cb)
g->subprocess_quit_cb (g, g->subprocess_quit_cb_data);