Most accurate way to get elapsed time (in microseconds) on iMX6?

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

Most accurate way to get elapsed time (in microseconds) on iMX6?

ソリューションへジャンプ
3,037件の閲覧回数
EdSutter
Senior Contributor II

The gettimeofday() call returns microseconds.

Is this the most accurate method or is there a better way?

--EDIT--

I did a bit more snooping, and tried clock_gettime(CLOCK_MONOTONIC_RAW,&t1)

to get a timestamp.  This appears to be reasonably accurate.  Does anyone have any experience

with this to agree or disagree?

Thoughts?

Ed

タグ(1)
0 件の賞賛
返信
1 解決策
2,539件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Ed

proper to use clock_gettime, see below

c - Measure time in Linux - getrusage vs clock_gettime vs clock vs gettimeofday? - Stack Overflow

https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time

Best regards

chip

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
2,540件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Ed

proper to use clock_gettime, see below

c - Measure time in Linux - getrusage vs clock_gettime vs clock vs gettimeofday? - Stack Overflow

https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time

Best regards

chip

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,539件の閲覧回数
EdSutter
Senior Contributor II

Chip,

Yep, that's what I ended up using.  Shoulda posted it a while back.

Thanks,

Ed

0 件の賞賛
返信