[systemd-commits] 2 commits - src/manager.c src/systemd-analyze src/unit.c

Lennart Poettering lennart at kemper.freedesktop.org
Wed Mar 30 11:16:20 PDT 2011


 src/manager.c       |    2 -
 src/systemd-analyze |    7 ++--
 src/unit.c          |   77 ++++++++++++++++++++++++++--------------------------
 3 files changed, 44 insertions(+), 42 deletions(-)

New commits:
commit 3b2775c5cea96060b2c4c44fee18b87b5d51cb02
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 30 20:16:07 2011 +0200

    unit: when deserializing do reconnect to dbus/syslog when they show up

diff --git a/src/unit.c b/src/unit.c
index 895e401..4f83778 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1221,55 +1221,56 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
                         log_notice("Unit %s entered failed state.", u->meta.id);
                         unit_trigger_on_failure(u);
                 }
+        }
 
+        /* Some names are special */
+        if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
+
+                if (unit_has_name(u, SPECIAL_DBUS_SERVICE))
+                        /* The bus just might have become available,
+                         * hence try to connect to it, if we aren't
+                         * yet connected. */
+                        bus_init(u->meta.manager, true);
+
+                if (u->meta.type == UNIT_SERVICE &&
+                    !UNIT_IS_ACTIVE_OR_RELOADING(os) &&
+                    u->meta.manager->n_deserializing <= 0) {
+                        /* Write audit record if we have just finished starting up */
+                        manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_START, true);
+                        u->meta.in_audit = true;
+                }
 
-                /* Some names are special */
-                if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
-
-                        if (unit_has_name(u, SPECIAL_DBUS_SERVICE))
-                                /* The bus just might have become available,
-                                 * hence try to connect to it, if we aren't
-                                 * yet connected. */
-                                bus_init(u->meta.manager, true);
-
-                        if (u->meta.type == UNIT_SERVICE &&
-                            !UNIT_IS_ACTIVE_OR_RELOADING(os)) {
-                                /* Write audit record if we have just finished starting up */
-                                manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_START, true);
-                                u->meta.in_audit = true;
-                        }
-
-                        if (!UNIT_IS_ACTIVE_OR_RELOADING(os))
-                                manager_send_unit_plymouth(u->meta.manager, u);
+                if (!UNIT_IS_ACTIVE_OR_RELOADING(os))
+                        manager_send_unit_plymouth(u->meta.manager, u);
 
-                } else {
+        } else {
 
-                        /* We don't care about D-Bus here, since we'll get an
-                         * asynchronous notification for it anyway. */
+                /* We don't care about D-Bus here, since we'll get an
+                 * asynchronous notification for it anyway. */
 
-                        if (u->meta.type == UNIT_SERVICE &&
-                            UNIT_IS_INACTIVE_OR_FAILED(ns) &&
-                            !UNIT_IS_INACTIVE_OR_FAILED(os)) {
+                if (u->meta.type == UNIT_SERVICE &&
+                    UNIT_IS_INACTIVE_OR_FAILED(ns) &&
+                    !UNIT_IS_INACTIVE_OR_FAILED(os) &&
+                    u->meta.manager->n_deserializing <= 0) {
 
-                                /* Hmm, if there was no start record written
-                                 * write it now, so that we always have a nice
-                                 * pair */
-                                if (!u->meta.in_audit) {
-                                        manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_START, ns == UNIT_INACTIVE);
+                        /* Hmm, if there was no start record written
+                         * write it now, so that we always have a nice
+                         * pair */
+                        if (!u->meta.in_audit) {
+                                manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_START, ns == UNIT_INACTIVE);
 
-                                        if (ns == UNIT_INACTIVE)
-                                                manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_STOP, true);
-                                } else
-                                        /* Write audit record if we have just finished shutting down */
-                                        manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_STOP, ns == UNIT_INACTIVE);
+                                if (ns == UNIT_INACTIVE)
+                                        manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_STOP, true);
+                        } else
+                                /* Write audit record if we have just finished shutting down */
+                                manager_send_unit_audit(u->meta.manager, u, AUDIT_SERVICE_STOP, ns == UNIT_INACTIVE);
 
-                                u->meta.in_audit = false;
-                        }
+                        u->meta.in_audit = false;
                 }
-
-                manager_recheck_syslog(u->meta.manager);
         }
 
+        manager_recheck_syslog(u->meta.manager);
+
         /* Maybe we finished startup and are now ready for being
          * stopped because unneeded? */
         unit_check_unneeded(u);

commit fac9f8df1f49117cf8b84667cb0565103e955bcb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 30 20:15:45 2011 +0200

    analyze: beautify output a bit

diff --git a/src/manager.c b/src/manager.c
index faf30dc..fdb5bed 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2328,7 +2328,7 @@ static int process_event(Manager *m, struct epoll_event *ev) {
 int manager_loop(Manager *m) {
         int r;
 
-        RATELIMIT_DEFINE(rl, 1*USEC_PER_SEC, 1000);
+        RATELIMIT_DEFINE(rl, 1*USEC_PER_SEC, 50000);
 
         assert(m);
         m->exit_code = MANAGER_RUNNING;
diff --git a/src/systemd-analyze b/src/systemd-analyze
index 4302329..1a367e7 100755
--- a/src/systemd-analyze
+++ b/src/systemd-analyze
@@ -23,10 +23,9 @@ def acquire_time_data():
 
         return l
 
-data = acquire_time_data()
-
 if len(sys.argv) <= 1 or sys.argv[1] == 'blame':
 
+        data = acquire_time_data()
         s = sorted(data, key = lambda i: i[2] - i[1], reverse = True)
 
         for i in s:
@@ -37,4 +36,6 @@ if len(sys.argv) <= 1 or sys.argv[1] == 'blame':
                 if i[2] <= i[1]:
                         continue
 
-                sys.stdout.write("%lums\t %s\n" % ((i[2] - i[1]) / 1000, i[0]))
+                sys.stdout.write("%6lums %s\n" % ((i[2] - i[1]) / 1000, i[0]))
+else:
+        sys.stderr.write("Unknown verb '%s'.\n" % sys.argv[1])



More information about the systemd-commits mailing list