forced delay during running a c++ program

cancel
Showing results for 
Search instead for 
Did you mean: 

forced delay during running a c++ program

547 Views
Yongxin_Yu
Contributor I

Dear NXP team,

I use S32G-VNP-EVB and "Linux s32g274aevb aarch64 GNU/Linux".

I have written a little program in attachment. There are always unexpected delay over 200ms.

It is just a for-loop, which will be called every 10ms using thread.

for(int j = 0; j < 150000; j++);

The runtime of this for-loop takes about 1ms.  Sometimes this for-loop was called after 200ms.

Best Regards 

0 Kudos
3 Replies

517 Views
bpe
NXP TechSupport
NXP TechSupport

Linux is a multitasking environment. There are always some interrupts and/or
active tasks in the schedule. If your task/process experiences delays, the
system must be busy with something else. Run any available Linux profiling
tool to find where CPU spends time.

 

Best Regards,
Platon

 

0 Kudos

482 Views
Yongxin_Yu
Contributor I

Thanks a lot for your replay.

The cpu load was from 3% to 4%. Could this cpu load  cause to a delay of 200ms ?

0 Kudos

472 Views
bpe
NXP TechSupport
NXP TechSupport

CPU load averages have little to do with a userspace task execution timeline. I see
no alternative to profiling if you want to know why you observe fluctuations in execution time.

Best Regards,
Platon

0 Kudos