diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-09-17 03:18:51 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-09-17 03:18:51 +0000 |
commit | 66084b816dd25a41f774240328a31d57efd276e4 (patch) | |
tree | acd22d0e3eb5f5608184fc18479e8890906cbe7f /src/x86_64 | |
parent | f46ea7eb1b6f55036f10b6ae919c1785cb72c836 (diff) | |
download | libsandglass-66084b816dd25a41f774240328a31d57efd276e4.tar.xz |
Begin libsandglass implementation.
Diffstat (limited to 'src/x86_64')
-rw-r--r-- | src/x86_64/tsc-x86_64.s | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/x86_64/tsc-x86_64.s b/src/x86_64/tsc-x86_64.s index c585719..52f02c2 100644 --- a/src/x86_64/tsc-x86_64.s +++ b/src/x86_64/tsc-x86_64.s @@ -38,3 +38,20 @@ sandglass_get_tsc: movq %rdi, %rbx ret .size sandglass_get_tsc, .-sandglass_get_tsc + +/* + * Return the granularity of the TSC + */ + +/* unsigned int sandglass_tsc_loops(); */ +.globl sandglass_tsc_loops + .type sandglass_tsc_loops, @function +sandglass_tsc_loops: + rdtsc /* Read time stamp counter */ + movl %eax, %ecx +.Lrdtsc: + rdtsc /* Read counter again */ + subl %ecx, %eax + jz .Lrdtsc /* If we got the same value, try again */ + ret + .size sandglass_tsc_loops, .-sandglass_tsc_loops |