views:

161

answers:

2

I'm writing a C++ background/server application for Linux/Windows. Is there a standard control/profiling/reporting service I should use to expose my application's current status in a standardized way?

If not, what's a good pattern (or library) to use for exposing this kind of data and control?

Specifically, I want to expose the following data:

  1. Relative "usage" of "components" (where usage/components is user-defined)
  2. Any errors/faults
  3. Memory, CPU, other misc process data
  4. Method/class execution profile
    1. Average time spent in method/class
    2. Total calls

I want to expose the following control mechanisms

  1. Start, stop, restart, reload X... (commandesque control)
  2. Parameter tuning
A: 

The standard way would be by using /proc as explained here

For start,stop,... see /etc/init.d

stefaanv
`/proc` is a kernel interface; user programs cannot add stuff there
mark4o
Oops, I mixed daemons with drivers. Some kind of IPC could be used then, although I'm not aware of a standard way. Definitively not Linx/Windows.Sorry.
stefaanv
+2  A: 

Many Linux systems now have dbus for this sort of stuff. Daemons run and provide information and a control interface on the system bus. Desktop applications communicate with one another via the session bus.

For instance, the bluez bluetoothd daemon uses dbus to provide information about bluetooth devices and services, and a control interface to control those devices.

NetworkManager also uses dbus for status and control purposes.

However, starting and stopping are functions that are usually outside the actual application itself. Perhaps the correct architecture would be for some service supervision framework (upstart, runit...) to provide a dbus interface to control services. That said, dbus itself can be used to start services on demand, but it really is not meant for service supervision. See this for more.

Edit: I've just been reading about upstart some more, and it does have a dbus interface for job control. It is subject to change however.

camh