Re: MIPS-specific porting issue

Thomas Bogendoerfer <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
On Mon, Dec 06, 2021 at 10:01:58AM +0100, Florian Lohoff wrote:
> On Sat, Dec 04, 2021 at 12:07:29AM +0000, YANG Jiaxun wrote:
> > Hi Stéphane.
> > 
> > MIPS do have a way to access count register from user space.
> > Unfortunately there is no GCC intrinsic function for it, you may try following inline assembly.
> > 
> > static inline unsigned long get_count() {
> >     unsigned long count;
> >     asm volatile ("rdhwr %[rt], $2" : [rt] "=d" (count));
> >     return count;
> > }
> > 
> > return Val_long (get_count());
> 
> To be more precise - Not all CPUs have this (Older MIPS I for example
> dont) but there is kernel emulation / instruction trapping for it.

only for the thread register.

what's the requirement for this cycle count ? Is it about more
fine grained timestamps or really cpu cylces done ?

Thomas.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.