File: koe.cc

package info (click to toggle)
picprog 1.8.3-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 268 kB
  • ctags: 169
  • sloc: cpp: 2,492; makefile: 83; sh: 19
file content (24 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <iomanip>
#include <time.h>
#include <sys/time.h>

using namespace std;


int main ()
{
  unsigned long a, d, prevd;
  struct timeval tv;
  prevd = 0;
  for (;;) {
    asm volatile("rdtsc":"=a" (a), "=d" (d));
    gettimeofday (&tv, 0);
    if (d != prevd) {
      cout << setfill(' ') << d << " " << setw(11) << a
	   << setw(12) << tv.tv_sec << "."
	   << setw(6) << setfill('0') << tv.tv_usec << endl;
      prevd = d;
    }
  }
}