diff --git a/repos/base-foc/src/core/include/cpu_session_component.h b/repos/base-foc/src/core/include/cpu_session_component.h index 9c3ceda0b8d..b60b173421e 100644 --- a/repos/base-foc/src/core/include/cpu_session_component.h +++ b/repos/base-foc/src/core/include/cpu_session_component.h @@ -92,7 +92,8 @@ namespace Genode { { return { _session_label, _name, _platform_thread.execution_time(), - _platform_thread.affinity() }; + _platform_thread.affinity(), + _platform_thread.prio() }; } @@ -245,6 +246,8 @@ namespace Genode { int transfer_quota(Cpu_session_capability, size_t); Quota quota() override; + void set(Ram_session_capability ram_cap); + /*********************************** ** Fiasco.OC specific extensions ** diff --git a/repos/base-foc/src/core/include/platform_thread.h b/repos/base-foc/src/core/include/platform_thread.h index 62bce146bc9..a46aa0818b4 100644 --- a/repos/base-foc/src/core/include/platform_thread.h +++ b/repos/base-foc/src/core/include/platform_thread.h @@ -175,9 +175,11 @@ namespace Genode { /** * Return execution time consumed by the thread */ - unsigned long long execution_time() const { return 0; } + unsigned long long execution_time() const; + unsigned prio() const; + /******************************* ** Fiasco-specific Accessors ** *******************************/ diff --git a/repos/base-foc/src/core/platform_thread.cc b/repos/base-foc/src/core/platform_thread.cc index 92d4a540275..e57265d2b20 100644 --- a/repos/base-foc/src/core/platform_thread.cc +++ b/repos/base-foc/src/core/platform_thread.cc @@ -266,6 +266,23 @@ Weak_ptr Platform_thread::address_space() } +unsigned long long Platform_thread::execution_time() const +{ + unsigned long long time = 0; + + if (_utcb) { + l4_thread_stats_time(_thread.local.dst()); + time = *(l4_kernel_clock_t*)&l4_utcb_mr()->mr[0]; + } + + return time; +} + +unsigned Platform_thread::prio() const +{ + return _prio; +} + Platform_thread::Platform_thread(const char *name, unsigned prio, addr_t) : _state(DEAD), _core_thread(false), diff --git a/repos/base/include/base/trace/types.h b/repos/base/include/base/trace/types.h index ec7c15ab37a..81ee5a86434 100644 --- a/repos/base/include/base/trace/types.h +++ b/repos/base/include/base/trace/types.h @@ -32,7 +32,8 @@ namespace Genode { namespace Trace { struct Policy_id; struct Subject_id; struct Execution_time; - struct Subject_info; + struct CPU_info; + struct RAM_info; } } @@ -81,7 +82,7 @@ struct Genode::Trace::Execution_time /** * Subject information */ -class Genode::Trace::Subject_info +class Genode::Trace::CPU_info { public: @@ -108,20 +109,23 @@ class Genode::Trace::Subject_info Policy_id _policy_id; Execution_time _execution_time; Affinity::Location _affinity; + unsigned _prio; public: - Subject_info() : _state(INVALID) { } + CPU_info() : _state(INVALID) { } - Subject_info(Session_label const &session_label, + CPU_info(Session_label const &session_label, Thread_name const &thread_name, State state, Policy_id policy_id, Execution_time execution_time, - Affinity::Location affinity) + Affinity::Location affinity, + unsigned prio + ) : _session_label(session_label), _thread_name(thread_name), _state(state), _policy_id(policy_id), - _execution_time(execution_time), _affinity(affinity) + _execution_time(execution_time), _affinity(affinity), _prio(prio) { } Session_label const &session_label() const { return _session_label; } @@ -130,6 +134,36 @@ class Genode::Trace::Subject_info Policy_id policy_id() const { return _policy_id; } Execution_time execution_time() const { return _execution_time; } Affinity::Location affinity() const { return _affinity; } + unsigned prio() const { return _prio; } +}; + +class Genode::Trace::RAM_info +{ + private: + + Session_label _session_label; + Thread_name _thread_name; + size_t _ram_quota; + size_t _ram_used; + + public: + + RAM_info() {} + + RAM_info(Session_label const &session_label, + Thread_name const &thread_name, + size_t ram_quota, + size_t ram_used + ) + : + _session_label(session_label), _thread_name(thread_name), + _ram_quota(ram_quota), _ram_used(ram_used) + { } + + Session_label const &session_label() const { return _session_label; } + Thread_name const &thread_name() const { return _thread_name; } + size_t ram_quota() const { return _ram_quota; } + size_t ram_used() const { return _ram_used; } }; #endif /* _INCLUDE__BASE__TRACE__TYPES_H_ */ diff --git a/repos/base/include/cpu_session/client.h b/repos/base/include/cpu_session/client.h index 9331e201c56..da638ebc026 100644 --- a/repos/base/include/cpu_session/client.h +++ b/repos/base/include/cpu_session/client.h @@ -32,6 +32,9 @@ struct Genode::Cpu_session_client : Rpc_client Ram_dataspace_capability utcb(Thread_capability thread) override { return call(thread); } + void set(Ram_session_capability ram_cap) override { + call(ram_cap); } + void kill_thread(Thread_capability thread) override { call(thread); } diff --git a/repos/base/include/cpu_session/cpu_session.h b/repos/base/include/cpu_session/cpu_session.h index 15496e0f30d..cb1d503fb73 100644 --- a/repos/base/include/cpu_session/cpu_session.h +++ b/repos/base/include/cpu_session/cpu_session.h @@ -299,6 +299,8 @@ struct Genode::Cpu_session : Session static size_t quota_lim_downscale(size_t const value, size_t const limit) { return ((T)value * limit) >> Cpu_session::QUOTA_LIMIT_LOG2; } + virtual void set(Ram_session_capability ram_cap) = 0; + /********************* ** RPC declaration ** *********************/ @@ -331,6 +333,7 @@ struct Genode::Cpu_session : Session GENODE_RPC(Rpc_ref_account, int, ref_account, Cpu_session_capability); GENODE_RPC(Rpc_transfer_quota, int, transfer_quota, Cpu_session_capability, size_t); GENODE_RPC(Rpc_quota, Quota, quota); + GENODE_RPC(Rpc_set, void, set, Ram_session_capability); /* * 'GENODE_RPC_INTERFACE' declaration done manually @@ -361,8 +364,9 @@ struct Genode::Cpu_session : Session Meta::Type_tuple - > > > > > > > > > > > > > > > > > > > > Rpc_functions; + > > > > > > > > > > > > > > > > > > > > > Rpc_functions; }; struct Genode::Cpu_session::Quota diff --git a/repos/base/include/ram_session/client.h b/repos/base/include/ram_session/client.h index 910b618fbdc..c37f101cfad 100644 --- a/repos/base/include/ram_session/client.h +++ b/repos/base/include/ram_session/client.h @@ -41,6 +41,8 @@ struct Genode::Ram_session_client : Rpc_client size_t quota() override { return call(); } size_t used() override { return call(); } + + void set_label(char *label) override { call(label); } }; #endif /* _INCLUDE__RAM_SESSION__CLIENT_H_ */ diff --git a/repos/base/include/ram_session/ram_session.h b/repos/base/include/ram_session/ram_session.h index 5cc41bd632a..e5046a0c709 100644 --- a/repos/base/include/ram_session/ram_session.h +++ b/repos/base/include/ram_session/ram_session.h @@ -120,6 +120,8 @@ struct Genode::Ram_session : Session return q > u ? q - u : 0; } + virtual void set_label(char *label) = 0; + /********************* ** RPC declaration ** @@ -133,9 +135,10 @@ struct Genode::Ram_session : Session GENODE_RPC(Rpc_transfer_quota, int, transfer_quota, Ram_session_capability, size_t); GENODE_RPC(Rpc_quota, size_t, quota); GENODE_RPC(Rpc_used, size_t, used); + GENODE_RPC(Rpc_set_label, void, set_label, char*); GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free, Rpc_ref_account, - Rpc_transfer_quota, Rpc_quota, Rpc_used); + Rpc_transfer_quota, Rpc_quota, Rpc_used, Rpc_set_label); }; #endif /* _INCLUDE__RAM_SESSION__RAM_SESSION_H_ */ diff --git a/repos/base/include/trace_session/client.h b/repos/base/include/trace_session/client.h index 9a1a95ec0df..7360b4aee68 100644 --- a/repos/base/include/trace_session/client.h +++ b/repos/base/include/trace_session/client.h @@ -95,8 +95,11 @@ struct Genode::Trace::Session_client : Genode::Rpc_client(subject); } - Subject_info subject_info(Subject_id subject) override { - return call(subject); } + CPU_info cpu_info(Subject_id subject) override { + return call(subject); } + + RAM_info ram_info(Subject_id subject) override { + return call(subject); } Dataspace_capability buffer(Subject_id subject) override { return call(subject); } diff --git a/repos/base/include/trace_session/trace_session.h b/repos/base/include/trace_session/trace_session.h index a693c3c5f85..568b172648b 100644 --- a/repos/base/include/trace_session/trace_session.h +++ b/repos/base/include/trace_session/trace_session.h @@ -82,7 +82,9 @@ struct Genode::Trace::Session : Genode::Session * * \throw Nonexistent_subject */ - virtual Subject_info subject_info(Subject_id) = 0; + virtual CPU_info cpu_info(Subject_id) = 0; + + virtual RAM_info ram_info(Subject_id) = 0; /** * Obtain trace buffer of given subject @@ -133,7 +135,9 @@ struct Genode::Trace::Session : Genode::Session Subject_id); GENODE_RPC_THROW(Rpc_subjects, size_t, subjects, GENODE_TYPE_LIST(Out_of_metadata)); - GENODE_RPC_THROW(Rpc_subject_info, Subject_info, subject_info, + GENODE_RPC_THROW(Rpc_cpu_info, CPU_info, cpu_info, + GENODE_TYPE_LIST(Nonexistent_subject), Subject_id); + GENODE_RPC_THROW(Rpc_ram_info, RAM_info, ram_info, GENODE_TYPE_LIST(Nonexistent_subject), Subject_id); GENODE_RPC_THROW(Rpc_buffer, Dataspace_capability, buffer, GENODE_TYPE_LIST(Nonexistent_subject, Subject_not_traced), @@ -150,11 +154,12 @@ struct Genode::Trace::Session : Genode::Session Meta::Type_tuple - > > > > > > > > > > > Rpc_functions; + > > > > > > > > > > > > Rpc_functions; }; #endif /* _INCLUDE__TRACE_SESSION__TRACE_SESSION_H_ */ diff --git a/repos/base/src/core/context_area.cc b/repos/base/src/core/context_area.cc index 3c9a30e2bfe..f86fd665977 100644 --- a/repos/base/src/core/context_area.cc +++ b/repos/base/src/core/context_area.cc @@ -146,6 +146,8 @@ class Context_area_ram_session : public Ram_session size_t quota() { return 0; } size_t used() { return 0; } + + void set_label(char *label) { } }; diff --git a/repos/base/src/core/cpu_session_component.cc b/repos/base/src/core/cpu_session_component.cc index 4f25a9fbc6a..adc35eb1d17 100644 --- a/repos/base/src/core/cpu_session_component.cc +++ b/repos/base/src/core/cpu_session_component.cc @@ -22,6 +22,8 @@ #include #include +#include + using namespace Genode; static constexpr bool verbose = false; @@ -332,6 +334,7 @@ void Cpu_session_component::_transfer_quota(Cpu_session_component * const dst, if (!quota) { return; } _decr_quota(quota); dst->_incr_quota(quota); + } @@ -361,7 +364,8 @@ int Cpu_session_component::transfer_quota(Cpu_session_capability dst_cap, /* transfer quota */ _transfer_quota(dst, quota); return 0; - }; + }; + return _session_ep->apply(dst_cap, lambda); } @@ -525,6 +529,11 @@ Cpu_session_component::_weight_to_quota(size_t const weight) const { return (weight * _quota) / _weight; } +void Cpu_session_component::set(Ram_session_capability ram_cap) +{ + Genode::Ram_connection::Ram_session_client ram(ram_cap); +} + /**************************** ** Trace::Source_registry ** ****************************/ diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h index 02da1d5afd8..3ff467b0462 100644 --- a/repos/base/src/core/include/core_env.h +++ b/repos/base/src/core/include/core_env.h @@ -31,6 +31,10 @@ #include #include +#include +#include +#include + namespace Genode { /** @@ -60,9 +64,10 @@ namespace Genode { Range_allocator *ram_alloc, Allocator *md_alloc, const char *args, + Trace::Source_registry &trace_sources, size_t quota_limit = 0) : - RAM_SESSION_IMPL(ds_ep, ram_session_ep, ram_alloc, md_alloc, args, quota_limit) + RAM_SESSION_IMPL(ds_ep, ram_session_ep, ram_alloc, md_alloc, args, trace_sources, quota_limit) { } @@ -104,6 +109,12 @@ namespace Genode { Lock::Guard lock_guard(_lock); return RAM_SESSION_IMPL::used(); } + + void set_label(char label[]) + { + Lock::Guard lock_guard(_lock); + RAM_SESSION_IMPL::set_label(label); + } }; @@ -128,16 +139,17 @@ namespace Genode { /** * Constructor */ - Core_env() : + Core_env(Trace::Source_registry trace_sources) : _cap_session(platform()->core_mem_alloc(), "ram_quota=4K"), _entrypoint(&_cap_session, ENTRYPOINT_STACK_SIZE, "entrypoint"), _rm_session(&_entrypoint), _ram_session(&_entrypoint, &_entrypoint, platform()->ram_alloc(), platform()->core_mem_alloc(), - "ram_quota=4M", platform()->ram_alloc()->avail()), + "ram_quota=4M", trace_sources, platform()->ram_alloc()->avail()), _heap(&_ram_session, &_rm_session), _ram_session_cap(_entrypoint.manage(&_ram_session)) - { } + { + } /** * Destructor @@ -178,6 +190,7 @@ namespace Genode { void reinit(Capability::Dst, long) { } void reinit_main_thread(Rm_session_capability &) { } + }; diff --git a/repos/base/src/core/include/cpu_root.h b/repos/base/src/core/include/cpu_root.h index 46a2c7839f7..c11d6787142 100644 --- a/repos/base/src/core/include/cpu_root.h +++ b/repos/base/src/core/include/cpu_root.h @@ -73,7 +73,8 @@ namespace Genode { Root_component(session_ep, md_alloc), _thread_ep(thread_ep), _pager_ep(pager_ep), _md_alloc(md_alloc), _trace_sources(trace_sources) - { } + { + } }; } diff --git a/repos/base/src/core/include/ram_root.h b/repos/base/src/core/include/ram_root.h index fa50fa6ee94..cdae14d301d 100644 --- a/repos/base/src/core/include/ram_root.h +++ b/repos/base/src/core/include/ram_root.h @@ -26,6 +26,7 @@ namespace Genode { Range_allocator *_ram_alloc; Rpc_entrypoint *_ds_ep; + Trace::Source_registry &_trace_sources; protected: @@ -33,7 +34,7 @@ namespace Genode { { return new (md_alloc()) Ram_session_component(_ds_ep, ep(), _ram_alloc, - md_alloc(), args); + md_alloc(), args, _trace_sources); } void _upgrade_session(Ram_session_component *ram, const char *args) @@ -55,10 +56,13 @@ namespace Genode { Ram_root(Rpc_entrypoint *session_ep, Rpc_entrypoint *ds_ep, Range_allocator *ram_alloc, - Allocator *md_alloc) + Allocator *md_alloc, + Trace::Source_registry &trace_sources) : Root_component(session_ep, md_alloc), - _ram_alloc(ram_alloc), _ds_ep(ds_ep) { } + _ram_alloc(ram_alloc), _ds_ep(ds_ep), _trace_sources(trace_sources) + { + } }; } diff --git a/repos/base/src/core/include/ram_session_component.h b/repos/base/src/core/include/ram_session_component.h index 82eb3ad8a13..49dad1e1697 100644 --- a/repos/base/src/core/include/ram_session_component.h +++ b/repos/base/src/core/include/ram_session_component.h @@ -20,10 +20,14 @@ #include #include #include +#include +#include /* core includes */ #include #include +#include +#include namespace Genode { @@ -53,6 +57,8 @@ namespace Genode { addr_t _phys_start; addr_t _phys_end; + Trace::Source_registry &_trace_sources; + enum { MAX_LABEL_LEN = 64 }; char _label[MAX_LABEL_LEN]; @@ -132,6 +138,7 @@ namespace Genode { Range_allocator *ram_alloc, Allocator *md_alloc, const char *args, + Trace::Source_registry &trace_sources, size_t quota_limit = 0); /** @@ -168,6 +175,7 @@ namespace Genode { int transfer_quota(Ram_session_capability, size_t); size_t quota() { return _quota_limit; } size_t used() { return _payload; } + void set_label(char *label); }; } diff --git a/repos/base/src/core/include/trace/session_component.h b/repos/base/src/core/include/trace/session_component.h index 9d2ab28a123..46086f69d99 100644 --- a/repos/base/src/core/include/trace/session_component.h +++ b/repos/base/src/core/include/trace/session_component.h @@ -100,7 +100,8 @@ class Genode::Trace::Session_component 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); + CPU_info cpu_info(Subject_id); + RAM_info ram_info(Subject_id); Dataspace_capability buffer(Subject_id); void free(Subject_id); }; diff --git a/repos/base/src/core/include/trace/source_registry.h b/repos/base/src/core/include/trace/source_registry.h index d503969fc62..c4be85138ac 100644 --- a/repos/base/src/core/include/trace/source_registry.h +++ b/repos/base/src/core/include/trace/source_registry.h @@ -56,6 +56,9 @@ class Genode::Trace::Source Thread_name name; Execution_time execution_time; Affinity::Location affinity; + unsigned prio; + size_t ram_quota; + size_t ram_used; }; /** @@ -74,6 +77,8 @@ class Genode::Trace::Source Dataspace_capability _policy; Dataspace_capability _buffer; Source_owner const *_owner = nullptr; + size_t _ram_quota=0; + size_t _ram_used=0; static unsigned _alloc_unique_id(); @@ -90,11 +95,29 @@ class Genode::Trace::Source lock_for_destruction(); } + void set_quota(size_t quota) + { + _ram_quota=quota; + } + + void set_used(size_t quota) + { + _ram_used=quota; + } + + /************************************* ** Interface used by TRACE service ** *************************************/ - Info const info() const { return _info.trace_source_info(); } + Info const info() const + { + + Info info=_info.trace_source_info(); + info.ram_quota=_ram_quota; + info.ram_used=_ram_used; + return info; + } void trace(Dataspace_capability policy, Dataspace_capability buffer) { @@ -158,8 +181,8 @@ class Genode::Trace::Source_registry void insert(Source *entry) { Lock::Guard guard(_lock); - _entries.insert(entry); + //PDBG("insert:%s", entry->info().label.string()); } void remove(Source *entry) @@ -167,6 +190,50 @@ class Genode::Trace::Source_registry Lock::Guard guard(_lock); _entries.remove(entry); } + + void set_quota(size_t _ram_quota, String<160> _label) + { + Lock::Guard guard(_lock); + if(strcmp(_label.string(), "")==0) { _label="core";} + Source *entry=_entries.first(); + Trace::Source::Info info=entry->info(); + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_quota(_ram_quota); + } + while(entry->next()!=NULL) { + entry=entry->next(); + info=entry->info(); + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_quota(_ram_quota); + } + } + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_quota(_ram_quota); + } + } + + void set_used(size_t _ram_used, String<160> _label) + { + Lock::Guard guard(_lock); + if(strcmp(_label.string(), "")==0) { _label="core";} + Source *entry=_entries.first(); + Trace::Source::Info info=entry->info(); + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_used(_ram_used); + } + while(entry->next()!=NULL) { + entry=entry->next(); + info=entry->info(); + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_used(_ram_used); + } + } + if(strcmp(info.label.string(), _label.string())==0) { + entry->set_used(_ram_used); + } + + + } /************************************* diff --git a/repos/base/src/core/include/trace/subject_registry.h b/repos/base/src/core/include/trace/subject_registry.h index caafcb27f35..5bbfba1442e 100644 --- a/repos/base/src/core/include/trace/subject_registry.h +++ b/repos/base/src/core/include/trace/subject_registry.h @@ -139,21 +139,21 @@ class Genode::Trace::Subject Ram_dataspace _policy; Policy_id _policy_id; - Subject_info::State _state() + CPU_info::State _state() { Locked_ptr source(_source); /* source vanished */ if (!source.is_valid()) - return Subject_info::DEAD; + return CPU_info::DEAD; if (source->enabled()) - return source->is_owned_by(this) ? Subject_info::TRACED - : Subject_info::FOREIGN; + return source->is_owned_by(this) ? CPU_info::TRACED + : CPU_info::FOREIGN; if (source->error()) - return Subject_info::ERROR; + return CPU_info::ERROR; - return Subject_info::UNTRACED; + return CPU_info::UNTRACED; } public: @@ -234,10 +234,11 @@ class Genode::Trace::Subject source->enable(); } - Subject_info info() + CPU_info info_cpu() { Execution_time execution_time; Affinity::Location affinity; + unsigned prio=100; { Locked_ptr source(_source); @@ -246,11 +247,33 @@ class Genode::Trace::Subject Trace::Source::Info const info = source->info(); execution_time = info.execution_time; affinity = info.affinity; + prio=info.prio; } } + CPU_info info= CPU_info(_label, _name, _state(), _policy_id, + execution_time, affinity, prio + ); + return info; + } + + RAM_info info_ram() + { + size_t ram_quota; + size_t ram_used; + + { + Locked_ptr source(_source); - return Subject_info(_label, _name, _state(), _policy_id, - execution_time, affinity); + if (source.is_valid()) { + Trace::Source::Info const info = source->info(); + ram_quota= info.ram_quota; + ram_used= info.ram_used; + } + } + RAM_info info= RAM_info(_label, _name, + ram_quota, ram_used + ); + return info; } Dataspace_capability buffer() const { return _buffer.dataspace(); } diff --git a/repos/base/src/core/main.cc b/repos/base/src/core/main.cc index 59c7c093e1c..f44b76fdfe1 100644 --- a/repos/base/src/core/main.cc +++ b/repos/base/src/core/main.cc @@ -40,6 +40,16 @@ using namespace Genode; +/******************* + ** Trace support ** + *******************/ + +Trace::Source_registry &Trace::sources() +{ + static Trace::Source_registry inst; + return inst; +} + /* pool of provided core services */ static Service_registry local_services; @@ -60,7 +70,7 @@ Core_env * Genode::core_env() * By placing the environment as static object here, we ensure that its * constructor gets called when this function is used the first time. */ - static Core_env _env; + static Core_env _env(Trace::sources()); return &_env; } @@ -169,15 +179,6 @@ class Core_child : public Child_policy }; -/******************* - ** Trace support ** - *******************/ - -Trace::Source_registry &Trace::sources() -{ - static Trace::Source_registry inst; - return inst; -} /*************** @@ -224,7 +225,8 @@ int main() local_services.insert(&signal_service); static Cap_root cap_root (e, &sliced_heap); - static Ram_root ram_root (e, e, platform()->ram_alloc(), &sliced_heap); + static Ram_root ram_root (e, e, platform()->ram_alloc(), &sliced_heap, + Trace::sources()); static Rom_root rom_root (e, e, platform()->rom_fs(), &sliced_heap); static Rm_root rm_root (e, e, e, &sliced_heap, core_env()->cap_session(), platform()->vm_start(), platform()->vm_size()); @@ -276,6 +278,10 @@ int main() Ram_session_capability init_ram_session_cap = static_cap_cast(ram_root.session("ram_quota=32K", Affinity())); Ram_session_client(init_ram_session_cap).ref_account(env()->ram_session_cap()); + char tmp[64] = "abc\0"; + Ram_session_client(init_ram_session_cap).set_label(tmp); + + //Ram_session_client(init_ram_session_cap).set_label("abc123"); /* create CPU session for init and transfer all of the CPU quota to it */ static Cpu_session_component diff --git a/repos/base/src/core/ram_session_component.cc b/repos/base/src/core/ram_session_component.cc index 2ef658fb0a2..04a4a965da9 100644 --- a/repos/base/src/core/ram_session_component.cc +++ b/repos/base/src/core/ram_session_component.cc @@ -87,6 +87,17 @@ int Ram_session_component::_transfer_quota(Ram_session_component *dst, size_t am _quota_limit -= amount; + if(strcmp(_label, "")!=0) { + //printf("I am %s, I have %d, I use %d\n", _label, _quota_limit, _payload); + _trace_sources.set_quota(_quota_limit, _label); + } else { + //PDBG("empty label quota:%d used%d", _quota_limit, _payload); + + } + if(strcmp(_label, "i")!=0) { + //PDBG("init changed"); + } + /* increase quota_limit of recipient */ dst->_quota_limit += amount; @@ -220,6 +231,16 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr /* keep track of the used quota for actual payload */ _payload += ds_size; + if(strcmp(_label, "")!=0) { + _trace_sources.set_used(_payload, _label); + } else { + //PDBG("empty label quota:%d used%d", _quota_limit, _payload); + //_trace_sources.set_quota(_quota_limit, "init"); + } + if(strcmp(_label, "i")!=0) { + //PDBG("init changed"); + } + return static_cap_cast(result); } @@ -268,16 +289,20 @@ Ram_session_component::Ram_session_component(Rpc_entrypoint *ds_ep, Range_allocator *ram_alloc, Allocator *md_alloc, const char *args, + Trace::Source_registry &trace_sources, size_t quota_limit) : _ds_ep(ds_ep), _ram_session_ep(ram_session_ep), _ram_alloc(ram_alloc), _quota_limit(quota_limit), _payload(0), _md_alloc(md_alloc, Arg_string::find_arg(args, "ram_quota").ulong_value(0)), _ds_slab(&_md_alloc), _ref_account(0), - _phys_start(Arg_string::find_arg(args, "phys_start").ulong_value(0)) + _phys_start(Arg_string::find_arg(args, "phys_start").ulong_value(0)), + _trace_sources(trace_sources) { Arg_string::find_arg(args, "label").string(_label, sizeof(_label), ""); + //PDBG("%s", _label); + size_t phys_size = Arg_string::find_arg(args, "phys_size").ulong_value(0); /* sanitize overflow and interpret phys_size==0 as maximum phys address */ if (_phys_start + phys_size <= _phys_start) @@ -286,6 +311,12 @@ Ram_session_component::Ram_session_component(Rpc_entrypoint *ds_ep, _phys_end = _phys_start + phys_size - 1; } +void Ram_session_component::set_label(char *label) +{ + label="init\0"; + strncpy(_label, label, 64); +} + Ram_session_component::~Ram_session_component() { diff --git a/repos/base/src/core/trace_session_component.cc b/repos/base/src/core/trace_session_component.cc index e0e25b7fbbb..db1e51f9a89 100644 --- a/repos/base/src/core/trace_session_component.cc +++ b/repos/base/src/core/trace_session_component.cc @@ -127,9 +127,16 @@ void Session_component::resume(Subject_id subject_id) } -Subject_info Session_component::subject_info(Subject_id subject_id) +CPU_info Session_component::cpu_info(Subject_id subject_id) { - return _subjects.lookup_by_id(subject_id)->info(); + return _subjects.lookup_by_id(subject_id)->info_cpu(); + +} + +RAM_info Session_component::ram_info(Subject_id subject_id) +{ + return _subjects.lookup_by_id(subject_id)->info_ram(); + } diff --git a/repos/base/src/lib/ldso/linux-32.ld b/repos/base/src/lib/ldso/linux-32.ld new file mode 100644 index 00000000000..4e1d54bd67e --- /dev/null +++ b/repos/base/src/lib/ldso/linux-32.ld @@ -0,0 +1,20 @@ +/** + * \brief Linker script for Linux + * \author Sebastian Sumpf + * \date 2015-12-08 + * + * On Linux 32 bit, we remove the ".text.crt0" section because it contains a + * text relocation and is not used as startup code for the dynamic linker. + */ + +/* + * Copyright (C) 2009-2015 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. + */ + +SECTIONS +{ + /DISCARD/ : { *(.text.crt0) } +}