A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)
{#} | Time | Hash | Subject | Author | # | (+) | (-) | GPG? |
---|---|---|---|---|---|---|---|---|
209 | 01 Dec 2020 11:43 | c5334b7 | Update | Josh Stockin | 1 | 16 | 0 | G |
1 | #include <stdint.h> |
2 | #include <stdio.h> |
3 | |
4 | uint64_t rdtsc(){ |
5 | uint32_t lo,hi; |
6 | __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); |
7 | return ((uint64_t)hi << 32) | lo; |
8 | } |
9 | |
10 | int main() { |
11 | for (int i = 0; i < 100; i++) { |
12 | uint64_t a = rdtsc(); |
13 | printf("%lu ticks\n", rdtsc() - a); |
14 | } |
15 | return 0; |
16 | } |
17 |