summaryrefslogtreecommitdiffstats
path: root/src/x86
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-09-17 03:18:51 +0000
committerTavian Barnes <tavianator@gmail.com>2009-09-17 03:18:51 +0000
commit66084b816dd25a41f774240328a31d57efd276e4 (patch)
treeacd22d0e3eb5f5608184fc18479e8890906cbe7f /src/x86
parentf46ea7eb1b6f55036f10b6ae919c1785cb72c836 (diff)
downloadlibsandglass-66084b816dd25a41f774240328a31d57efd276e4.tar.xz
Begin libsandglass implementation.
Diffstat (limited to 'src/x86')
-rw-r--r--src/x86/tsc-x86.s17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/x86/tsc-x86.s b/src/x86/tsc-x86.s
index 570b8af..46013bb 100644
--- a/src/x86/tsc-x86.s
+++ b/src/x86/tsc-x86.s
@@ -38,3 +38,20 @@ sandglass_get_tsc:
popl %ebx
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