Re: MIPS-specific porting issue
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.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
Reply to: