summaryrefslogtreecommitdiff
path: root/benchmarks/CUDA/DG/src/tictoc.cu
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-07-15 18:09:46 -0800
committerTor Aamodt <[email protected]>2010-07-15 18:09:46 -0800
commit69f2911e04ffb1b19eef1fafb8c040af271f656e (patch)
tree231d3b6bdc3a202f7c255bfcf7bf2c36e32cee9e /benchmarks/CUDA/DG/src/tictoc.cu
creating branch for adding support for CUDA 3.x and Fermi
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829]
Diffstat (limited to 'benchmarks/CUDA/DG/src/tictoc.cu')
-rw-r--r--benchmarks/CUDA/DG/src/tictoc.cu23
1 files changed, 23 insertions, 0 deletions
diff --git a/benchmarks/CUDA/DG/src/tictoc.cu b/benchmarks/CUDA/DG/src/tictoc.cu
new file mode 100644
index 0000000..f1335c3
--- /dev/null
+++ b/benchmarks/CUDA/DG/src/tictoc.cu
@@ -0,0 +1,23 @@
+cudaEvent_t cstart, cstop;
+
+void cudatic(){
+
+ cudaEventCreate(&cstart);
+ cudaEventCreate(&cstop);
+
+ cudaEventRecord(cstart, 0);
+}
+
+float cudatoc(){
+
+ cudaEventRecord(cstop, 0);
+ cudaEventSynchronize(cstop);
+ float elapsedTime;
+ cudaEventElapsedTime(&elapsedTime, cstart, cstop);
+
+ /* return elapsed time in seconds */
+ return elapsedTime/1000.0;
+
+}
+
+