huasion wrote:RaX wrote:You may need to write your own high precision timer.
On x86 architecture(which is what your geode is) you can use rdtsc in assembler which returns the number of clock cycles executed since system start. That in conjunction with the clock speed of your chip should give you the necessary tools to write a high precision timer yourself.
Thanks! The result seems workable though it is not of microsceonds accuracy. I think it returns reliable millisecond . What makes me supprise is that why there is no full accuracy since it is from clock ticks. Is that the sysytem hardware unstable ? I just cannot guess why.
It returns the number of clock cycles executed since system start which, in conjunction with the speed of your processor, can be used to create a timer that is as precise as your processor is... which, of course, is the only way to time things on the system like you are trying to do. You can't outperform your own hardware =P
IE:: on a 600mhz processor you could time things in excess of 600million ticks per second max
And, in reply to the person that said RDTSC can't be used on routers...If I'm not mistaken the only real architectures used in networking hardware are mips, arm, powerpc, and x86 all of which have rdtsc or a compatible replacement function. I realize there are some less mainstream architectures that are used...but they also probably have a workaround to get rdtsc working, you have to have a way to time things in systems after all