Add read_cycle_counter
This commit is contained in:
parent
5a078249d0
commit
10d42721e9
@ -27,3 +27,10 @@ unsigned long usecs_to_jiffies(const unsigned int u)
|
||||
// This could overflow
|
||||
return (u * HZ) / 1000000L;
|
||||
}
|
||||
|
||||
#include <x86intrin.h>
|
||||
inline uint64_t read_cycle_counter()
|
||||
{
|
||||
uint64_t tsc = __rdtsc();
|
||||
return tsc;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#define HZ 100
|
||||
/*
|
||||
@ -50,3 +51,5 @@ unsigned int jiffies_to_msecs(const unsigned long j);
|
||||
unsigned int jiffies_to_usecs(const unsigned long j);
|
||||
unsigned long msecs_to_jiffies(const unsigned int m);
|
||||
unsigned long usecs_to_jiffies(const unsigned int u);
|
||||
|
||||
uint64_t read_cycle_counter();
|
||||
|
Loading…
Reference in New Issue
Block a user