[...]
> it's not necessary to run this in kernel; using user mode is ok too:
>
plus the following is handy too:
> void main(void)
> {
> unsigned int cnt3, cnt2, cnt1;
> int i;
> printf("cc: started... ");
iopl(3);
__asm__("cli");
> __asm__(".byte 0x0f,0x31" : "=a" (cnt1), "=d" (cnt3));
> /* put code to time here */
> for(i=0;i<10000;i++);
> /* end code to time here */
> __asm__(".byte 0x0f,0x31" : "=a" (cnt2), "=d" (cnt3));
__asm__("sti");
> printf(" operation took %d cycles\n", cnt2-cnt1);
> }
you've got to run it as root, and better make no mistakes between cli and
sti ;)
-- mingo