genode/repos/base/src/core/include/trace/session_component.h
Norman Feske aa66b5d62f base: remove dependency from deprecated APIs
This patch adjusts the implementation of the base library and core such
that the code no longer relies on deprecated APIs except for very few
cases, mainly to keep those deprecated APIs in tact for now.

The most prominent changes are:

- Removing the use of base/printf.h

- Removing of the log backend for printf. The 'Console' with the
  format-string parser is still there along with 'snprintf.h' because
  the latter is still used at a few places, most prominently the
  'Connection' classes.

- Removing the notion of a RAM session, which does not exist in
  Genode anymore. Still the types were preserved (by typedefs to
  PD session) to keep up compatibility. But this transition should
  come to an end now.

- Slight rennovation of core's tracing service, e.g., the use of an
  Attached_dataspace as the Argument_buffer.

- Reducing the reliance on global accessors like deprecated_env() or
  core_env(). Still there is a longish way to go to eliminate all such
  calls. A useful pattern (or at least a stop-gap solution) is to
  pass the 'Env' to the individual compilation units via init functions.

- Avoiding the use of the old 'Child_policy::resolve_session_request'
  interface that returned a 'Service' instead of a 'Route'.

Issue #1987
2019-02-19 11:08:17 +01:00

91 lines
2.5 KiB
C++

/*
* \brief TRACE session implementation
* \author Norman Feske
* \date 2013-08-12
*/
/*
* Copyright (C) 2013-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 _CORE__INCLUDE__TRACE__SESSION_COMPONENT_H_
#define _CORE__INCLUDE__TRACE__SESSION_COMPONENT_H_
/* Genode includes */
#include <base/allocator_guard.h>
#include <base/rpc_server.h>
#include <base/tslab.h>
#include <base/attached_ram_dataspace.h>
#include <trace_session/trace_session.h>
/* core-local includes */
#include <trace/subject_registry.h>
#include <trace/policy_registry.h>
namespace Genode { namespace Trace { class Session_component; } }
class Genode::Trace::Session_component
:
public Genode::Rpc_object<Genode::Trace::Session,
Genode::Trace::Session_component>,
public Genode::Trace::Policy_owner
{
private:
Ram_allocator &_ram;
Region_map &_local_rm;
Allocator_guard _md_alloc;
Tslab<Trace::Subject, 4096> _subjects_slab;
Tslab<Trace::Policy, 4096> _policies_slab;
unsigned const _parent_levels;
Session_label const _label;
Source_registry &_sources;
Policy_registry &_policies;
Subject_registry _subjects;
unsigned _policy_cnt { 0 };
Attached_ram_dataspace _argument_buffer;
public:
/**
* Constructor
*/
Session_component(Ram_allocator &ram, Region_map &local_rm,
Allocator &md_alloc, size_t ram_quota,
size_t arg_buffer_size, unsigned parent_levels,
char const *label, Source_registry &sources,
Policy_registry &policies);
~Session_component();
/**
* Register quota donation at allocator guard
*/
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
/***********************
** Session interface **
***********************/
Dataspace_capability dataspace();
size_t subjects();
Policy_id alloc_policy(size_t);
Dataspace_capability policy(Policy_id);
void unload_policy(Policy_id);
void trace(Subject_id, Policy_id, size_t);
void rule(Session_label const &, Thread_name const &, Policy_id, size_t);
void pause(Subject_id);
void resume(Subject_id);
Subject_info subject_info(Subject_id);
Dataspace_capability buffer(Subject_id);
void free(Subject_id);
};
#endif /* _CORE__INCLUDE__TRACE__SESSION_COMPONENT_H_ */