analyse: delay output file creation until after chunk discovery

This commit is contained in:
Danny Robson 2020-12-29 08:36:46 +10:00
parent 050ade9787
commit 69cd8079da

View File

@ -192,9 +192,6 @@ int main (int argc, char const **argv)
std::cerr << p << '\n'; std::cerr << p << '\n';
std::ofstream output (argv[ARGS_OUTPUT], std::ios::out | std::ios::trunc);
output.exceptions (std::ios::badbit | std::ios::eofbit | std::ios::failbit);
// Find all the chunks and prepare them for output // Find all the chunks and prepare them for output
std::cout << "processing\n"; std::cout << "processing\n";
std::vector<emory::chunk::region> src = find_chunks (argv[ARGS_INPUT], p); std::vector<emory::chunk::region> src = find_chunks (argv[ARGS_INPUT], p);
@ -203,6 +200,8 @@ int main (int argc, char const **argv)
std::sort (src.begin (), src.end (), region_less); std::sort (src.begin (), src.end (), region_less);
// Write all chunks to the output file // Write all chunks to the output file
std::ofstream output (argv[ARGS_OUTPUT], std::ios::out | std::ios::trunc);
output.exceptions (std::ios::badbit | std::ios::eofbit | std::ios::failbit);
output << "params: " << p << '\n'; output << "params: " << p << '\n';
for (auto const &chunk: src) { for (auto const &chunk: src) {
output << chunk.size() << ' '; output << chunk.size() << ' ';