* Account all RAM/CAP quota of a session except quota for metadata used in core. The latter is considered when asking if a session can afford to make an operation but it does not get accounted to always be able to pay back all quota when a session closes. The general accounting mechanism is moved from atop of the allocators down to the level of RAM/RM session operations. * report statistics about session objects and quota if <report stats="yes" quota="yes"/> is configured. (default is yes if <report> is present) Issue #2953
87 lines
1.7 KiB
C++
87 lines
1.7 KiB
C++
/*
|
|
* \brief Report generation unit
|
|
* \author Martin Stein
|
|
* \date 2016-08-24
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2016-2017 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _REPORT_H_
|
|
#define _REPORT_H_
|
|
|
|
/* Genode */
|
|
#include <timer_session/connection.h>
|
|
#include <os/reporter.h>
|
|
|
|
namespace Genode {
|
|
|
|
class Xml_node;
|
|
class Env;
|
|
}
|
|
|
|
namespace Net {
|
|
|
|
class Domain_tree;
|
|
class Report;
|
|
class Quota;
|
|
}
|
|
|
|
|
|
struct Net::Quota
|
|
{
|
|
Genode::size_t ram { 0 };
|
|
Genode::size_t cap { 0 };
|
|
};
|
|
|
|
|
|
class Net::Report
|
|
{
|
|
private:
|
|
|
|
bool const &_verbose;
|
|
bool const _config;
|
|
bool const _config_triggers;
|
|
bool const _bytes;
|
|
bool const _stats;
|
|
bool const _quota;
|
|
Quota const &_shared_quota;
|
|
Genode::Pd_session &_pd;
|
|
Genode::Reporter &_reporter;
|
|
Domain_tree &_domains;
|
|
Timer::Periodic_timeout<Report> _timeout;
|
|
|
|
void _handle_report_timeout(Genode::Duration);
|
|
|
|
void _report();
|
|
|
|
public:
|
|
|
|
struct Empty : Genode::Exception { };
|
|
|
|
Report(bool const &verbose,
|
|
Genode::Xml_node const node,
|
|
Timer::Connection &timer,
|
|
Domain_tree &domains,
|
|
Quota const &shared_quota,
|
|
Genode::Pd_session &pd,
|
|
Genode::Reporter &reporter);
|
|
|
|
void handle_config();
|
|
|
|
|
|
/***************
|
|
** Accessors **
|
|
***************/
|
|
|
|
bool config() const { return _config; }
|
|
bool bytes() const { return _bytes; }
|
|
bool stats() const { return _stats; }
|
|
};
|
|
|
|
#endif /* _REPORT_H_ */
|