Skip to content

Commit 890d3f0

Browse files
author
jgtong
authored
Merge pull request #90 from rafbiels/rtm-print-exec-time
[RTM] Print both total and compute-only times
2 parents 12f79eb + 3f05616 commit 890d3f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

reverse_time_migration/main_migration.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using namespace operations::engines;
3636

3737
int main(int argc, char *argv[]) {
3838
try {
39-
std::chrono::steady_clock::time_point const tpStart(std::chrono::steady_clock::now());
39+
std::chrono::steady_clock::time_point const tpStartTotal(std::chrono::steady_clock::now());
4040
string parameter_file = WORKLOAD_PATH "/computation_parameters.json";
4141
string configuration_file = WORKLOAD_PATH "/engine_configuration.json";
4242
string callback_file = WORKLOAD_PATH "/callback_configuration.json";
@@ -67,7 +67,9 @@ int main(int argc, char *argv[]) {
6767
auto *agent = g->GenerateAgent();
6868
agent->AssignEngine(engine);
6969
agent->AssignArgs(argc, argv);
70+
std::chrono::steady_clock::time_point const tpStartCompute(std::chrono::steady_clock::now());
7071
MigrationData *md = agent->Execute();
72+
std::chrono::steady_clock::time_point const tpEndCompute(std::chrono::steady_clock::now());
7173

7274
std::cout << "Finished executing" << std::endl;
7375
auto *writer = g->GenerateWriter();
@@ -82,8 +84,9 @@ int main(int argc, char *argv[]) {
8284
delete cp;
8385
delete engine;
8486

85-
std::chrono::steady_clock::time_point const tpEnd(std::chrono::steady_clock::now());
86-
std::cout << "Total Execution Time: " << std::chrono::duration<double>( (tpEnd - tpStart) - (tpIOWriteEnd - tpIOWriteStart)).count() - dIOReadTime << " s" << std::endl;
87+
std::chrono::steady_clock::time_point const tpEndTotal(std::chrono::steady_clock::now());
88+
std::cout << "Compute time: " << std::chrono::duration<double>(tpEndCompute - tpStartCompute).count() - dIOReadTime << " s" << std::endl;
89+
std::cout << "Total Execution Time: " << std::chrono::duration<double>( (tpEndTotal - tpStartTotal) - (tpIOWriteEnd - tpIOWriteStart)).count() - dIOReadTime << " s" << std::endl;
8790
} catch (std::exception const &e) {
8891
std::cerr << "Exception caught: " << e.what() << std::endl;
8992
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)