lkml.org 
[lkml]   [2017]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectIntel Virtualization and clock_gettime reproducer
Date
This affects every kernel I tried, 4.9.[54|35|24], 3.18.27, RH 3.10.0-693*.
The test machine is a Dell R740 with 2X8168 and 384GB.


#include <time.h>
#include <stdio.h>
#include <sys/time.h>

inline long GetPerf()
{
int _hi, _lo;
__asm__ __volatile__ ("rdtsc":"=a" (_lo), "=d"(_hi));
return ((long) _hi << 32) | _lo;
}

int main()
{

struct timespec ts;
int i, count;
long start, end, delta, min, max, total, avg;

count = 100;
min = 0x7fffffff;
max = 0;
total = 0;

for (i = 0; i < count; i++)
{

start = GetPerf();

clock_gettime(CLOCK_REALTIME, &ts);

end = GetPerf();

delta = end - start;

if (delta > max) max = delta;
if (delta < min) min = delta;
total += delta;
}

avg = total / count;

printf("min: %ld\n", min);

--

//E. F. Berkley Shands, MSc
Senior Software Architect/Engineer
Exegy Systems Engineering//

**Exegy Inc.**

349 Marshall Road, Suite 100

St. Louis , MO 63119

Direct: (314) 218-3600 X450

Cell: (314) 303-2546

Office: (314) 218-3600

Fax: (314) 218-3601

The Usual Disclaimer follows...


________________________________

This e-mail and any documents accompanying it may contain legally privileged and/or confidential information belonging to Exegy, Inc. Such information may be protected from disclosure by law. The information is intended for use by only the addressee. If you are not the intended recipient, you are hereby notified that any disclosure or use of the information is strictly prohibited. If you have received this e-mail in error, please immediately contact the sender by e-mail or phone regarding instructions for return or destruction and do not use or disclose the content to others.

\
 
 \ /
  Last update: 2017-11-09 15:03    [W:0.028 / U:1.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site