core: provide thread exec times via TRACE service

This patch enable clients of core's TRACE service to obtain the
execution times of trace subjects (i.e., threads). The execution time is
delivered as part of the 'Subject_info' structure.

Right now, the feature is available solely on NOVA. On all other base
platforms, the returned execution times are 0.

Issue #813
This commit is contained in:
Norman Feske
2015-06-11 23:05:02 +02:00
committed by Christian Helmuth
parent fbe44f08d4
commit 959572968d
20 changed files with 226 additions and 51 deletions

View File

@ -45,7 +45,8 @@ namespace Genode {
class Cpu_thread_component : public Rpc_object<Cpu_thread>,
public List<Cpu_thread_component>::Element
public List<Cpu_thread_component>::Element,
public Trace::Source::Info_accessor
{
public:
@ -54,6 +55,7 @@ namespace Genode {
private:
Session_label const _session_label;
Thread_name const _name;
Platform_thread _platform_thread;
bool _bound; /* pd binding flag */
@ -72,15 +74,27 @@ namespace Genode {
unsigned trace_control_index,
Trace::Control &trace_control)
:
_name(name),
_session_label(label), _name(name),
_platform_thread(name.string(), priority, utcb), _bound(false),
_sigh(sigh), _trace_control_index(trace_control_index),
_trace_source(label, _name, trace_control)
_trace_source(*this, trace_control)
{
update_exception_sigh();
}
/********************************************
** Trace::Source::Info_accessor interface **
********************************************/
Trace::Source::Info trace_source_info() const
{
return { _session_label, _name,
_platform_thread.execution_time(),
_platform_thread.affinity() };
}
/************************
** Accessor functions **
************************/
@ -218,7 +232,7 @@ namespace Genode {
Dataspace_capability trace_buffer(Thread_capability);
Dataspace_capability trace_policy(Thread_capability);
int ref_account(Cpu_session_capability c);
int transfer_quota(Cpu_session_capability c, size_t q);
int transfer_quota(Cpu_session_capability, size_t);
Quota quota() override;

View File

@ -126,7 +126,7 @@ namespace Genode {
/**
* Request the affinity of this thread
*/
Affinity::Location affinity() { return Affinity::Location(); }
Affinity::Location affinity() const { return Affinity::Location(); }
/**
* Register process ID and thread ID of thread
@ -158,6 +158,11 @@ namespace Genode {
* Set CPU quota of the thread to 'quota'
*/
void quota(size_t const quota) { /* not supported*/ }
/**
* Return execution time consumed by the thread
*/
unsigned long long execution_time() const { return 0; }
};
}