Blame view

cuda/timer.h 503 Bytes
f1402849   dmayerich   renewed commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  static cudaEvent_t tStartEvent;

  static cudaEvent_t tStopEvent;

  

  static void gpuStartTimer()

  {

  	//set up timing events

  	cudaEventCreate(&tStartEvent);

  	cudaEventCreate(&tStopEvent);

  	cudaEventRecord(tStartEvent, 0);

  }

  

  static float gpuStopTimer()

  {

  	cudaEventRecord(tStopEvent, 0);

  	cudaEventSynchronize(tStopEvent);

  	float elapsedTime;

  	cudaEventElapsedTime(&elapsedTime, tStartEvent, tStopEvent);

  	cudaEventDestroy(tStartEvent);

  	cudaEventDestroy(tStopEvent);

  	return elapsedTime;

  }