LCOV - code coverage report
Current view: top level - shared - boot-timestamps.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 0 19 0.0 %
Date: 2015-07-29 18:47:03 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright 2012 Lennart Poettering
       7             :   Copyright 2013 Kay Sievers
       8             : 
       9             :   systemd is free software; you can redistribute it and/or modify it
      10             :   under the terms of the GNU Lesser General Public License as published by
      11             :   the Free Software Foundation; either version 2.1 of the License, or
      12             :   (at your option) any later version.
      13             : 
      14             :   systemd is distributed in the hope that it will be useful, but
      15             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      17             :   Lesser General Public License for more details.
      18             : 
      19             :   You should have received a copy of the GNU Lesser General Public License
      20             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      21             : ***/
      22             : 
      23             : #include "boot-timestamps.h"
      24             : #include "acpi-fpdt.h"
      25             : #include "efivars.h"
      26             : 
      27           0 : int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
      28           0 :         usec_t x = 0, y = 0, a;
      29             :         int r;
      30             :         dual_timestamp _n;
      31             : 
      32           0 :         assert(firmware);
      33           0 :         assert(loader);
      34             : 
      35           0 :         if (!n) {
      36           0 :                 dual_timestamp_get(&_n);
      37           0 :                 n = &_n;
      38             :         }
      39             : 
      40           0 :         r = acpi_get_boot_usec(&x, &y);
      41           0 :         if (r < 0) {
      42           0 :                 r = efi_loader_get_boot_usec(&x, &y);
      43           0 :                 if (r < 0)
      44           0 :                         return r;
      45             :         }
      46             : 
      47             :         /* Let's convert this to timestamps where the firmware
      48             :          * began/loader began working. To make this more confusing:
      49             :          * since usec_t is unsigned and the kernel's monotonic clock
      50             :          * begins at kernel initialization we'll actually initialize
      51             :          * the monotonic timestamps here as negative of the actual
      52             :          * value. */
      53             : 
      54           0 :         firmware->monotonic = y;
      55           0 :         loader->monotonic = y - x;
      56             : 
      57           0 :         a = n->monotonic + firmware->monotonic;
      58           0 :         firmware->realtime = n->realtime > a ? n->realtime - a : 0;
      59             : 
      60           0 :         a = n->monotonic + loader->monotonic;
      61           0 :         loader->realtime = n->realtime > a ? n->realtime - a : 0;
      62             : 
      63           0 :         return 0;
      64             : }

Generated by: LCOV version 1.11