diff --git a/next/IMultiverso.vcxproj b/next/IMultiverso.vcxproj index 4378701..3a14cb6 100644 --- a/next/IMultiverso.vcxproj +++ b/next/IMultiverso.vcxproj @@ -189,6 +189,7 @@ + diff --git a/next/IMultiverso.vcxproj.filters b/next/IMultiverso.vcxproj.filters index f0c79f6..557d377 100644 --- a/next/IMultiverso.vcxproj.filters +++ b/next/IMultiverso.vcxproj.filters @@ -76,6 +76,9 @@ include\table + + util + diff --git a/next/Test/main.cpp b/next/Test/main.cpp index 59c938b..2d07225 100644 --- a/next/Test/main.cpp +++ b/next/Test/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -85,6 +86,14 @@ void TestArray(int argc, char* argv[]) { Log::Info("Create tables OK\n"); int iter = 1000; + auto add_start = std::chrono::high_resolution_clock::now(); + auto add_end = std::chrono::high_resolution_clock::now(); + auto get_start = std::chrono::high_resolution_clock::now(); + auto get_end = std::chrono::high_resolution_clock::now(); + double add_total = 0; + double get_total = 0; + add_total += std::chrono::duration(add_start - add_end).count(); + get_total += std::chrono::duration(get_start - get_end).count(); if (argc == 3) iter = atoi(argv[2]); for (int i = 0; i < iter; ++i) { @@ -97,17 +106,27 @@ void TestArray(int argc, char* argv[]) { for (int i = 0; i < 1000000; ++i) delta[i] = static_cast(i); + add_start = std::chrono::high_resolution_clock::now(); shared_array->Add(delta.data(), 1000000); + add_end = std::chrono::high_resolution_clock::now(); - Log::Info("Rank %d Add OK\n", MV_Rank()); + Log::Info("Rank %d Add OK, using %llf ms.\n", MV_Rank(), std::chrono::duration(add_start - add_end).count()); + add_total += std::chrono::duration(add_start - add_end).count(); + + get_start = std::chrono::high_resolution_clock::now(); shared_array->Get(data, 1000000); - Log::Info("Rank %d Get OK\n", MV_Rank()); + get_end = std::chrono::high_resolution_clock::now(); + + + Log::Info("Rank %d GET OK, using %llf ms.\n", MV_Rank(), std::chrono::duration(get_start - get_end).count()); for (int i = 0; i < 10; ++i) std::cout << data[i] << " "; std::cout << std::endl; + get_total += std::chrono::duration(get_start - get_end).count(); MV_Barrier(); } + Log::Info("Rank %d GET using %llf ms, ADD using %llf ms.\n", MV_Rank(), get_total, add_total); MV_ShutDown(); } diff --git a/next/include/multiverso/util/timer.h b/next/include/multiverso/util/timer.h new file mode 100644 index 0000000..9f0cd63 --- /dev/null +++ b/next/include/multiverso/util/timer.h @@ -0,0 +1,8 @@ +#ifndef MULTIVERSO_TIMER_H_ +#define MULTIVERSO_TIMER_H_ + +#include +#include + + +#endif //MULTIVERSO_TIMER_H_ \ No newline at end of file