2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Launcher entry widget
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-09-13
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LAUNCH_ENTRY_H_
|
|
|
|
#define _LAUNCH_ENTRY_H_
|
|
|
|
|
|
|
|
#include "loadbar.h"
|
|
|
|
#include "launcher_config.h"
|
|
|
|
|
|
|
|
template <typename PT>
|
2013-12-30 01:21:53 +01:00
|
|
|
class Launch_entry : public Scout::Parent_element, public Loadbar_listener
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2016-11-23 17:07:49 +01:00
|
|
|
Scout::Launcher::Name _prg_name;
|
2013-12-30 01:21:53 +01:00
|
|
|
Scout::Block _block;
|
|
|
|
Kbyte_loadbar<PT> _loadbar;
|
|
|
|
Scout::Launcher_config _config;
|
|
|
|
Scout::Launcher _launcher;
|
|
|
|
int _lh; /* launch entry height */
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
enum { _PTW = 100 }; /* program text width */
|
|
|
|
enum { _PADX = 10 }; /* program text width */
|
|
|
|
enum { _PADR = 16 }; /* right padding */
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
Capability quota accounting and trading
This patch mirrors the accounting and trading scheme that Genode employs
for physical memory to the accounting of capability allocations.
Capability quotas must now be explicitly assigned to subsystems by
specifying a 'caps=<amount>' attribute to init's start nodes.
Analogously to RAM quotas, cap quotas can be traded between clients and
servers as part of the session protocol. The capability budget of each
component is maintained by the component's corresponding PD session at
core.
At the current stage, the accounting is applied to RPC capabilities,
signal-context capabilities, and dataspace capabilities. Capabilities
that are dynamically allocated via core's CPU and TRACE service are not
yet covered. Also, the capabilities allocated by resource multiplexers
outside of core (like nitpicker) must be accounted by the respective
servers, which is not covered yet.
If a component runs out of capabilities, core's PD service prints a
warning to the log. To observe the consumption of capabilities per
component in detail, the PD service is equipped with a diagnostic
mode, which can be enabled via the 'diag' attribute in the target
node of init's routing rules. E.g., the following route enables the
diagnostic mode for the PD session of the "timer" component:
<default-route>
<service name="PD" unscoped_label="timer">
<parent diag="yes"/>
</service>
...
</default-route>
For subsystems based on a sub-init instance, init can be configured
to report the capability-quota information of its subsystems by
adding the attribute 'child_caps="yes"' to init's '<report>'
config node. Init's own capability quota can be reported by adding
the attribute 'init_caps="yes"'.
Fixes #2398
2017-05-08 21:35:43 +02:00
|
|
|
Launch_entry(Scout::Launcher::Name const &prg_name,
|
|
|
|
unsigned long caps, unsigned long initial_quota,
|
2014-12-15 11:42:40 +01:00
|
|
|
unsigned long max_quota, Launchpad *launchpad,
|
2011-12-22 16:19:25 +01:00
|
|
|
Genode::Dataspace_capability config_ds)
|
2013-12-30 01:21:53 +01:00
|
|
|
:
|
2016-11-23 17:07:49 +01:00
|
|
|
_prg_name(prg_name),
|
2013-12-30 01:21:53 +01:00
|
|
|
_block(Scout::Block::RIGHT), _loadbar(this, &Scout::label_font),
|
|
|
|
_config(config_ds),
|
Capability quota accounting and trading
This patch mirrors the accounting and trading scheme that Genode employs
for physical memory to the accounting of capability allocations.
Capability quotas must now be explicitly assigned to subsystems by
specifying a 'caps=<amount>' attribute to init's start nodes.
Analogously to RAM quotas, cap quotas can be traded between clients and
servers as part of the session protocol. The capability budget of each
component is maintained by the component's corresponding PD session at
core.
At the current stage, the accounting is applied to RPC capabilities,
signal-context capabilities, and dataspace capabilities. Capabilities
that are dynamically allocated via core's CPU and TRACE service are not
yet covered. Also, the capabilities allocated by resource multiplexers
outside of core (like nitpicker) must be accounted by the respective
servers, which is not covered yet.
If a component runs out of capabilities, core's PD service prints a
warning to the log. To observe the consumption of capabilities per
component in detail, the PD service is equipped with a diagnostic
mode, which can be enabled via the 'diag' attribute in the target
node of init's routing rules. E.g., the following route enables the
diagnostic mode for the PD session of the "timer" component:
<default-route>
<service name="PD" unscoped_label="timer">
<parent diag="yes"/>
</service>
...
</default-route>
For subsystems based on a sub-init instance, init can be configured
to report the capability-quota information of its subsystems by
adding the attribute 'child_caps="yes"' to init's '<report>'
config node. Init's own capability quota can be reported by adding
the attribute 'init_caps="yes"'.
Fixes #2398
2017-05-08 21:35:43 +02:00
|
|
|
_launcher(prg_name, launchpad, caps, initial_quota * 1024UL, &_config)
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2016-11-23 17:07:49 +01:00
|
|
|
_block.append_launchertext(_prg_name.string(), &Scout::link_style, &_launcher);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
_loadbar.max_value(max_quota);
|
|
|
|
_loadbar.value(initial_quota);
|
|
|
|
append(&_loadbar);
|
|
|
|
append(&_block);
|
2013-12-30 01:21:53 +01:00
|
|
|
|
|
|
|
_min_size = Scout::Area(_PTW + 100, _min_size.h());
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************
|
|
|
|
** Loadbar listener interface **
|
|
|
|
********************************/
|
|
|
|
|
|
|
|
void loadbar_changed(int mx)
|
|
|
|
{
|
2013-12-30 01:21:53 +01:00
|
|
|
int value = _loadbar.value_by_xpos(mx - _loadbar.abs_position().x());
|
2011-12-22 16:19:25 +01:00
|
|
|
_loadbar.value(value);
|
|
|
|
_loadbar.refresh();
|
|
|
|
_launcher.quota(1024 * (unsigned long)value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************
|
|
|
|
** Parent element interface **
|
|
|
|
******************************/
|
|
|
|
|
|
|
|
void format_fixed_width(int w)
|
|
|
|
{
|
2013-12-30 01:21:53 +01:00
|
|
|
using namespace Scout;
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
_block.format_fixed_width(_PTW);
|
2013-12-30 01:21:53 +01:00
|
|
|
_lh = _block.min_size().h();
|
|
|
|
_block.geometry(Rect(Point(max(10U, _PTW - _block.min_size().w()),
|
|
|
|
max(0U, (_lh - _block.min_size().h())/2)),
|
|
|
|
Area(min((unsigned)_PTW, _block.min_size().w()), _lh)));
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
int lw = max(0, w - 2*_PADX - _PTW - _PADR);
|
2013-12-30 01:21:53 +01:00
|
|
|
int ly = max(0U, (_lh - _loadbar.min_size().h())/2);
|
2011-12-22 16:19:25 +01:00
|
|
|
_loadbar.format_fixed_width(lw);
|
2013-12-30 01:21:53 +01:00
|
|
|
_loadbar.geometry(Rect(Point(_PADX + _PTW, ly), Area(lw, 16)));
|
|
|
|
|
|
|
|
_min_size = Scout::Area(w, _lh);
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|