mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
trace_logger: omit inactive subjects by default
This patch reduces repetitive log output by omitting inactive trace subjects from the log output. The information about all subjects can still be dumped by setting 'verbose="yes"'. Issue #4448
This commit is contained in:
parent
ceb91732bf
commit
f7270c44cb
@ -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_ */
|
||||
|
@ -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.
|
||||
|
@ -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 });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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(" <activity total=\"", _info.execution_time().thread_context,
|
||||
"\" recent=\"", _recent_exec_time,
|
||||
"\">");
|
||||
|
||||
/* print subjects affinity if desired */
|
||||
if (affinity)
|
||||
if (detail.affinity)
|
||||
log(" <affinity xpos=\"", _info.affinity().xpos(),
|
||||
"\" ypos=\"", _info.affinity().ypos(),
|
||||
"\">");
|
||||
@ -139,7 +144,7 @@ void Monitor::print(bool activity, bool affinity)
|
||||
if (printed_buf_entries)
|
||||
log(" </buffer>");
|
||||
else
|
||||
log(" <buffer />");
|
||||
log(" <buffer/>");
|
||||
log("</subject>");
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
||||
/**************
|
||||
|
Loading…
x
Reference in New Issue
Block a user