How to get better precision out of getrusage on the ARM?
flat view
From: Patrick Doyle <hidden>
Date: 2016-01-19 14:19:45
Hello Alexandre, I missed that patch. I'll have to take a look at that. Thank you. Regardless, it seems that I need to modify tcb_clksrc.c to register itself through CLOCKSOURCE_OF_DECLARE(), set the appropriate kernel configuration options, and use clock_gettime(CLOCK_THREAD_CPUTIME_ID) in order to get better than 1 tick resolution out of clock_gettime for my threads. Unfortunately, the tcb_clksrc.c modifications appear to be incompatible with the design intent of atmel_tclib.c. I am waiting for the opportunity to talk to Atmel about this. (I need to ping my local FAE about this again). I also need to turn up the heat on this back burner'ed task. (I got some numbers, none of us are happy with them, and I need to see what I can do to get better numbers, when I can make the time to do so.) --wpd On Mon, Jan 18, 2016 at 7:16 PM, Alexandre Belloni [off-list ref] wrote:
Hi Patrick, I was wondering whether you had the chance to test this patch from the RT tree: http://git.kernel.org/cgit/linux/kernel/git/rt/linux-rt-devel.git/commit/?h=v4.4-rt2&id=57142bdff523a67657d0b2603eaa91df58b88bd8 when trying your sched_clock experiment? On 30/12/2015 at 10:00:46 -0500, Patrick Doyle wrote :quoted
Continuing on... I now have a CLOCKSOURCE_OF_DECLARED()'ed 10 MHz clock source running on my ARM processor (Atmel SAMA5D2 Xplained board). It registers itself through sched_clock_register() to provide a high resolution sched clock. Once I turned on "Full dynticks CPU time accounting" (CONFIG_VIRT_CPU_ACCOUNTING_GEN), I was able to get better than jiffy resolution from my calls to getrusage(RUSAGE_THREAD,..). But things still aren't quite right. I am using getrusage() to provide some runtime profile information to an existing application (that was ported to run on Linux instead of a custom RTOS). I have code that looks like: tick() // commented out code that used to do something tock() where tick() & tock() are my profile "start" and "stop" points that call getrusage() to record and and accumulate time spent between calls to tick() & tock(). Most of the time, I get a delta of 0 between the two calls, which I expect. But occasionally, I get a delta ranging between 800us and 1000us, which I don't understand at all. It seems like my thread is being "charged" for time spent doing something else. Perhaps an interrupt occurred and its time got charged to my thread; perhaps a higher priority thread ran for 1ms, I don't know (yet). Does anybody have any suggestions as to where I might look, or as to what kernel CONFIG options might make the most sense for an application such as this? --wpd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel-- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com