PeriDyno 1.0.0
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1#pragma once
2#if (defined __unix__) || (defined __APPLE__)
3#include <sys/time.h>
4#elif (defined _WIN32)
5#include <windows.h>
6#endif
7
8#include "Platform.h"
9
10#ifdef CUDA_BACKEND
11 #include <cuda_runtime.h>
12#endif
13#include <iostream>
14
15namespace dyno
16{
17 class CTimer
18 {
19 public:
20 CTimer();
21 ~CTimer();
22 void start();
23 void stop();
24
28 double getElapsedTime();
29 void outputString(char* str);
30 protected:
31#if (defined __unix__) || (defined __APPLE__)
32 long start_sec_, stop_sec_, start_micro_sec_, stop_micro_sec_;
33#elif (defined _WIN32)
34 LARGE_INTEGER timer_frequency_;
35 LARGE_INTEGER start_count_, stop_count_;
36#endif
37 };
38
39#ifdef CUDA_BACKEND
40 class GTimer
41 {
42 private:
43 cudaEvent_t m_start, m_stop;
44
45 float milliseconds;
46
47 public:
48 GTimer();
49 ~GTimer();
50
51 void start();
52 void stop();
53
54 float getElapsedTime();
55
56 void outputString(const char* str);
57 };
58#endif
59} //end of namespace dyno
double getElapsedTime()
return the elapsed time in (ms)
Definition Timer.cpp:41
void start()
Definition Timer.cpp:17
void stop()
Definition Timer.cpp:29
void outputString(char *str)
Definition Timer.cpp:52
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25