Notice: We have migrated to GitLab launching 2024-05-01 see here:

#1276 closed defect (invalid)

tsc (rdtsc) variant Read_timer() on pc386 BSP returns CPU-ticks instead of microseconds

Reported by: strauman Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: bsps Version: 4.7
Severity: normal Keywords:
Cc: Blocked By:


AFAIK, the 'Read_timer()' function is supposed to give
time in microseconds [us] across all architectures.
However, the 'TSC'-flavor routine

[libbsp/i386/pc386/timer/timer.c:] tsc_read_timer()

yields a reading in CPU clock ticks. In addition to
being incompatible with other CPUs the scaling
in CPU ticks risks overflowing the 32-bit return value

FIX: scale to us using CPU clock frequency. The hard
part is figuring out the latter. Usually this is
done by taking two rdtsc() readings
separated by a known time interval.

Change History (1)

comment:1 Changed on 08/04/08 at 18:35:45 by Joel Sherrill

Resolution: invalid
Status: newclosed

Read_Timer() just returns the highest granularity counter on the target. It is not guaranteed to be in any particular units.

Note: See TracTickets for help on using tickets.