Hello,
there are many cases where it is useful to monitor a system in real-time and trace the sequence of events.
This link
formatting link
explains how to do code instrumentation and create nice looking Sequence Diagrams showing exactly the flow of events (trace) for a detailed analysis. For the graphics rendering Mscgen is used.
Best regards, Peter