calibration issue

"Jan Benda" <[email protected]> Tue, 1 Nov 2016 12:03:17 +0100
Newsgroups gmane.linux.real-time.rtai
Message-ID <[email protected]>
Hi,

I started to test the new rtai-5. The good news is that so far it 
smoothly compiles (inclusively rtai_math) and the tests run. I still 
need to do the kernel config tweaking to be able to say something 
regarding its performance.

If I understand it right from the README, and from removing 
/usr/realtime/calibration/latencies and seeing it appear again, 
calibration is done the first time rtai_sched is insmoded. This is a 
great idea!

However, I was surprised how quickly this happenend, despite what is 
configured in .rtai_config:

CONFIG_RTAI_LATENCY_SELF_CALIBRATION_METRICS="1"
CONFIG_RTAI_LATENCY_SELF_CALIBRATION_FREQ="10000"
CONFIG_RTAI_LATENCY_SELF_CALIBRATION_CYCLES="10000"

This tells me that the calibration is done with 10000 samples at 10kHz. 
So it should last 1 second.

Looking into kernel messages I get this after insmodding rati_hal and 
rtai_sched:

[  311.785774] I-pipe: head domain RTAI registered.
[  311.785795] RTAI[hal]: mounted. ISOL_CPUS_MASK: 0.
[  311.785797] SYSINFO - # CPUs: 4, TIMER NAME: 'lapic', TIMER IRQ: 
4353, TIMER FREQ: 90420998, CLOCK NAME: 'tsc', CLOCK FREQ: 2893498000, 
CPU FREQ: 2893498000, LINUX TIMER IRQ: 4353.
[  323.899915] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[  323.899951] , kstacks pool size = 524288 bytes.
[  323.899954] RTAI[sched]: hard timer type/freq = lapic/90420998(Hz); 
timing: oneshot; linear timed lists.
[  323.899955] RTAI[sched]: Linux timer freq = 1000 (Hz), TimeBase freq 
= 2893498000 hz.
[  323.899956] RTAI[sched]: timer setup = 114 ns, resched latency = 0 ns.
[  323.900814] USERMODE CHECK: OK.
[  323.900817] USERMODE CHECK PROVIDED (ns): KernelLatency -1, 
UserLatency -1.
[  324.025772] KERNEL SPACE LATENCY ENDED AT CYCLE: 1243, LATENCY = 
5148, VARIANCE = 33761/10004569, GAIN = 843651/1000000000, LEAST = 2477.
[  324.102274] AFTER KERNEL CALIBRATION (WITH RTAI TASK, ns): 
KernelLatency 1779, UserLatency -1 (CALIBRATION: PERIOD 10000 (ns), TIME 
201392037 (ns)).
[  324.241126] USER SPACE LATENCY ENDED AT CYCLE: 1374, LATENCY = 
6000.95, VARIANCE = 0.0031114, GAIN = 0.000777849, LEAST = 1980.
[  324.248263] USERMODE USER SPACE CALIBRATION: OK.
[  324.248266] AFTER USER CALIBRATION (ns): KernelLatency 1779, 
UserLatency 2073 (CALIBRATION: PERIOD 10000 (ns), TIME 145943905 (ns)).
[  324.248268] FINAL CALIBRATION SUMMARY (ns): KernelLatency 1779, 
UserLatency 2073.

In line 324.102274 I read that the period was 10000ns, i.e. 100KHz. And 
in the line before the latency test ended after 1243 cycles instead of 
10000. So no wonder that this was unnoticable quick and not 1 second!

When I configure for 50kHz, I get a period of 50000ns (20kHz). The 
number of cycles did not change, though.

So, CONFIG_RTAI_LATENCY_SELF_CALIBRATION_FREQ is not a frequency, it is 
the period in ns!

And, why does CONFIG_RTAI_LATENCY_SELF_CALIBRATION_CYCLES has no effect 
at all?

I guess this can be fixed easily...

Cheers,
Jan



_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai