Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 core/chart.cc       | 7 +++++++
 include/osv/boot.hh | 1 +
 loader.cc           | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/core/chart.cc b/core/chart.cc
index 59311a93..c3355907 100644
--- a/core/chart.cc
+++ b/core/chart.cc
@@ -45,3 +45,10 @@ void boot_time_chart::print_chart()
         print_one_time(i);
     }
 }
+
+void boot_time_chart::print_total_time()
+{
+    auto last = arrays[_event - 1].stamp;
+    auto initial = arrays[0].stamp;
+    printf("Booted up in %.2f ms\n", to_msec(last - initial));
+}
diff --git a/include/osv/boot.hh b/include/osv/boot.hh
index b8fb1944..f08f1895 100644
--- a/include/osv/boot.hh
+++ b/include/osv/boot.hh
@@ -15,6 +15,7 @@ public:
     void event(int event_idx, const char *str);
     void event(int event_idx, const char *str, u64 stamp);
     void print_chart();
+    void print_total_time();
 private:
     // Can we keep it at 0 and let the initial two users increment it?  No, we
     // cannot. The reason is that the code that *parses* those fields run
diff --git a/loader.cc b/loader.cc
index 9015e36e..61f68e09 100644
--- a/loader.cc
+++ b/loader.cc
@@ -443,6 +443,9 @@ void* do_main_thread(void *_main_args)
     if (opt_bootchart) {
         boot_time.print_chart();
     }
+    else {
+        boot_time.print_total_time();
+    }
 
     if (!opt_redirect.empty()) {
         // redirect stdout and stdin to the given file, instead of the console
-- 
2.19.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to