On Fri, Oct 29, 2010 at 04:43:19PM +0800, Osier Yang wrote: > Currently only record timestamps for domain start and shutdown, for > domain start, record timestamps before qemu command line, for domain > shutdown, just says it's shutting down. > > * src/qemu/qemu_driver.c (qemudStartVMDaemon, qemudShutdownVMDaemon) > --- > src/qemu/qemu_driver.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 60 insertions(+), 2 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 1eea3a9..89b4d11 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -3828,6 +3828,10 @@ static int qemudStartVMDaemon(virConnectPtr conn, > char ebuf[1024]; > char *pidfile = NULL; > int logfile = -1; > + struct timeval cur_time; > + struct tm time_info; > + char timestr[100]; > + char *timestamp; > qemuDomainObjPrivatePtr priv = vm->privateData; > > struct qemudHookData hookData; > @@ -4015,7 +4019,27 @@ static int qemudStartVMDaemon(virConnectPtr conn, > goto cleanup; > } > > + gettimeofday(&cur_time, NULL); > + localtime_r(&cur_time.tv_sec, &time_info); > + > + strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", &time_info); > + > + if (virAsprintf(×tamp, "%s.%3d: ", > + timestr, (int) cur_time.tv_usec / 1000) < 0) { > + VIR_FREE(timestamp); > + virReportOOMError(); > + goto cleanup; > + } This is a rather unwieldly block of code, that is just dieing to have a helper function in src/util, so we don't need to duplicate it everywhere Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list