Skip to content

Commit

Permalink
move timers into config.
Browse files Browse the repository at this point in the history
  • Loading branch information
smehringer committed Aug 13, 2024
1 parent 1983ec4 commit 411ffc5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 31 deletions.
6 changes: 6 additions & 0 deletions include/chopper/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <hibf/cereal/path.hpp> // IWYU pragma: keep
#include <hibf/config.hpp>
#include <hibf/misc/timer.hpp>

namespace chopper
{
Expand Down Expand Up @@ -72,6 +73,11 @@ struct configuration
//!\brief The HIBF config which will be used to compute the layout within the HIBF lib.
seqan::hibf::config hibf_config;

mutable seqan::hibf::concurrent_timer compute_sketches_timer{};
mutable seqan::hibf::concurrent_timer union_estimation_timer{};
mutable seqan::hibf::concurrent_timer rearrangement_timer{};
mutable seqan::hibf::concurrent_timer dp_algorithm_timer{};

void read_from(std::istream & stream);

void write_to(std::ostream & stream) const;
Expand Down
6 changes: 1 addition & 5 deletions include/chopper/layout/execute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@

#include <chopper/configuration.hpp>

#include <hibf/misc/timer.hpp>
#include <hibf/sketch/hyperloglog.hpp>

namespace chopper::layout
{

int execute(chopper::configuration & config,
std::vector<std::vector<std::string>> const & filenames,
std::vector<seqan::hibf::sketch::hyperloglog> const & sketches,
seqan::hibf::concurrent_timer & union_estimation_timer,
seqan::hibf::concurrent_timer & rearrangement_timer,
seqan::hibf::concurrent_timer & dp_algorithm_timer);
std::vector<seqan::hibf::sketch::hyperloglog> const & sketches);

} // namespace chopper::layout
26 changes: 8 additions & 18 deletions src/chopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ int main(int argc, char const * argv[])

std::vector<seqan::hibf::sketch::hyperloglog> sketches;

seqan::hibf::concurrent_timer compute_sketches_timer{};
seqan::hibf::concurrent_timer union_estimation_timer{};
seqan::hibf::concurrent_timer rearrangement_timer{};
seqan::hibf::concurrent_timer dp_algorithm_timer{};

try
{
if (filenames.empty())
Expand All @@ -75,16 +70,11 @@ int main(int argc, char const * argv[])
chopper::input_functor{filenames, config.precomputed_files, config.k, config.window_size};
config.hibf_config.number_of_user_bins = filenames.size();

compute_sketches_timer.start();
config.compute_sketches_timer.start();
seqan::hibf::sketch::compute_sketches(config.hibf_config, sketches);
compute_sketches_timer.stop();

exit_code |= chopper::layout::execute(config,
filenames,
sketches,
union_estimation_timer,
rearrangement_timer,
dp_algorithm_timer);
config.compute_sketches_timer.stop();

exit_code |= chopper::layout::execute(config, filenames, sketches);
}
catch (std::exception const & ext)
{
Expand All @@ -110,10 +100,10 @@ int main(int argc, char const * argv[])
<< "layouting_in_seconds\t"
<< "union_estimation_in_seconds\t"
<< "rearrangement_in_seconds\n";
output_stream << compute_sketches_timer.in_seconds() << '\t';
output_stream << dp_algorithm_timer.in_seconds() << '\t';
output_stream << union_estimation_timer.in_seconds() << '\t';
output_stream << rearrangement_timer.in_seconds() << '\t';
output_stream << config.compute_sketches_timer.in_seconds() << '\t';
output_stream << config.dp_algorithm_timer.in_seconds() << '\t';
output_stream << config.union_estimation_timer.in_seconds() << '\t';
output_stream << config.rearrangement_timer.in_seconds() << '\t';
}

return exit_code;
Expand Down
13 changes: 5 additions & 8 deletions src/layout/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ namespace chopper::layout

int execute(chopper::configuration & config,
std::vector<std::vector<std::string>> const & filenames,
std::vector<seqan::hibf::sketch::hyperloglog> const & sketches,
seqan::hibf::concurrent_timer & union_estimation_timer,
seqan::hibf::concurrent_timer & rearrangement_timer,
seqan::hibf::concurrent_timer & dp_algorithm_timer)
std::vector<seqan::hibf::sketch::hyperloglog> const & sketches)
{
assert(config.hibf_config.number_of_user_bins > 0);

Expand Down Expand Up @@ -74,14 +71,14 @@ int execute(chopper::configuration & config,
}
else
{
dp_algorithm_timer.start();
config.dp_algorithm_timer.start();
hibf_layout = seqan::hibf::layout::compute_layout(config.hibf_config,
kmer_counts,
sketches,
seqan::hibf::iota_vector(sketches.size()),
union_estimation_timer,
rearrangement_timer);
dp_algorithm_timer.stop();
config.union_estimation_timer,
config.rearrangement_timer);
config.dp_algorithm_timer.stop();

if (config.output_verbose_statistics)
{
Expand Down

0 comments on commit 411ffc5

Please sign in to comment.