Hello,
I want to measure execution time of a function in the secure world of tz_vmm demo. I was wondering if I could use elapsed_ms( ) method in timer_session to measure t1 and t2 so that I can take the difference (t2 -t1). Is there any other way?
Best regards, John
The function elapsed_ms gives you the time that has passed since the creation of the corresponding timer session. So, yes, you can measure time intervals with this if you use the same session for t1 and t2.
If you merely aim for performance comparison and are not interested in concrete time values, you could also use the performance counter. The performance counter is enabled by adding the specifier 'perf_counter' to your <build_dir>/etc/specs.conf file. Once enabled, the performance counter is fully accessible by the (secure world) userland.
Cheers, Martin
Am 16.08.2016 um 00:25 schrieb John David:
Hello,
I want to measure execution time of a function in the secure world of tz_vmm demo. I was wondering if I could use elapsed_ms( ) method in timer_session to measure t1 and t2 so that I can take the difference (t2 -t1). Is there any other way?
Best regards, John
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Dear Martin,
Thanks a lot for your answers.
I wanted to use the performance counter for more performance measurements such as cache-misses, but I don't know how to access and use it in the secure world userland. Could you please give me some hints? is there any reading material on this?
Thanks,
On Thu, Aug 18, 2016 at 9:35 AM, Martin Stein <martin.stein@...1...> wrote:
The function elapsed_ms gives you the time that has passed since the creation of the corresponding timer session. So, yes, you can measure time intervals with this if you use the same session for t1 and t2.
If you merely aim for performance comparison and are not interested in concrete time values, you could also use the performance counter. The performance counter is enabled by adding the specifier 'perf_counter' to your <build_dir>/etc/specs.conf file. Once enabled, the performance counter is fully accessible by the (secure world) userland.
Cheers, Martin
Am 16.08.2016 um 00:25 schrieb John David:
Hello,
I want to measure execution time of a function in the secure world of tz_vmm demo. I was wondering if I could use elapsed_ms( ) method in timer_session to measure t1 and t2 so that I can take the difference (t2 -t1). Is there any other way?
Best regards, John
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hi John,
Am 20.09.2016 um 01:46 schrieb John David:
Dear Martin,
Thanks a lot for your answers.
I wanted to use the performance counter for more performance measurements such as cache-misses, but I don't know how to access and
I forgot to mention that you could also transform the performance counter values into time values. On ARMv7 the counter counts every single CPU cycle. Thus, you can use SECONDS = PERF_COUNTER / CPU_FREQUENCY.
use it in the secure world userland. Could you please give me some
If you have the performance counter enabled in the SPECS, you can include 'trace/timestamp.h' and read a timestamp via 'Genode::Trace::Timestamp Genode::Trace::timestamp();'.
hints? is there any reading material on this?
I think [1] illustrates the use of the timestamp/performance counter pretty good. The only document I could find to read about perfomance counter access in general is the ARMv7 Manual [2] paragraph "C12.7 Counter access". If you have further questions, don't hesitate to ask.
Cheers, Martin
[1] base-nova/src/test/platform/main.cc [2] http://liris.cnrs.fr/~mmrissa/lib/exe/fetch.php?media=armv7-a-r-manual.pdf
Hi Martin,
Thanks a lot. I have tried to measure and print the performance counter value on as follows ( i.MX53QSB)
*Trace::Timestamp start = Trace::timestamp();*
* my_funciton();*
* Trace::Timestamp end = Trace::timestamp(); printf("CPU_cyces= %lu\n",(end-start));*
I have tried with *printf(%zu),* *printf(%llu)* and *printf("%"PRIu32) *format but the maximum number of digits what I can get is 10. I wonder what format can be used if the performance counter value is larger than 10 digits. To calculate the elapsed time, I multiply the *CPU_cycles by 1 nanosecod (ns) / cycle. *Is that right?
Thanks,
On Tue, Sep 20, 2016 at 11:32 AM, Martin Stein <martin.stein@...1...
wrote:
Hi John,
Am 20.09.2016 um 01:46 schrieb John David:
Dear Martin,
Thanks a lot for your answers.
I wanted to use the performance counter for more performance measurements such as cache-misses, but I don't know how to access and
I forgot to mention that you could also transform the performance counter values into time values. On ARMv7 the counter counts every single CPU cycle. Thus, you can use SECONDS = PERF_COUNTER / CPU_FREQUENCY.
use it in the secure world userland. Could you please give me some
If you have the performance counter enabled in the SPECS, you can include 'trace/timestamp.h' and read a timestamp via 'Genode::Trace::Timestamp Genode::Trace::timestamp();'.
hints? is there any reading material on this?
I think [1] illustrates the use of the timestamp/performance counter pretty good. The only document I could find to read about perfomance counter access in general is the ARMv7 Manual [2] paragraph "C12.7 Counter access". If you have further questions, don't hesitate to ask.
Cheers, Martin
[1] base-nova/src/test/platform/main.cc [2] http://liris.cnrs.fr/~mmrissa/lib/exe/fetch.php?media=armv7-a-r-manual.pdf
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hi John,
Am 25.10.2016 um 03:53 schrieb John David:
Hi Martin,
Thanks a lot. I have tried to measure and print the performance counter value on as follows ( i.MX53QSB)
/Trace::Timestamp start = Trace::timestamp();
/ / my_funciton(); / / Trace::Timestamp end = Trace::timestamp();
printf("CPU_cyces= %lu\n",(end-start));/
I have tried with /printf(%zu),/ /printf(%llu)/ and /printf("%"PRIu32) /format but the maximum number of digits what I can get is 10. I wonder what format can be used if the performance counter value is larger than 10 digits. To calculate the elapsed time, I multiply the /CPU_cycles by 1 nanosecod (ns) / cycle. /Is that right?
Thanks,
As you are on an ARMv7, Timestamp is a uint32_t. So, %u is sufficient but the value never exceeds ten digits as the maximum uint32_t (0xffffffff) is 4294967295 decimal. So it seems that your performance counter is to fast. You can, however, slow it down by counting only every 64th CPU cycle. This is the kernel patch for that:
--- a/repos/base-hw/src/core/spec/arm_v7/perf_counter.cc +++ b/repos/base-hw/src/core/spec/arm_v7/perf_counter.cc @@ -37,6 +37,7 @@ struct Pmcr : Register<32> E::set(v, 1); P::set(v, 1); C::set(v, 1); + D::set(v, 1); return v; }
Your CPU should work with 1GHz so one cycle should be one nanosecond, right. But consider that with the above patch, one counter step extends to 64 nanoseconds.
Cheers, Martin