summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-07-31 10:15:40 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-08-03 01:12:53 -0400
commit9a6f36c08f1ff93ff861e6371e081122a564c900 (patch)
tree78a32593b1ddeac270126f0dca512ecc61135b2b /src/bootchart/bootchart.c
parentc358d728e7d6bf38a0176a9d5d013c6e972cddbf (diff)
bootchart: ask for --rel when failed to initialize graph start time
We always read system uptime before log start time. So the uptime should be always smaller number, except it includes system suspend time. It seems better to ask for --rel and exit() than try to be smart and try to recovery from this situation or generate huge messy graphs.
Diffstat (limited to 'src/bootchart/bootchart.c')
-rw-r--r--src/bootchart/bootchart.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index fc00b4e3f2..5683025b19 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -350,6 +350,14 @@ int main(int argc, char *argv[]) {
log_uptime();
+ if (graph_start < 0.0) {
+ fprintf(stderr,
+ "Failed to setup graph start time.\n\nThe system uptime "
+ "probably includes time that the system was suspended. "
+ "Use --rel to bypass this issue.\n");
+ exit (EXIT_FAILURE);
+ }
+
has_procfs = access("/proc/vmstat", F_OK) == 0;
LIST_HEAD_INIT(head);