include iostream include time include stdio using std cout using std e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <time.h>
#include <stdio.h>
using std::cout;
using std::endl;
#define COUNT 100000000
int main()
{
cout << "Iteration counts = " << COUNT << endl;
clock_t before = clock();
for (int i = 0; i < COUNT; i++) {
asm volatile ("mul %ebx\n");
}
clock_t elapsed = clock() - before;
cout << (double)elapsed / CLOCKS_PER_SEC << " seconds spent" << endl;
cout << elapsed << " clock tick counts" << endl;
return 0;
}