Norman Feske 17c79a9e23 base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.

While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).

To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.

Issue #1987
2016-08-29 17:27:10 +02:00
..

The new _trace_fs_ server provides access to a trace session by providing a
file-system session as front end. Combined with Noux, it allows for the
interactive exploration and tracing of Genode's process tree using
traditional Unix tools.

Each trace subject is represented by a directory ('thread_name.subject') that
contains specific files, which are used to control the tracing process of the
thread as well as storing the content of its trace buffer:

:'enable': The tracing of a thread is activated if there is a valid policy
  installed and the intend to trace the subject was made clear by writing '1'
  to the 'enable' file. The tracing of a thread may be deactivated by writing a
  '0' to this file.

:'policy': A policy may be changed by overwriting the currently used one in the
  'policy' file. In this case, the old policy is replaced by the new one and
  automatically used by the framework.

:'buffer_size': Writing a value to the 'buffer_size' file changes the size of
  the trace buffer. This value is evaluated only when reactivating the tracing
  of the thread.

:'events': The trace-buffer contents may be accessed by reading from the
  'events' file. New trace events are appended to this file.

:'active': Reading the file will return whether the tracing is active (1) or
  not (0).

:'cleanup': Nodes of untraced subjects are kept as long as they do not change
  their tracing state to dead. Dead untraced nodes are automatically removed
  from the file system. Subjects that were traced before and are now untraced
  can be removed by writing '1' to the 'cleanup' file.

To use the trace_fs, a configuration similar to the following may be used:

! <start name="trace_fs">
!   <resource name="RAM" quantum="128M"/>
!   <provides><service name="File_system"/></provides>
!   <config>
!           <policy label="noux -> trace"
!                   interval="1000"
!                   subject_limit="512"
!                   trace_quota="64M" />
!   </config>
! </start>

:'interval': sets the period the Trace_session is polled. The
  time is given in milliseconds.

:'subject_limit': specifies how many trace subjects should by acquired at
  max when the Trace_session is polled.

:'trace_quota': is the amount of quota the trace_fs should use for the
  Trace_session connection. The remaining amount of RAM quota will be used
  for the actual nodes of the file system and the 'policy' as well as the
  'events' files.

In addition, there are 'buffer_size' and 'buffer_size_limit' that define
the initial and the upper limit of the size of a trace buffer.

A ready-to-use run script can by found in 'ports/run/noux_trace_fs.run'.