I'm getting "‘CLOCK_PER_SEC’ was not declared in this scope" error even after including time.h. I'm very newbie to c++, so this will be related to simple mistakes, but i sadly can't figure out. please help me.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 1024*1024*1
#define REPEAT 10
using namespace std;
.......
int main()
{
const int n = SIZE;
int* arr = (int*)malloc(n * sizeof(int));
for (int i = 0; i < n; i++)
{
arr[i] = n - i;
}
double totalSeiralTime = 0;
clock_t clock_s, clock_e;
for(int i = 0; i < REPEAT ; i++)
{
clock_s = clock();
radixsort(arr, n);
clock_e = clock();
double cpu_time_used = ((double)(clock_e-clock_s))/CLOCK_PER_SEC;
printf("gpu parallel time : %f\n", cpu_time_used);
totalSeiralTime += cpu_time_used;
}
printf("cpu serial time mean : %f\n", totalSeiralTime / REPEAT);
return 0;
}
how i compile
gcc -std=c++11 ./cpuRadix.cpp -o ./cpuRadix.out
./cpuRadix.out
I also have tried without std option. But It didn't make change.