Products › lamco-dbus-tools › Docs
Call and time a D-Bus service: A dbusdo tutorial
Call and time a D-Bus service with dbusdo: A tutorial that repeats a call for a distribution, sets it against a recording, replays calls and uses the relay.
Describes version 0.4.1. Run again step by step on the final build on 2026-12-02, in
Fedora 45's GNOME session on dbus-broker (docs/measurements/stage-13/tutorials/).
This lesson calls a service, times it as a distribution, checks the figure against a recording of the same
calls, sends a recording's calls again, and runs a program behind the relay. It needs a desktop session
with a notification daemon, and notify-send, which most desktops have. Every call it makes only asks the
notification daemon about itself, except the last step, which shows one notification.
1. Build the programs
git clone <the repository> lamco-dbus-tools
cd lamco-dbus-tools
cargo build --release
export PATH=$PWD/target/release:$PATH
2. One call
dbusdo call org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetServerInformation
It prints the daemon's name, vendor, version and specification version, then how long the call took at the caller: From just before it was sent to just after its answer was read.
A call names its destination, its path and its method as interface.member. Arguments, when a method
takes any, come after it as busctl call takes them: A signature, then the values.
3. The same call 200 times
dbusdo --out acts.json call --repeat 200 org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetServerInformation
It prints one line: How many answered, and the distribution at the caller, from the minimum to the maximum. One figure would hide that the slowest calls can take several times the median.
--out acts.json kept each call: The caller's name, its serial, its answer and its two stamps.
4. Both ends
In one terminal:
dbussee record --service org.freedesktop.Notifications --duration 10 --out rec.json
Within those 10 seconds, in another:
dbusdo --out acts.json call --repeat 200 org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetServerInformation
When the recording has ended:
dbustell timing rec.json --caller acts.json
It prints three lines of figures: At the caller, at the bus, and both trips across the socket, which is the first less the second. At the bus is the time from the bus passing the call on to it passing the answer on: The daemon's own work and the bus's queueing. The rest of the caller's figure is the trip each way.
The report says whether the two agree: Whether at each percentile the bus's figure is no longer than the caller's, within the uncertainty it states. If a few single calls read longer at the bus, it counts them and says why: The recorder stamps a message when it reads it, and it was late to one of them.
5. Send the calls again
Record with the bodies kept as bytes, so they can be sent again:
dbussee record --service org.freedesktop.Notifications --bodies raw --duration 10 --out raw.json
Within those 10 seconds:
dbusdo call --repeat 5 org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetCapabilities
Then:
dbusdo replay raw.json
5 calls sent again: 5 ended as they did. A call that ended differently, an error where there was a
reply, would make replay fail.
Every call to the daemon in those 10 seconds is in the recording, and replay sends each one again. If a
program showed a notification meanwhile, the replay shows it again too, and the count is higher than 5.
On dbus-broker the recording took more than the daemon's calls, as in your first
recording, and replay says what it didn't send:
5 calls sent again: 5 ended as they did, 0 differently, 0 had no answer.
5 left out: They went to a unique name of the recording's, which no longer exists.
Those were the daemon passing the calls on to the shell, by a connection's unique name, which a replay can't reach again.
6. A program behind the relay
dbusdo --out relayed.json relay notify-send "Relayed" "This went through the relay"
The notification appears as usual. The relay passed notify-send's connection on unchanged and wrote
down its side of it: Its authentication, each message with the moment it was sent and the moment its
answer came back, and what the bus saw instead of notify-send, which was the relay's process.
dbustell timing relayed.json
It gives the Notify call's time from notify-send's own side of the socket.
What you've seen
dbusdocalls, repeats and replays, and keeps each act with its stamps.- The caller's figure and the bus's are different figures, and
dbustelljoins them instead of mixing them. - The relay gives one program's own moments, at the cost of the bus seeing the relay.
The how-to pages go further: Timing a call, replaying a capture and running a program behind the relay.