mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-30 08:03:59 +00:00
parent
2bd873e2b4
commit
9269d09e18
@ -553,8 +553,6 @@ Platform::Platform()
|
||||
*/
|
||||
Info trace_source_info() const override
|
||||
{
|
||||
Genode::String<8> name("idle", affinity.xpos());
|
||||
|
||||
Genode::Thread * me = Genode::Thread::myself();
|
||||
addr_t const ipc_buffer = reinterpret_cast<addr_t>(me->utcb());
|
||||
seL4_IPCBuffer * ipcbuffer = reinterpret_cast<seL4_IPCBuffer *>(ipc_buffer);
|
||||
@ -563,29 +561,28 @@ Platform::Platform()
|
||||
seL4_BenchmarkGetThreadUtilisation(tcb_sel.value());
|
||||
uint64_t execution_time = buf[BENCHMARK_IDLE_TCBCPU_UTILISATION];
|
||||
|
||||
return { Session_label("kernel"), Trace::Thread_name(name),
|
||||
return { Session_label("kernel"), Trace::Thread_name("idle"),
|
||||
Trace::Execution_time(execution_time), affinity };
|
||||
}
|
||||
|
||||
Idle_trace_source(Platform &platform, Range_allocator &phys_alloc,
|
||||
Idle_trace_source(Trace::Source_registry ®istry,
|
||||
Platform &platform, Range_allocator &phys_alloc,
|
||||
Affinity::Location affinity)
|
||||
:
|
||||
Trace::Control(),
|
||||
Trace::Source(*this, *this), affinity(affinity)
|
||||
{
|
||||
Thread_info::init_tcb(platform, phys_alloc, 0, affinity.xpos());
|
||||
registry.insert(this);
|
||||
}
|
||||
|
||||
Trace::Source &source() { return *this; }
|
||||
};
|
||||
|
||||
Idle_trace_source *source = new (core_mem_alloc())
|
||||
Idle_trace_source(*this, *_core_mem_alloc.phys_alloc(),
|
||||
new (core_mem_alloc())
|
||||
Idle_trace_source(Trace::sources(), *this,
|
||||
*_core_mem_alloc.phys_alloc(),
|
||||
Affinity::Location(cpu_id, 0,
|
||||
affinity_space().width(),
|
||||
affinity_space().height()));
|
||||
|
||||
Trace::sources().insert(&source->source());
|
||||
}
|
||||
|
||||
/* I/O port allocator (only meaningful for x86) */
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include <platform.h>
|
||||
#include <platform_thread.h>
|
||||
#include <thread_sel4.h>
|
||||
#include <trace/source_registry.h>
|
||||
|
||||
/* seL4 includes */
|
||||
#include <sel4/benchmark_utilisation_types.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
@ -101,6 +105,41 @@ void Thread::start()
|
||||
{
|
||||
start_sel4_thread(Cap_sel(native_thread().tcb_sel), (addr_t)&_thread_start,
|
||||
(addr_t)stack_top(), _affinity.xpos());
|
||||
|
||||
struct Core_trace_source : public Trace::Source::Info_accessor,
|
||||
private Trace::Control,
|
||||
private Trace::Source
|
||||
{
|
||||
Thread &_thread;
|
||||
|
||||
/**
|
||||
* Trace::Source::Info_accessor interface
|
||||
*/
|
||||
Info trace_source_info() const override
|
||||
{
|
||||
Thread * const me = Thread::myself();
|
||||
seL4_IPCBuffer * const ipcbuffer = reinterpret_cast<seL4_IPCBuffer *>(me->utcb());
|
||||
uint64_t const * const buf = reinterpret_cast<uint64_t *>(ipcbuffer->msg);
|
||||
|
||||
seL4_BenchmarkGetThreadUtilisation(_thread.native_thread().tcb_sel);
|
||||
uint64_t const thread_time = buf[BENCHMARK_TCB_UTILISATION];
|
||||
|
||||
return { Session_label("core"), _thread.name(),
|
||||
Trace::Execution_time(thread_time), _thread._affinity };
|
||||
}
|
||||
|
||||
|
||||
Core_trace_source(Trace::Source_registry ®istry, Thread &t)
|
||||
:
|
||||
Trace::Control(),
|
||||
Trace::Source(*this, *this), _thread(t)
|
||||
{
|
||||
registry.insert(this);
|
||||
}
|
||||
};
|
||||
|
||||
new (*platform()->core_mem_alloc())
|
||||
Core_trace_source(Trace::sources(), *this);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user