trace: support more facets of execution time

- execution time per thread context
- execution time per scheduling context
- quantum and priority

Issue #3192
This commit is contained in:
Alexander Boettcher
2017-09-11 13:03:28 +02:00
committed by Christian Helmuth
parent 66f49e6c42
commit ae16edf1d6
21 changed files with 74 additions and 42 deletions

View File

@ -51,8 +51,11 @@ Platform_thread::~Platform_thread()
}
void Platform_thread::quota(size_t const quota) {
Kernel::thread_quota(_kobj.kernel_object(), quota); }
void Platform_thread::quota(size_t const quota)
{
_quota = quota;
Kernel::thread_quota(_kobj.kernel_object(), quota);
}
Platform_thread::Platform_thread(Label const &label, Native_utcb &utcb)
@ -86,8 +89,10 @@ Platform_thread::Platform_thread(size_t const quota,
_pd(nullptr),
_pager(nullptr),
_utcb_pd_addr((Native_utcb *)utcb),
_priority(_scale_priority(virt_prio)),
_quota(quota),
_main_thread(false),
_kobj(true, _priority(virt_prio), quota, _label.string())
_kobj(true, _priority, _quota, _label.string())
{
try {
_utcb = core_env().pd_session()->alloc(sizeof(Native_utcb), CACHED);

View File

@ -18,6 +18,7 @@
/* Genode includes */
#include <base/ram_allocator.h>
#include <base/thread.h>
#include <base/trace/types.h>
/* base-internal includes */
#include <base/internal/native_utcb.h>
@ -58,6 +59,8 @@ namespace Genode {
Native_utcb * _utcb_core_addr { }; /* UTCB addr in core */
Native_utcb * _utcb_pd_addr; /* UTCB addr in pd */
Ram_dataspace_capability _utcb { }; /* UTCB dataspace */
unsigned _priority {0};
unsigned _quota {0};
/*
* Wether this thread is the main thread of a program.
@ -83,7 +86,7 @@ namespace Genode {
*/
bool _attaches_utcb_by_itself();
unsigned _priority(unsigned virt_prio)
unsigned _scale_priority(unsigned virt_prio)
{
return Cpu_session::scale_priority(Kernel::Cpu_priority::MAX,
virt_prio);
@ -205,7 +208,8 @@ namespace Genode {
/**
* Return execution time consumed by the thread
*/
unsigned long long execution_time() const { return 0; }
Trace::Execution_time execution_time() const {
return { 0, 0, _quota, _priority }; }
/***************