source: grub-pc/trunk/fuentes/grub-core/commands/boottime.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 1.9 KB
Line 
1/*
2 *  GRUB  --  GRand Unified Bootloader
3 *  Copyright (C) 2013  Free Software Foundation, Inc.
4 *
5 *  GRUB is free software: you can redistribute it and/or modify
6 *  it under the terms of the GNU General Public License as published by
7 *  the Free Software Foundation, either version 3 of the License, or
8 *  (at your option) any later version.
9 *
10 *  GRUB is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <grub/dl.h>
20#include <grub/misc.h>
21#include <grub/command.h>
22#include <grub/i18n.h>
23
24GRUB_MOD_LICENSE ("GPLv3+");
25
26
27static grub_err_t
28grub_cmd_boottime (struct grub_command *cmd __attribute__ ((unused)),
29                   int argc __attribute__ ((unused)),
30                   char *argv[] __attribute__ ((unused)))
31{
32  struct grub_boot_time *cur;
33  grub_uint64_t last_time = 0, start_time = 0;
34  if (!grub_boot_time_head)
35    {
36      grub_puts_ (N_("No boot time statistics is available\n"));
37      return 0;
38    }
39  start_time = last_time = grub_boot_time_head->tp;
40  for (cur = grub_boot_time_head; cur; cur = cur->next)
41    {
42      grub_uint32_t tmabs = cur->tp - start_time;
43      grub_uint32_t tmrel = cur->tp - last_time;
44      last_time = cur->tp;
45
46      grub_printf ("%3d.%03ds %2d.%03ds %s:%d %s\n", 
47                   tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000, cur->file, cur->line,
48                   cur->msg);
49    }
50 return 0;
51}
52
53static grub_command_t cmd_boottime;
54
55GRUB_MOD_INIT(boottime)
56{
57  cmd_boottime =
58    grub_register_command ("boottime", grub_cmd_boottime,
59                           0, N_("Show boot time statistics."));
60}
61
62GRUB_MOD_FINI(boottime)
63{
64  grub_unregister_command (cmd_boottime);
65}
Note: See TracBrowser for help on using the repository browser.