Adding timer for profiling
This commit is contained in:
Родитель
97f3953bc0
Коммит
650200009c
|
@ -189,6 +189,7 @@
|
|||
<ClInclude Include="include\multiverso\util\mt_queue.h" />
|
||||
<ClInclude Include="include\multiverso\util\net_util.h" />
|
||||
<ClInclude Include="include\multiverso\util\quantization_util.h" />
|
||||
<ClInclude Include="include\multiverso\util\timer.h" />
|
||||
<ClInclude Include="include\multiverso\util\waiter.h" />
|
||||
<ClInclude Include="include\multiverso\worker.h" />
|
||||
<ClInclude Include="include\multiverso\zoo.h" />
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
<ClInclude Include="include\multiverso\table\matrix_table.h">
|
||||
<Filter>include\table</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\multiverso\util\timer.h">
|
||||
<Filter>util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="include">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <thread>
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
|
||||
#include <mpi.h>
|
||||
|
||||
|
@ -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<double, std::milli>(add_start - add_end).count();
|
||||
get_total += std::chrono::duration<double, std::milli>(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<float>(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<double, std::milli>(add_start - add_end).count());
|
||||
add_total += std::chrono::duration<double, std::milli>(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<double, std::milli>(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<double, std::milli>(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();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef MULTIVERSO_TIMER_H_
|
||||
#define MULTIVERSO_TIMER_H_
|
||||
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
#endif //MULTIVERSO_TIMER_H_
|
Загрузка…
Ссылка в новой задаче