forced delay during running a c++ program

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

forced delay during running a c++ program

1,830件の閲覧回数
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 件の賞賛
3 返答(返信)

1,800件の閲覧回数
bpe
NXP Employee
NXP Employee

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 件の賞賛

1,765件の閲覧回数
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 件の賞賛

1,755件の閲覧回数
bpe
NXP Employee
NXP Employee

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 件の賞賛