mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-21 03:55:04 +00:00
xml reporter: support different start node name
Currently the report name is used implicitly as first xml node name for the report. This is inconvenient if one component wants to generate various xml reports under various names (e.g. to steer consumers/clients slightly differently) but with the same xml node tree structure. Fixes #1940
This commit is contained in:
parent
ab9fe9cc6c
commit
463b39fc73
@ -76,7 +76,7 @@ struct Device : List<Device>::Element
|
|||||||
|
|
||||||
static Genode::Reporter &device_list_reporter()
|
static Genode::Reporter &device_list_reporter()
|
||||||
{
|
{
|
||||||
static Genode::Reporter _r("devices", 512*1024);
|
static Genode::Reporter _r("devices", "devices", 512*1024);
|
||||||
return _r;
|
return _r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
Param param(0, 1, 2, 3);
|
Param param(0, 1, 2, 3);
|
||||||
|
|
||||||
Genode::Reporter window_layout_reporter("window_layout", 10*4096);
|
Genode::Reporter window_layout_reporter("window_layout", "window_layout", 10*4096);
|
||||||
window_layout_reporter.enabled(true);
|
window_layout_reporter.enabled(true);
|
||||||
|
|
||||||
static Timer::Connection timer;
|
static Timer::Connection timer;
|
||||||
|
@ -31,7 +31,8 @@ class Genode::Reporter : Noncopyable
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Name const _name;
|
Name const _xml_name;
|
||||||
|
Name const _label;
|
||||||
|
|
||||||
size_t const _buffer_size;
|
size_t const _buffer_size;
|
||||||
|
|
||||||
@ -60,8 +61,12 @@ class Genode::Reporter : Noncopyable
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Reporter(char const *report_name, size_t buffer_size = 4096)
|
Reporter(char const *xml_name, char const *label = nullptr,
|
||||||
: _name(report_name), _buffer_size(buffer_size) { }
|
size_t buffer_size = 4096)
|
||||||
|
:
|
||||||
|
_xml_name(xml_name), _label(label ? label : xml_name),
|
||||||
|
_buffer_size(buffer_size)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable reporting
|
* Enable or disable reporting
|
||||||
@ -71,7 +76,7 @@ class Genode::Reporter : Noncopyable
|
|||||||
if (enabled == _enabled) return;
|
if (enabled == _enabled) return;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
_conn.construct(_name.string(), _buffer_size);
|
_conn.construct(_label.string(), _buffer_size);
|
||||||
else
|
else
|
||||||
_conn.destruct();
|
_conn.destruct();
|
||||||
|
|
||||||
@ -80,7 +85,7 @@ class Genode::Reporter : Noncopyable
|
|||||||
|
|
||||||
bool is_enabled() const { return _enabled; }
|
bool is_enabled() const { return _enabled; }
|
||||||
|
|
||||||
Name name() const { return _name; }
|
Name name() const { return _label; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear report buffer
|
* Clear report buffer
|
||||||
@ -114,7 +119,7 @@ class Genode::Reporter : Noncopyable
|
|||||||
:
|
:
|
||||||
Genode::Xml_generator(reporter._base(),
|
Genode::Xml_generator(reporter._base(),
|
||||||
reporter._size(),
|
reporter._size(),
|
||||||
reporter._name.string(),
|
reporter._xml_name.string(),
|
||||||
func)
|
func)
|
||||||
{
|
{
|
||||||
reporter._conn->report.submit(used());
|
reporter._conn->report.submit(used());
|
||||||
|
@ -149,7 +149,7 @@ struct Server::Main
|
|||||||
|
|
||||||
Genode::Trace::Connection trace { 512*1024, 32*1024, 0 };
|
Genode::Trace::Connection trace { 512*1024, 32*1024, 0 };
|
||||||
|
|
||||||
Genode::Reporter reporter { "trace_subjects", 64*1024 };
|
Genode::Reporter reporter { "trace_subjects", "trace_subjects", 64*1024 };
|
||||||
|
|
||||||
static unsigned long default_period_ms() { return 5000; }
|
static unsigned long default_period_ms() { return 5000; }
|
||||||
|
|
||||||
|
@ -1262,7 +1262,7 @@ void Acpi::generate_report()
|
|||||||
init_acpi_table();
|
init_acpi_table();
|
||||||
|
|
||||||
enum { REPORT_SIZE = 4 * 4096 };
|
enum { REPORT_SIZE = 4 * 4096 };
|
||||||
static Reporter acpi("acpi", REPORT_SIZE);
|
static Reporter acpi("acpi", "acpi", REPORT_SIZE);
|
||||||
acpi.enabled(true);
|
acpi.enabled(true);
|
||||||
|
|
||||||
Genode::Reporter::Xml_generator xml(acpi, [&] () {
|
Genode::Reporter::Xml_generator xml(acpi, [&] () {
|
||||||
|
@ -50,7 +50,7 @@ struct Shape
|
|||||||
|
|
||||||
struct Shape_report : Vbox_pointer::Shape_report
|
struct Shape_report : Vbox_pointer::Shape_report
|
||||||
{
|
{
|
||||||
Genode::Reporter reporter { "shape", sizeof(Vbox_pointer::Shape_report) };
|
Genode::Reporter reporter { "shape", "shape", sizeof(Vbox_pointer::Shape_report) };
|
||||||
|
|
||||||
Shape_report()
|
Shape_report()
|
||||||
:
|
:
|
||||||
|
Loading…
Reference in New Issue
Block a user