Skip to content

Commit

Permalink
[MISC] Also record max time
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Nov 2, 2023
1 parent 92f4c0f commit f3161cc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/raptor/argument_parsing/search_arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct search_arguments
bool quiet{false};
std::filesystem::path timing_out{};

mutable std::mutex max_time_mutex{};
mutable double max_time{};

// Timers do not copy the stored duration upon copy construction/assignment
mutable seqan::hibf::concurrent_timer wall_clock_timer{};
mutable seqan::hibf::concurrent_timer query_length_timer{};
Expand Down
4 changes: 4 additions & 0 deletions include/raptor/search/search_singular_ibf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ void search_singular_ibf(search_arguments const & arguments, index_t && index)
arguments.compute_minimiser_timer += local_compute_minimiser_timer;
arguments.query_ibf_timer += local_query_ibf_timer;
arguments.generate_results_timer += local_generate_results_timer;
{
std::lock_guard max_time_lock{arguments.max_time_mutex};
arguments.max_time = std::max(arguments.max_time, local_query_ibf_timer.in_seconds());
}
};

auto write_header = [&]()
Expand Down
3 changes: 3 additions & 0 deletions src/argument_parsing/search_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void search_arguments::print_timings() const
std::cerr << "Compute minimiser sum [s]: " << compute_minimiser_timer.in_seconds() << '\n';
std::cerr << "Query IBF avg per thread [s]: " << query_ibf_timer.in_seconds() / threads << '\n';
std::cerr << "Query IBF sum [s]: " << query_ibf_timer.in_seconds() << '\n';
std::cerr << "Query IBF sum max [s]: " << max_time << '\n';
std::cerr << "Generate results avg per thread [s]: " << generate_results_timer.in_seconds() / threads << '\n';
std::cerr << "Generate results sum [s]: " << generate_results_timer.in_seconds() << '\n';
}
Expand All @@ -84,6 +85,7 @@ void search_arguments::write_timings_to_file() const
<< "compute_minimiser_sum_in_seconds\t"
<< "query_ibf_avg_per_thread_in_seconds\t"
<< "query_ibf_sum_in_seconds\t"
<< "query_ibf_max_in_seconds\t"
<< "generate_results_avg_per_thread_in_seconds\t"
<< "generate_results_sum_in_seconds\n";

Expand Down Expand Up @@ -127,6 +129,7 @@ void search_arguments::write_timings_to_file() const
output_stream << compute_minimiser_timer.in_seconds() << '\t';
output_stream << query_ibf_timer.in_seconds() / threads << '\t';
output_stream << query_ibf_timer.in_seconds() << '\t';
output_stream << max_time << '\t';
output_stream << generate_results_timer.in_seconds() / threads << '\t';
output_stream << generate_results_timer.in_seconds() << '\n';
}
Expand Down
8 changes: 8 additions & 0 deletions src/search/search_partitioned_ibf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ void search_partitioned_ibf(search_arguments const & arguments)

arguments.compute_minimiser_timer += local_compute_minimiser_timer;
arguments.query_ibf_timer += local_query_ibf_timer;
{
std::lock_guard max_time_lock{arguments.max_time_mutex};
arguments.max_time = std::max(arguments.max_time, local_query_ibf_timer.in_seconds());
}
};

arguments.parallel_search_timer.start();
Expand Down Expand Up @@ -190,6 +194,10 @@ void search_partitioned_ibf(search_arguments const & arguments)
arguments.compute_minimiser_timer += local_compute_minimiser_timer;
arguments.query_ibf_timer += local_query_ibf_timer;
arguments.generate_results_timer += local_generate_results_timer;
{
std::lock_guard max_time_lock{arguments.max_time_mutex};
arguments.max_time = std::max(arguments.max_time, local_query_ibf_timer.in_seconds());
}
};

arguments.parallel_search_timer.start();
Expand Down

0 comments on commit f3161cc

Please sign in to comment.