mirror of
https://github.com/clearlinux/vm-timing-report.git
synced 2026-06-16 02:05:47 +00:00
5bfc504fda
Note Ubuntu does not currently use or properly support systemd, so we cannot obtain a nice systemd-analyze output. So for now we'll just emit the "uptime" number, which is entirely incorrect but cannot be helped, and is just a formatting placeholder until Ubuntu 14.10 stable supports systemd. Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
42 lines
1.0 KiB
Bash
42 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
# This file is part of vm-timing-report.
|
|
#
|
|
# Copyright (C) 2014 Intel Corporation
|
|
# Author: Ikey Doherty <michael.i.doherty@intel.com>
|
|
#
|
|
# vm-timing-eport is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation; either version 2 of the
|
|
# License, or (at your option) any later version.
|
|
|
|
OURID=""
|
|
for i in $(cat /proc/cmdline) ; do
|
|
case $i in
|
|
VMREPORTID*)
|
|
OURID=$i
|
|
;;
|
|
esac
|
|
done
|
|
|
|
while :
|
|
do
|
|
if [[ -e /usr/lib/upstart || ! -e /dev/virtio-ports/serial0 ]]; then
|
|
ANALYZE="`uptime`"
|
|
else
|
|
ANALYZE="`systemd-analyze`"
|
|
fi
|
|
if [[ $? -ne 0 ]]; then
|
|
# Must wait for systemd-analyze to report a boot time,
|
|
# otherwise this is not considered "booted"
|
|
sleep 0.2
|
|
continue
|
|
fi
|
|
echo "$OURID|||$ANALYZE" > /dev/virtio-ports/serial0
|
|
break
|
|
done
|
|
sync
|
|
|
|
sleep 3
|
|
poweroff
|