/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* VasEBoot 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 3 of the License, or
* (at your option) any later version.
*
* VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VasEBoot. If not, see .
*/
#include
#include
#include
#include
VasEBoot_MOD_LICENSE ("GPLv3+");
static VasEBoot_err_t
VasEBoot_cmd_boottime (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused)))
{
struct VasEBoot_boot_time *cur;
VasEBoot_uint64_t last_time = 0, start_time = 0;
if (!VasEBoot_boot_time_head)
{
VasEBoot_puts_ (N_("No boot time statistics is available\n"));
return 0;
}
start_time = last_time = VasEBoot_boot_time_head->tp;
for (cur = VasEBoot_boot_time_head; cur; cur = cur->next)
{
VasEBoot_uint32_t tmabs = cur->tp - start_time;
VasEBoot_uint32_t tmrel = cur->tp - last_time;
last_time = cur->tp;
VasEBoot_printf ("%3d.%03ds %2d.%03ds %s:%d %s\n",
tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000, cur->file, cur->line,
cur->msg);
}
return 0;
}
static VasEBoot_command_t cmd_boottime;
VasEBoot_MOD_INIT(boottime)
{
cmd_boottime =
VasEBoot_register_command ("boottime", VasEBoot_cmd_boottime,
0, N_("Show boot time statistics."));
}
VasEBoot_MOD_FINI(boottime)
{
VasEBoot_unregister_command (cmd_boottime);
}