diff --git a/repos/os/include/trace/trace_buffer.h b/repos/os/include/trace/trace_buffer.h index abf26309ac..13c39e61d6 100644 --- a/repos/os/include/trace/trace_buffer.h +++ b/repos/os/include/trace/trace_buffer.h @@ -26,7 +26,7 @@ class Trace_buffer private: Genode::Trace::Buffer &_buffer; - Genode::Trace::Buffer::Entry _curr { _buffer.first() }; + Genode::Trace::Buffer::Entry _curr { _buffer.first() }; unsigned long long _lost_count { 0 }; public: @@ -48,7 +48,7 @@ class Trace_buffer _lost_count = (unsigned)_buffer.lost_entries(); } - Trace::Buffer::Entry entry { _curr }; + Trace::Buffer::Entry entry { _curr }; /** * Iterate over all entries that were not processed yet. @@ -59,6 +59,7 @@ class Trace_buffer * if the 'last' end of the buffer (highest address) was reached. */ for (; !entry.head(); entry = _buffer.next(entry)) { + /* continue at first entry if we hit the end of the buffer */ if (entry.last()) entry = _buffer.first(); @@ -76,8 +77,9 @@ class Trace_buffer if (update) _curr = entry; } - void * address() const { return &_buffer; } + void * address() const { return &_buffer; } + + bool empty() const { return _curr.head(); } }; - #endif /* _TRACE__TRACE_BUFFER_H_ */ diff --git a/repos/os/src/app/trace_logger/README b/repos/os/src/app/trace_logger/README index a800e1bf85..83c8031441 100644 --- a/repos/os/src/app/trace_logger/README +++ b/repos/os/src/app/trace_logger/README @@ -36,6 +36,7 @@ This is a short description of the tags and attributes: :config.verbose: Optional. Toggles wether the trace_logger shall log debugging information. + If enabled, even inactive trace subjects appear in the log. :config.session_ram: Optional. Amount of RAM donated to the trace session. diff --git a/repos/os/src/app/trace_logger/main.cc b/repos/os/src/app/trace_logger/main.cc index b2e550fd3e..1cc9e99938 100644 --- a/repos/os/src/app/trace_logger/main.cc +++ b/repos/os/src/app/trace_logger/main.cc @@ -150,7 +150,9 @@ class Main log(""); log("--- Report ", _report_id++, " (", _num_monitors, "/", _num_subjects, " subjects) ---"); new_monitors.for_each([&] (Monitor &monitor) { - monitor.print(_activity, _affinity); + monitor.print(Monitor::Level_of_detail { .activity = _activity, + .affinity = _affinity, + .active_only = !_verbose }); }); } diff --git a/repos/os/src/app/trace_logger/monitor.cc b/repos/os/src/app/trace_logger/monitor.cc index 87ed250869..3db66d518c 100644 --- a/repos/os/src/app/trace_logger/monitor.cc +++ b/repos/os/src/app/trace_logger/monitor.cc @@ -86,8 +86,13 @@ void Monitor::update_info(Trace::Subject_info const &info) } -void Monitor::print(bool activity, bool affinity) +void Monitor::print(Level_of_detail detail) { + /* skip output for a subject with no recent activity */ + bool const inactive = (_recent_exec_time == 0) && _buffer.empty(); + if (detail.active_only && inactive) + return; + /* print general subject information */ typedef Trace::Subject_info Subject_info; Subject_info::State const state = _info.state(); @@ -98,13 +103,13 @@ void Monitor::print(bool activity, bool affinity) "\">"); /* print subjects activity if desired */ - if (activity) + if (detail.activity) log(" "); /* print subjects affinity if desired */ - if (affinity) + if (detail.affinity) log(" "); @@ -139,7 +144,7 @@ void Monitor::print(bool activity, bool affinity) if (printed_buf_entries) log(" "); else - log(" "); + log(" "); log(""); } diff --git a/repos/os/src/app/trace_logger/monitor.h b/repos/os/src/app/trace_logger/monitor.h index 5c6d9b29b8..bc10e10569 100644 --- a/repos/os/src/app/trace_logger/monitor.h +++ b/repos/os/src/app/trace_logger/monitor.h @@ -67,7 +67,9 @@ class Monitor : public Monitor_base, Genode::Trace::Subject_id subject_id, Genode::Trace::Subject_info const &info); - void print(bool activity, bool affinity); + struct Level_of_detail { bool activity, affinity, active_only; }; + + void print(Level_of_detail); /**************