summaryrefslogtreecommitdiff
path: root/src/analyze
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-11-02 11:29:02 -0400
committerKay Sievers <kay@vrfy.org>2012-11-02 16:54:28 +0100
commit4940c64240541e91411620b7dc0963e012aa6b91 (patch)
treef7226f5e3f4b62c3e0205c9d54c61196801d238c /src/analyze
parente2fd5e5ba281a22886fa3797dc6265cca670448b (diff)
analyze: use GDBus instead of dbus-python
Diffstat (limited to 'src/analyze')
-rwxr-xr-xsrc/analyze/systemd-analyze31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
index 636fd7422b..87a83ddb81 100755
--- a/src/analyze/systemd-analyze
+++ b/src/analyze/systemd-analyze
@@ -1,14 +1,15 @@
#!/usr/bin/python
-import getopt, dbus, sys, os
+import getopt, sys, os
+from gi.repository import Gio
try:
import cairo
except ImportError:
cairo = None
def acquire_time_data():
-
- manager = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.systemd1.Manager')
+ manager = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
+ None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None)
units = manager.ListUnits()
l = []
@@ -17,23 +18,25 @@ def acquire_time_data():
if i[5] != "":
continue
- properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', i[6]), 'org.freedesktop.DBus.Properties')
+ properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
+ None, 'org.freedesktop.systemd1', i[6], 'org.freedesktop.DBus.Properties', None)
- ixt = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic'))
- aet = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic'))
- axt = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic'))
- iet = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic'))
+ ixt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic')
+ aet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic')
+ axt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic')
+ iet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic')
l.append((str(i[0]), ixt, aet, axt, iet))
return l
def acquire_start_time():
- properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.DBus.Properties')
+ properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
+ None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.DBus.Properties', None)
- initrd_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic'))
- userspace_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic'))
- finish_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic'))
+ initrd_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic')
+ userspace_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic')
+ finish_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic')
if finish_time == 0:
sys.stderr.write("Bootup is not yet finished. Please try again later.\n")
@@ -281,7 +284,7 @@ def unknown_verb():
usage()
sys.exit(1)
-bus = dbus.SystemBus()
+bus = Gio.BusType.SYSTEM
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "user"])
@@ -293,7 +296,7 @@ for o, a in opts:
if o in ("-h", "--help"):
help()
elif o == '--user':
- bus = dbus.SessionBus()
+ bus = Gio.BusType.SESSION
else:
assert False, "unhandled option"