genode/repos/gems/src/server/cpu_sampler/cpu_root.h
Norman Feske cfdbccc5c2 Remove blocking calls from root and parent RPCs
This is a redesign of the root and parent interfaces to eliminate
blocking RPC calls.

- New session representation at the parent (base/session_state.h)
- base-internal root proxy mechanism as migration path
- Redesign of base/service.h
- Removes ancient 'Connection::KEEP_OPEN' feature
- Interface change of 'Child', 'Child_policy', 'Slave', 'Slave_policy'
- New 'Slave::Connection'
- Changed child-construction procedure to be compatible with the
  non-blocking parent interface and to be easier to use
- The child's initial LOG session, its binary ROM session, and the
  linker ROM session have become part of the child's envirenment.
- Session upgrading must now be performed via 'env.upgrade' instead
  of performing a sole RPC call the parent. To make RAM upgrades
  easier, the 'Connection' provides a new 'upgrade_ram' method.

Issue #2120
2016-11-25 16:06:42 +01:00

75 lines
2.0 KiB
C++

/*
* \brief CPU root interface
* \author Christian Prochaska
* \date 2016-01-19
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _CPU_ROOT_H_
#define _CPU_ROOT_H_
/* Genode includes */
#include <root/component.h>
/* local includes */
#include "cpu_session_component.h"
#include "cpu_thread_component.h"
#include "thread_list_change_handler.h"
namespace Cpu_sampler {
using namespace Genode;
class Cpu_root;
}
class Cpu_sampler::Cpu_root : public Root_component<Cpu_session_component>
{
private:
Rpc_entrypoint &_thread_ep;
Env &_env;
Allocator &_md_alloc;
Thread_list &_thread_list;
Thread_list_change_handler &_thread_list_change_handler;
protected:
Cpu_session_component *_create_session(const char *args) override
{
Cpu_session_component *cpu_session_component =
new (md_alloc()) Cpu_session_component(_thread_ep, _env,
_md_alloc, _thread_list,
_thread_list_change_handler,
args);
return cpu_session_component;
}
void _upgrade_session(Cpu_session_component *cpu, const char *args) override
{
size_t ram_quota = Arg_string::find_arg(args, "ram_quota").ulong_value(0);
cpu->upgrade_ram_quota(ram_quota);
}
public:
Cpu_root(Rpc_entrypoint &session_ep,
Rpc_entrypoint &thread_ep,
Env &env,
Allocator &md_alloc,
Thread_list &thread_list,
Thread_list_change_handler &thread_list_change_handler)
: Root_component<Cpu_session_component>(&session_ep, &md_alloc),
_thread_ep(thread_ep), _env(env),
_md_alloc(md_alloc),
_thread_list(thread_list),
_thread_list_change_handler(thread_list_change_handler) { }
};
#endif /* _CPU_ROOT_H_ */