Dreport: Add D-Bus Statistics Collection

Add functionality to collect statistical information about
D-Bus usage as part of the debug data collection process.

Including this information in debug reports will enhance
troubleshooting capabilities for D-Bus related issues in
OpenBMC-based systems. It provides a snapshot of D-Bus
activity and performance at the time of report generation.

This addition will help identify potential communication
bottlenecks, unexpected service behaviors, and performance
issues related to inter-process communication, system
management interfaces, and sensor data retrieval.

Tested on qemuarm.

'''
Dump size: 76k
Untar Dump Size:  916K
Added File Size: 79K
Time for the Dump Completion: 15 sec
Time for the command to run: 0.260s

[1] root@qemuarm:~# time dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.Debug.Stats.GetStats
real    0m0.260s
user    0m0.049s
sys     0m0.204s

High OutgoingBytes:
While all connections show 0 in the given data, a connection
with consistently high OutgoingBytes might suggest a blocked
receiver or network issues.

Rapidly Increasing NameObjects:
If a connection's NameObjects count grows quickly over time,
it may indicate a resource leak.

Mismatched IncomingBytes and OutgoingBytes:
Large discrepancies between these values across multiple
connections could suggest communication issues.

High Number of Connections:
An unusually high number of active connections
(the log shows 33) might indicate connection leaks
or denial-of-service attempts.

[2] root@qemuarm:~# busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/bmc xyz.openbmc_project.Dump.Create CreateDump a{sv} 1 "i" i 1234

...
[3] Mar 26 11:14:45 qemuarm phosphor-dump-manager[223]: Initiating new BMC dump with type: user path:
...
[4] Mar 26 11:15:00 qemuarm phosphor-dump-manager[305]: Wed Mar 26 11:15:00 UTC 2025 Successfully completed
[5] Mar 26 11:15:00 qemuarm phosphor-dump-manager[223]: User initiated dump completed, resetting flag

ls -lrth obmcdump_1_1742987685
total 916K
...
-rw-r--r-- 1 dkamat domain-users  79K Mar 26 16:44 dbusstats.log
...

ls -lrth obmcdump_1_1742987685/dbusstats.log
domain-users 79K Mar 26 16:44 obmcdump_1_1742987685/dbusstats.log
cat obmcdump_1_1742987685/dbusstats.log | -n 10
...
                  array [
                     dict entry(
                        string "NameObjects"
                        uint32 0
                     )
                     dict entry(
                        string "MatchBytes"
                        uint32 6150
                     )
                     dict entry(
                        string "Matches"
                        uint32 8
                     )
                     dict entry(
                        string "ReplyObjects"
                        uint32 0
                     )
                     dict entry(
                        string "IncomingBytes"
                        uint32 16
                     )
                     dict entry(
                        string "IncomingFds"
                        uint32 0
                     )
                     dict entry(
                        string "OutgoingBytes"
                        uint32 0
                     )
                     dict entry(
                        string "OutgoingFds"
                        uint32 0
                     )
                     dict entry(
                        string "ActivationRequestBytes"
                        uint32
                     )
                     dict entry(
                        string "ActivationRequestFds"
                        uint32 0
                     )
                  ]
               }
'''

Change-Id: I37d93f1a6a55c306cd3a05e7319c99413353aa98
Signed-off-by: Deepak Kamat <dkamat@nvidia.com>
1 file changed
tree: 7a14d053117c8e33df459bf6df00dda632d06661
  1. dump-extensions/
  2. host-transport-extensions/
  3. subprojects/
  4. test/
  5. tools/
  6. .clang-format
  7. .clang-tidy
  8. .gitignore
  9. .shellcheck-ignore
  10. bmc_dump_entry.cpp
  11. bmc_dump_entry.hpp
  12. core_manager.cpp
  13. core_manager.hpp
  14. core_manager_main.cpp
  15. dump-extensions.hpp
  16. dump_entry.cpp
  17. dump_entry.hpp
  18. dump_manager.cpp
  19. dump_manager.hpp
  20. dump_manager_bmc.cpp
  21. dump_manager_bmc.hpp
  22. dump_manager_faultlog.cpp
  23. dump_manager_faultlog.hpp
  24. dump_manager_main.cpp
  25. dump_offload.cpp
  26. dump_offload.hpp
  27. dump_serialize.cpp
  28. dump_serialize.hpp
  29. dump_types.cpp.mako
  30. dump_types.hpp.mako
  31. dump_utils.cpp
  32. dump_utils.hpp
  33. elog_watch.cpp
  34. elog_watch.hpp
  35. example_dump_types.yaml
  36. example_errors_watch.yaml
  37. faultlog_dump_entry.cpp
  38. faultlog_dump_entry.hpp
  39. ffdc
  40. host_transport_exts.hpp
  41. LICENSE
  42. map_gen.py
  43. meson.build
  44. meson.options
  45. OWNERS
  46. ramoops_manager.cpp
  47. ramoops_manager.hpp
  48. ramoops_manager_main.cpp
  49. README.md
  50. watch.cpp
  51. watch.hpp
README.md

phosphor-debug-collector

Phosphor Debug Collector provides mechanisms to collect various log files and system parameters. Used to troubleshoot problems in OpenBMC based systems.

One such mechanism is dreport, a script that collects debug data and packages it into an archive file.

To Build

To build this package with meson, do the following steps:

    1. meson builddir
    2. ninja -C builddir

To clean the built files run ninja -C builddir clean.

To run unit tests

Tests can be run in the CI docker container, refer local-ci-build

or with an OpenBMC x86 sdk(see below for x86 steps).

meson -Dtests=enabled build
ninja -C build test