Jump to content

Recommended Posts

Posted

Hi all,

 

I have some piece of software to compile on our Armbina system (Linux odroidc2 4.19.90-meson64 #5.99 SMP PREEMPT Fri Dec 20 13:47:25 CET 2019 aarch64 GNU/Linux).

It is a C++ program, usually running on x86 machines, and has one line of code killing the compilation:

asm volatile ("rdtsc" : "=a" (low), "=d" (high));

I need to replace it by some code working with g++ on ARM64.

Anyone how can give me a hint? I tried Google, but found no reasonable solution.

 

In case, the software package is public, if you need the link to get it, please let me know.

 

Any help is appreciated.

Thanks in advance, Michael

Posted

I finally could find some suitable solution here.

Basically it is like

 

  // System timer of ARMv8 runs at a different frequency than the CPU's.
  // The frequency is fixed, typically in the range 1-50MHz.  It can be
  // read at CNTFRQ special register.  We assume the OS has set up
  // the virtual timer properly.
  int64_t virtual_timer_value;
  asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
  return virtual_timer_value;

It seems to return meaningful values, just in case someone else needs some similar benchmarking.

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines