I wrote an application with a main() routine and a postix thread. The main() triggers an interrupt pin on my system which is delayed due to a delay element.
The pthread uses a event.sigev_notify = SIGEV_INTR;and InterruptAttachEvent() call to attach the IRQ to the specific thread. The application and the measurement works fine, but when I generate load on the system with the stress tool (weather.ou.edu/~apw/projects/stress/) my latencys goes from 25-35 microseconds up to 100 milli seconds. Even when I change the Scheduler or the priority over the IDE for my application or directly for the thread in the sourceode to SCHED_FIFO and Priority 255, the latency doesn’t drop.
Latency goes up too, when starting the photon environment from the console.
100 milliseconds ?? Something is very wrong. Either it’s the way you measure the latency or you aren’t setting the priority properly. Can you post code?
You can’t really measure latency like that. The problem is that the interrupt might occurs in between out8() and ui64_cc_start = ClockCycles(), throwing the calculation off. I’m assuming the interrupt gets trigger when setting the bit on PPT1 to HIGH.
The (f)printf in the irq is not a good idea, although the process is high priority, if there is a request currently being performed by the related driver ( devc-con/devb-eide), they are queue. Hence these calls could make the ISR block longer then you might expect.
The IRQ can’t occur between out8() and ui84_cc_start because the out8 triggers a delay device which delays the signal for 100 milliseconds. Hence the CPU has enough time to get the ClockCycles.
No, it keeps at those high latencys even when changing the delay time from 100 to 50 milli seconds.
Actually I had an error in the latency calculation. The real latencys are between 5 to 8 microseconds when system is idle. When doing a “stress --cpu 2”, having two workers on the cpu doint sqrt(), i get latencys from 8 to 9 milliseconds.
Could someone explain : How to analyze the interrupt latency on embedded PC target (X86) ??
If its possible then please update the code also.
looking forward for your reply.