Discussion:
Fiasco.OC thread execution time
Georg Guba
2016-02-22 17:38:51 UTC
Permalink
I'm trying to implement Platform_thread::execution_time() for Fiasco.OC.
However, when using the code below, I'm getting a null pointer error when
trying to read the UTCB's message register:

Possible null pointer READ at 0 IP 704c0d7c

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;
}

The doc for l4_thread_stats_time(...) says

/**
* \brief Get consumed timed of thread in µs.
* \ingroup l4_thread_api
* \param thread Thread to get the consumed time from.
*
* The consumed time is returned as l4_kernel_clock_t at UTCB message
* register 0.
*/
L4_INLINE l4_msgtag_t
l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;

So my usage should be about right.
What am I missing?
Stefan Kalkowski
2016-02-23 08:53:17 UTC
Permalink
Hello Georg,
Post by Georg Guba
I'm trying to implement Platform_thread::execution_time() for Fiasco.OC.
However, when using the code below, I'm getting a null pointer error when
Possible null pointer READ at 0 IP 704c0d7c
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;
}
The doc for l4_thread_stats_time(...) says
/**
* \brief Get consumed timed of thread in µs.
* \ingroup l4_thread_api
* \param thread Thread to get the consumed time from.
*
* The consumed time is returned as l4_kernel_clock_t at UTCB message
* register 0.
*/
L4_INLINE l4_msgtag_t
l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;
So my usage should be about right.
What am I missing?
although, this is a bit off-topic and I did not used the mentioned
kernel feature till now (you might refer to the l4-hackers mailing-list
when having further questions regarding Fiasco.OC and L4Re), I'll try to
help you.

It seems you expected a pointer in the UTCB to the time structure, but
it is surely a value (the kernel wouldn't know where to deposit the
value aside of the UTCB, it doesn't do memory allocations on behalf of
user tasks).

When searching for the right usage of "l4_thread_stats_time", I came
across this post on the l4-hackers mailinglist:
http://os.inf.tu-dresden.de/pipermail/l4-hackers/2012/005419.html

I hope it helps.

Regards
Stefan
Post by Georg Guba
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ · http://genode.org/
Georg Guba
2016-02-23 09:20:12 UTC
Permalink
Hello Stefan,

oh wow. What a beginner's mistake. Thank you. Of course I cast the message
register wrong (missing a & there). It seems to be working now:

time = *(l4_kernel_clock_t*)&l4_utcb_mr()->mr[0];

Thanks a lot.

Best regards,
Georg

On 23 February 2016 at 09:53, Stefan Kalkowski <
Post by Stefan Kalkowski
Hello Georg,
Post by Georg Guba
I'm trying to implement Platform_thread::execution_time() for Fiasco.OC.
However, when using the code below, I'm getting a null pointer error when
Possible null pointer READ at 0 IP 704c0d7c
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;
}
The doc for l4_thread_stats_time(...) says
/**
* \brief Get consumed timed of thread in µs.
* \ingroup l4_thread_api
* \param thread Thread to get the consumed time from.
*
* The consumed time is returned as l4_kernel_clock_t at UTCB message
* register 0.
*/
L4_INLINE l4_msgtag_t
l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;
So my usage should be about right.
What am I missing?
although, this is a bit off-topic and I did not used the mentioned
kernel feature till now (you might refer to the l4-hackers mailing-list
when having further questions regarding Fiasco.OC and L4Re), I'll try to
help you.
It seems you expected a pointer in the UTCB to the time structure, but
it is surely a value (the kernel wouldn't know where to deposit the
value aside of the UTCB, it doesn't do memory allocations on behalf of
user tasks).
When searching for the right usage of "l4_thread_stats_time", I came
http://os.inf.tu-dresden.de/pipermail/l4-hackers/2012/005419.html
I hope it helps.
Regards
Stefan
------------------------------------------------------------------------------
Post by Georg Guba
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs
http://www.genode-labs.com/ · http://genode.org/
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Reinier Millo Sánchez
2016-04-19 04:00:46 UTC
Permalink
Hi Georg

I'm trying to use your implementation of execution_time on GenodeOS for
base-foc.
I want to measure the execution time of an application inside itself at
certain points to make some benchmarks. I'm reviewing how to call the
function within the same application in which I want to measure time,
but I don't have found way to do it.
If you can help me or recomend me some references.

Best regards
Post by Georg Guba
Hello Stefan,
oh wow. What a beginner's mistake. Thank you. Of course I cast the
time = *(l4_kernel_clock_t*)&l4_utcb_mr()->mr[0];
Thanks a lot.
Best regards,
Georg
On 23 February 2016 at 09:53, Stefan Kalkowski
Hello Georg,
Post by Georg Guba
I'm trying to implement Platform_thread::execution_time() for
Fiasco.OC.
Post by Georg Guba
However, when using the code below, I'm getting a null pointer
error when
Post by Georg Guba
Possible null pointer READ at 0 IP 704c0d7c
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;
}
The doc for l4_thread_stats_time(...) says
/**
* \brief Get consumed timed of thread in µs.
* \ingroup l4_thread_api
* \param thread Thread to get the consumed time from.
*
* The consumed time is returned as l4_kernel_clock_t at UTCB message
* register 0.
*/
L4_INLINE l4_msgtag_t
l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;
So my usage should be about right.
What am I missing?
although, this is a bit off-topic and I did not used the mentioned
kernel feature till now (you might refer to the l4-hackers
mailing-list
when having further questions regarding Fiasco.OC and L4Re), I'll try to
help you.
It seems you expected a pointer in the UTCB to the time structure, but
it is surely a value (the kernel wouldn't know where to deposit the
value aside of the UTCB, it doesn't do memory allocations on behalf of
user tasks).
When searching for the right usage of "l4_thread_stats_time", I came
http://os.inf.tu-dresden.de/pipermail/l4-hackers/2012/005419.html
I hope it helps.
Regards
Stefan
------------------------------------------------------------------------------
Post by Georg Guba
Site24x7 APM Insight: Get Deep Visibility into Application
Performance
Post by Georg Guba
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs
http://www.genode-labs.com/ · http://genode.org/
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Lic. Reinier Millo Sánchez
Centro de Estudios de Informática
Universidad Central "Marta Abreu" de Las Villas
Carretera a Camajuaní Km 5 1/2
Santa Clara, Villa Clara, Cuba
CP 54830

"antes de discutir ... respira;
antes de hablar ... escucha;
antes de escribir ... piensa;
antes de herir ... siente;
antes de rendirte ... intenta;
antes de morir ... vive"
Georg Guba
2016-04-19 23:15:54 UTC
Permalink
Hello Reinier,

check out repos/os/src/test/trace/main.cc
This test shows how to get trace subject information including untraced
subjects. Specifically, look at line 215+ (on Genode 15.11).

The full diff for my Fiasco.OC execution time patch is the following. I'll
submit a pull request for it soon.

diff --git a/repos/base-foc/src/core/include/platform_thread.h
b/repos/base-foc/src/core/include/platform_thread.h
index 62bce14..b33b0a5 100644
--- a/repos/base-foc/src/core/include/platform_thread.h
+++ b/repos/base-foc/src/core/include/platform_thread.h
@@ -175,7 +175,7 @@ namespace Genode {
/**
* Return execution time consumed by the thread
*/
- unsigned long long execution_time() const { return 0; }
+ unsigned long long execution_time() const;
/*******************************
diff --git a/repos/base-foc/src/core/platform_thread.cc
b/repos/base-foc/src/core/platform_thread.cc
index 92d4a54..ef388af 100644
--- a/repos/base-foc/src/core/platform_thread.cc
+++ b/repos/base-foc/src/core/platform_thread.cc
@@ -266,6 +266,19 @@ Weak_ptr<Address_space>
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;
+}
+
+
Platform_thread::Platform_thread(const char *name, unsigned prio, addr_t)
: _state(DEAD),
_core_thread(false),
Hi Georg
I'm trying to use your implementation of execution_time on GenodeOS for
base-foc.
I want to measure the execution time of an application inside itself at
certain points to make some benchmarks. I'm reviewing how to call the
function within the same application in which I want to measure time, but I
don't have found way to do it.
If you can help me or recomend me some references.
Best regards
Hello Stefan,
oh wow. What a beginner's mistake. Thank you. Of course I cast the message
time = *(l4_kernel_clock_t*)&l4_utcb_mr()->mr[0];
Thanks a lot.
Best regards,
Georg
On 23 February 2016 at 09:53, Stefan Kalkowski <
Post by Stefan Kalkowski
Hello Georg,
Post by Georg Guba
I'm trying to implement Platform_thread::execution_time() for Fiasco.OC.
However, when using the code below, I'm getting a null pointer error
when
Post by Georg Guba
Possible null pointer READ at 0 IP 704c0d7c
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;
}
The doc for l4_thread_stats_time(...) says
/**
* \brief Get consumed timed of thread in µs.
* \ingroup l4_thread_api
* \param thread Thread to get the consumed time from.
*
* The consumed time is returned as l4_kernel_clock_t at UTCB message
* register 0.
*/
L4_INLINE l4_msgtag_t
l4_thread_stats_time(l4_cap_idx_t thread) L4_NOTHROW;
So my usage should be about right.
What am I missing?
although, this is a bit off-topic and I did not used the mentioned
kernel feature till now (you might refer to the l4-hackers mailing-list
when having further questions regarding Fiasco.OC and L4Re), I'll try to
help you.
It seems you expected a pointer in the UTCB to the time structure, but
it is surely a value (the kernel wouldn't know where to deposit the
value aside of the UTCB, it doesn't do memory allocations on behalf of
user tasks).
When searching for the right usage of "l4_thread_stats_time", I came
http://os.inf.tu-dresden.de/pipermail/l4-hackers/2012/005419.html
I hope it helps.
Regards
Stefan
------------------------------------------------------------------------------
Post by Georg Guba
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs
http://www.genode-labs.com/ · <http://genode.org/>http://genode.org/
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
--
Lic. Reinier Millo Sánchez
Centro de Estudios de Informática
Universidad Central "Marta Abreu" de Las Villas
Carretera a Camajuaní Km 5 1/2
Santa Clara, Villa Clara, Cuba
CP 54830
"antes de discutir ... respira;
antes de hablar ... escucha;
antes de escribir ... piensa;
antes de herir ... siente;
antes de rendirte ... intenta;
antes de morir ... vive"
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Loading...