Skip to content

Commit

Permalink
Changed loader to print total boot time by default
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Kozaczuk <[email protected]>
  • Loading branch information
wkozaczuk committed Mar 26, 2019
1 parent 053e0a4 commit c839511
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/chart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
1 change: 1 addition & 0 deletions include/osv/boot.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c839511

Please sign in to comment.