17 lines
323 B
Markdown
17 lines
323 B
Markdown
# In linux
|
|
```
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <stdint.h>
|
|
|
|
static long long GetThreadCpuTimeNs() {
|
|
struct timespec t;
|
|
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t)) {
|
|
perror("clock_gettime");
|
|
return 0;
|
|
}
|
|
return t.tv_nsec;
|
|
}
|
|
```
|
|
Makov测试熵估计0.5-0.6 |