[lttng-dev] Integration of the state history system in LTTv

Simon Marchi simon.marchi at polymtl.ca
Thu Jan 26 18:46:56 EST 2012


Hi,

For those who don't know, we recently started working on the
integration of the state history system designed by Alexandre
Montplaisir in LTTv. This will include a C++ rewrite and a bit of
design work to keep the code as modular as possible. For example, we
want to make sure it is possible to use the state system without the
history part. Here is a brief description of the different parts we
plan to create.

Comments, questions and advices are very welcome !


* libState (or something like that)

The libState library can be used to represent the current state of a
system in the form of an attribute tree. An attribute is a mapping
between a key (a string) and a value (generally a string, an integer
or a null value). The attribute tree is analoguous to the structure of
a filesystem, since an attribute can contain children attributes in
addition to its own value. When the path of an attribute is specified,
it can be either absolute or relative to another attribute.

The possible operations on the attribute tree are:
- Add a new attribute, specifying its value.
- Change the value of an existing attribute.
- Delete an attribute and all its descendants.
- Get the parent attribute of an attribute.
- Get the children attributes of an attribute, or their number.
- Get the total number of attributes in the tree.

libState is independent from LTTv, is not domain-specific, and could
be packaged separately.


* libInterval (or something like that)

The libInterval library can be used to represent and save an interval
tree in memory or on disk. Each interval is characterized by begin and
end timestamps, a value and a key.

The possible operations on the interval tree are:
- Add an interval, specifying its key, value and begin/end timestamp.
- Lookup intervals that intersect a punctual time value.
- Lookup an interval that intersects a punctual time value and that
matches a given key.

Due to the nature of the storage of the interval tree on disk,
deletion of intervals probably won't be possible.

Like libState, libInterface is indenpendent from LTTv, is not
domain-specific, and could be packaged separately.


* LTTv State module

The State module's job is to receive attribute value changes and to
store them to constantly maintain the current state of all attributes
in the system. It also keeps the timestamp associated to the last
state change of every attribute, so that when the state of an
attribute changes, it is possible to create an interval for the
previous value. It defines a hook (using the LTTv hook system) that is
called every time the value of an attribute changes. The old and new
values and the associated timestamps are passed as parameters to the
callbacks. It offers a public API to other modules to send state
changes and query current state values.

The State module built around the libState library.


* LTTv StateHistory module

The StateHistory module's job is to record the state of the system for
any moment of the time lapse of the trace. The state is represented by
the combination of the values of all the attributes of the system. To
do so, it hooks on State module's hook and creates an interval in the
interval tree every time an attribute changes value. It offers a
public API to other modules to get the value of any attribute or all
available attributes at a given time.

The StateHistory module is built around the libInterval library.


We still need to figure out what changes will be needed in LTTv to
adapt the views to the this new system, but we first would like to
know if the foundations (the architecture described in this message)
sounds right.

Thanks !

Simon



More information about the lttng-dev mailing list