| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <cpu/x86/tsc.h> |
| 4 | #include <stdint.h> |
| 5 | #include <timestamp.h> |
| 6 | |
| 7 | uint64_t timestamp_get(void) |
| 8 | { |
| 9 | return rdtscll(); |
| 10 | } |
| 11 | |
| 12 | int timestamp_tick_freq_mhz(void) |
| 13 | { |
| 14 | /* Chipsets that have a constant TSC provide this value correctly. */ |
| 15 | if (tsc_constant_rate()) |
| 16 | return tsc_freq_mhz(); |
| 17 | |
| 18 | /* Filling tick_freq_mhz = 0 in timestamps-table will trigger |
| 19 | * userspace utility to try deduce it from the running system. |
| 20 | */ |
| 21 | return 0; |
| 22 | } |