[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Robin Cornelius wrote:
I will have to lookup what i did at work and post it, but it uses an inline asembler call to access the CPU clock count register directly.
Here it is :-
#define PSCHED_GET_TIME(stamp) ({u32 hi, lo; __asm__ __volatile(".byte 0x0f,0xa2"); __ asm __volatile(".byte 0x0f,0x31" : "=a" (lo), "=d" (hi)); (stamp)=(((u64)hi<32)+lo);});
and to use it :-
u64 start,end; long time;
PSCHED_GET_TIME(start); mdelay(1); PSCHED_GET_TIME(end); time=end-start; printk("There are %ld clocks per ms\n",time);
Robin, hi;
Excellent, thanks. That's just the sort of thing I was looking for !
jd --
John Daragon john@xxxxxxxxxx argv[0] limited Lambs Lawn Cottage, Staple Fitzpaine, Taunton, TA3 5SL, UK v +44 (0) 1460 234068 f +44 (0) 1460 234069 m +44 (0) 7836 576127
-- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html