[systemd-commits] 2 commits - Makefile.am src/analyze src/core src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Mon Jan 7 16:29:27 PST 2013


 Makefile.am                    |    2 +-
 src/analyze/systemd-analyze.in |   18 ++++++++++++++++++
 src/core/manager.c             |    1 +
 src/shared/time-util.c         |   26 ++++++++++++++++++++++++++
 src/shared/time-util.h         |    1 +
 5 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit cae0c5e042c04b33b93a6a9af355f7304f75a45c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jan 8 01:27:39 2013 +0100

    core: properly initialize kernel timestamp

diff --git a/src/core/manager.c b/src/core/manager.c
index 3a4023f..df0fd63 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -301,6 +301,7 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) {
                 return -ENOMEM;
 
         dual_timestamp_get(&m->userspace_timestamp);
+        dual_timestamp_from_monotonic(&m->kernel_timestamp, 0);
 
         m->running_as = running_as;
         m->name_data_slot = m->conn_data_slot = m->subscribed_data_slot = -1;
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 13d57ba..4fd8f08 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -46,6 +46,11 @@ dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u) {
         int64_t delta;
         assert(ts);
 
+        if (u == (usec_t) -1) {
+                ts->realtime = ts->monotonic = (usec_t) -1;
+                return ts;
+        }
+
         ts->realtime = u;
 
         if (u == 0)
@@ -64,6 +69,27 @@ dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u) {
         return ts;
 }
 
+dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u) {
+        int64_t delta;
+        assert(ts);
+
+        if (u == (usec_t) -1) {
+                ts->realtime = ts->monotonic = (usec_t) -1;
+                return ts;
+        }
+
+        ts->monotonic = u;
+        delta = (int64_t) now(CLOCK_MONOTONIC) - (int64_t) u;
+
+        ts->realtime = now(CLOCK_REALTIME);
+        if ((int64_t) ts->realtime > delta)
+                ts->realtime -= delta;
+        else
+                ts->realtime = 0;
+
+        return ts;
+}
+
 usec_t timespec_load(const struct timespec *ts) {
         assert(ts);
 
diff --git a/src/shared/time-util.h b/src/shared/time-util.h
index 7194875..ec263c1 100644
--- a/src/shared/time-util.h
+++ b/src/shared/time-util.h
@@ -61,6 +61,7 @@ usec_t now(clockid_t clock);
 
 dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
 dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
+dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
 
 #define dual_timestamp_is_set(ts) ((ts)->realtime > 0)
 

commit 6ee667aeeb284b652e256ad1d792b0fb6c28faba
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jan 8 01:27:18 2013 +0100

    analyze: add emacs mode header

diff --git a/Makefile.am b/Makefile.am
index ca24f96..c6356be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-#  -*- Mode: makefile; indent-tabs-mode: t -*- */
+#  -*- Mode: makefile; indent-tabs-mode: t -*-
 #
 #  This file is part of systemd.
 #
diff --git a/src/analyze/systemd-analyze.in b/src/analyze/systemd-analyze.in
index 26a9f7b..bcced18 100755
--- a/src/analyze/systemd-analyze.in
+++ b/src/analyze/systemd-analyze.in
@@ -1,4 +1,22 @@
 #!@PYTHON_BINARY@
+# -*-python-*-
+
+#  This file is part of systemd.
+#
+#  Copyright 2010-2013 Lennart Poettering
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+#  systemd 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
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 
 import sys, os
 import argparse



More information about the systemd-commits mailing list