Converting CPU clock values to wall time

More
10 Oct 2021 13:36 #222748 by johnbl
Hi,

As far as I understand, pretty much all time values reported by HAL and Mesa cards are CPU clock counts instead of actual time (e.g.: thread time, thread max-time, hm2 *.tmax params, ...).

To convert these values to milli-seconds, I use the TSC tick rate calculated by the kernel, which can be extracted with:
bpftrace -e 'BEGIN { printf("%u\n", *kaddr("tsc_khz")); exit(); }'

For example, if the param read.tmax from my Mesa 7i96 is 300'000, the value in ms would be 300 * 1000 / tsc_khz.

Is this the correct way to do it?

Please Log in or Create an account to join the conversation.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
10 Oct 2021 18:45 #222790 by rodw
Replied by rodw on topic Converting CPU clock values to wall time
I'm not sure of your intent here. Where are you doing this? For what purpose?
If you are writing a component the global variable fperiod will contain the time in seconds for that particular servo cycle.

Please Log in or Create an account to join the conversation.

More
10 Oct 2021 18:49 #222791 by johnbl
Replied by johnbl on topic Converting CPU clock values to wall time
My goal here is simply to make sense of the *.tmax values from my Mesa card, to check how much headroom I have for the servo thread rate.

Please Log in or Create an account to join the conversation.

More
10 Oct 2021 22:35 #222802 by BigJohnT
Replied by BigJohnT on topic Converting CPU clock values to wall time
My 7i96 Configuration Tool can answer all those questions.

gnipsel.com/mesa/index.html

JT

Please Log in or Create an account to join the conversation.

More
10 Oct 2021 22:36 #222803 by BigJohnT
Replied by BigJohnT on topic Converting CPU clock values to wall time
 

JT
Attachments:
The following user(s) said Thank You: tommylight, johnbl

Please Log in or Create an account to join the conversation.

More
11 Oct 2021 11:55 - 11 Oct 2021 11:55 #222849 by johnbl
Replied by johnbl on topic Converting CPU clock values to wall time
Nice! Didn't know about that feature.
Last edit: 11 Oct 2021 11:55 by johnbl.

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum