Re: Userspace cycle counting for loongson?
fxzhang <fxzhang@ict.ac.cn> writes:
Hi Fuxhin !
> Arnaud Patard (Rtp) 写道:
>> Laurent GUERBY <laurent@guerby.net> writes:
>>
>>
>>> Hi,
>>>
>>
>> Hi,
>>
>>
>>> I'd like to time some low level code, is there a way
>>> to count cycles in userspace for loongson processors
>>> running debian lenny?
>>>
>>
>> You can try using the mips instruction rdhwr to get the cycle counter. I
>> didn't tested it but I think it should work.
>>
> As far as I know, there is still no rdhwr instruction in LS2E/2F, but
If the hardware doesn't support the rdhwr instruction, the kernel
emulates it. I know it emulate the register needed for the tls
thread_area but I didn't check for the cp0 counter. I hope it's
implemented /o\
> you can use mfc0/dmfc0 to read the 'count' cp0 register.
afaik these instructions can't be used in userspace.
Arnaud
Reply to: