readme: document rdtsc

This commit is contained in:
Ciro Santilli
2018-04-15 23:23:40 +01:00
parent 6eae8bb052
commit 24cdcdc756
3 changed files with 37 additions and 11 deletions

View File

@@ -1,11 +1,5 @@
/*
ARM only.
TODO not working.
* https://stackoverflow.com/questions/40454157/is-there-an-equivalent-instruction-to-rdtsc-in-arm
* https://stackoverflow.com/questions/31620375/arm-cortex-a7-returning-pmccntr-0-in-kernel-mode-and-illegal-instruction-in-u/31649809#31649809
* https://blog.regehr.org/archives/794
*/
#include <linux/debugfs.h>
@@ -17,7 +11,6 @@ TODO not working.
#include <linux/uaccess.h> /* copy_from_user, copy_to_user */
#include <uapi/linux/stat.h> /* S_IRUSR */
static struct dentry *debugfs_file;
static int show(struct seq_file *m, void *v)

View File

@@ -16,11 +16,10 @@ Only works in x86_64.
int main(void) {
uintmax_t val;
#if defined(__i386__) || defined(__x86_64__)
/* https://stackoverflow.com/questions/9887839/clock-cycle-count-wth-gcc/9887979 */
val = __rdtsc();
#else
val = 0;
#endif
printf("%jx\n", val);
printf("%ju\n", val);
return EXIT_SUCCESS;
}