[systemd-commits] 2 commits - src/analyze src/systemctl

Lennart Poettering lennart at kemper.freedesktop.org
Thu May 3 16:03:18 PDT 2012


 src/analyze/systemd-analyze |   22 ++++++++++++++--------
 src/systemctl/systemctl.c   |    4 ++--
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 59ddae9f9c0992fe193fa371a5d114227b35785c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri May 4 01:02:32 2012 +0200

    systemctl: fix typo
    
    as Sergey Ptashnick pointed out we should write "poweroff" once instead
    of "reboot" twice.

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d80eb94..c08d809 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5224,8 +5224,8 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
                 }
 
                 if (((!streq(verbs[i].verb, "reboot") &&
-                     !streq(verbs[i].verb, "halt") &&
-                     !streq(verbs[i].verb, "reboot")) || arg_force <= 0) && !bus) {
+                      !streq(verbs[i].verb, "halt") &&
+                      !streq(verbs[i].verb, "poweroff")) || arg_force <= 0) && !bus) {
                         log_error("Failed to get D-Bus connection: %s",
                                   dbus_error_is_set(error) ? error->message : "No connection to service manager.");
                         return -EIO;

commit 6fc08fc789cfccacc7741ba8feab849bc4f3c414
Author: Patrick McCarty <patrick.mccarty at linux.intel.com>
Date:   Thu May 3 13:42:45 2012 -0700

    systemd-analyze: add a --user option to support user instances

diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
index a49fbb7..ad7bd9a 100755
--- a/src/analyze/systemd-analyze
+++ b/src/analyze/systemd-analyze
@@ -69,9 +69,9 @@ def draw_text(context, x, y, text, size = 12, r = 0, g = 0, b = 0, vcenter = 0.5
         context.restore()
 
 def help():
-        sys.stdout.write("""systemd-analyze time
-systemd-analyze blame
-systemd-analyze plot
+        sys.stdout.write("""systemd-analyze [--user] time
+systemd-analyze [--user] blame
+systemd-analyze [--user] plot
 
 Process systemd profiling information
 
@@ -80,8 +80,14 @@ Process systemd profiling information
 
 
 bus = dbus.SystemBus()
+command_index = 1
 
-if len(sys.argv) <= 1 or sys.argv[1] == 'time':
+if len(sys.argv) > 1 and sys.argv[1] == '--user':
+        bus = dbus.SessionBus()
+        command_index = 2
+
+
+if len(sys.argv) <= command_index or sys.argv[command_index] == 'time':
 
         initrd_time, start_time, finish_time = acquire_start_time()
 
@@ -98,7 +104,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == 'time':
                         finish_time/1000)
 
 
-elif sys.argv[1] == 'blame':
+elif sys.argv[command_index] == 'blame':
 
         data = acquire_time_data()
         s = sorted(data, key = lambda i: i[2] - i[1], reverse = True)
@@ -113,7 +119,7 @@ elif sys.argv[1] == 'blame':
 
                 sys.stdout.write("%6lums %s\n" % ((aet - ixt) / 1000, name))
 
-elif sys.argv[1] == 'plot':
+elif sys.argv[command_index] == 'plot':
         import cairo, os
 
         initrd_time, start_time, finish_time = acquire_start_time()
@@ -269,8 +275,8 @@ elif sys.argv[1] == 'plot':
                         finish_time/1000), hcenter = 0, vcenter = -1)
 
         surface.finish()
-elif sys.argv[1] in ("help", "--help", "-h"):
+elif sys.argv[command_index] in ("help", "--help", "-h"):
         help()
 else:
-        sys.stderr.write("Unknown verb '%s'.\n" % sys.argv[1])
+        sys.stderr.write("Unknown verb '%s'.\n" % sys.argv[command_index])
         sys.exit(1)



More information about the systemd-commits mailing list