diff --git a/DergunPiotr-WaskoDominik/zad1/Ttiming.h b/DergunPiotr-WaskoDominik/zad1/Ttiming.h new file mode 100644 index 0000000..93d6e19 --- /dev/null +++ b/DergunPiotr-WaskoDominik/zad1/Ttiming.h @@ -0,0 +1,40 @@ +#if !defined(DEF_TTIMING) +#define DEF_TTIMING +#include + +class TTiming +{ +protected: + struct timeval start; + struct timeval stop; + void getTime(timeval &tv); + +public: + TTiming(void); + + void Begin(void); + long End(void); +}; + +inline TTiming::TTiming(void) +{ + +} + +inline void TTiming::Begin(void) +{ + getTime(start); +} + +inline long TTiming::End(void) +{ + getTime(stop); + return ((stop.tv_sec-start.tv_sec) * 1000 + (stop.tv_usec-start.tv_usec)/1000.0) + 0.5; +} + +inline void TTiming::getTime(timeval &tv) +{ + gettimeofday(&tv,NULL); +} + +#endif diff --git a/DergunPiotr-WaskoDominik/zad1/macierz_omp.cpp b/DergunPiotr-WaskoDominik/zad1/macierz_omp.cpp index 5ec062a..3f3fe72 100644 --- a/DergunPiotr-WaskoDominik/zad1/macierz_omp.cpp +++ b/DergunPiotr-WaskoDominik/zad1/macierz_omp.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "Ttiming.h" using namespace std; @@ -37,6 +38,8 @@ int main(int argc, char *argv[]) long rozmiar=0; char *endptr; int threads_num=0; + TTiming tt; + long i, j;//,k; if (argc < 3) { @@ -89,10 +92,23 @@ int main(int argc, char *argv[]) for (long i=0; i