| 1 | /* This file is part of Jellyfish. |
| 2 | |
| 3 | Jellyfish is free software: you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation, either version 3 of the License, or |
| 6 | (at your option) any later version. |
| 7 | |
| 8 | Jellyfish is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with Jellyfish. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 18 | #include <stdio.h> |
| 19 | #include <errno.h> |
| 20 | #include <string.h> |
| 21 | #include <stdlib.h> |
| 22 | #include <iostream> |
| 23 | #include <fstream> |
| 24 | #include <vector> |
| 25 | #include <sys/types.h> |
| 26 | #include <sys/stat.h> |
| 27 | #include <stdint.h> |
| 28 | #include <fcntl.h> |
| 29 | #include <unistd.h> |
| 30 | #include <sys/mman.h> |
| 31 | |
| 32 | #include <jellyfish/err.hpp>cxx . . $ `<file>/jellyfish/err.hpp`/ |
| 33 | #include <jellyfish/misc.hpp>cxx . . $ `<file>/jellyfish/misc.hpp`/ |
| 34 | #include <jellyfish/mer_counting.hpp>cxx . . $ `<file>/jellyfish/mer_counting.hpp`/ |
| 35 | #include <jellyfish/compacted_hash.hpp>cxx . . $ `<file>/jellyfish/compacted_hash.hpp`/ |
| 36 | #include <jellyfish/heap.hpp>cxx . . $ `<file>/jellyfish/heap.hpp`/ |
| 37 | #include <jellyfish/hash_merge_cmdline.hpp>cxx . . $ `<file>/jellyfish/hash_merge_cmdline.hpp`/ |
| 38 | |
| 39 | #define MAX_KMER_SIZEcxx . . $ `jellyfish/hash_merge.cc:39:9`! 32 |
| 40 | |
| 41 | class ErrorWritingcxx . . $ ErrorWriting# : public stdcxx . . $ std/::exception { |
| 42 | stdcxx . . $ std/::stringcxx . . $ std/string# msgcxx . . $ ErrorWriting#msg.; |
| 43 | public: |
| 44 | explicit ErrorWritingcxx . . $ ErrorWriting#ErrorWriting(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string# &_msg) : msgcxx . . $ ErrorWriting#msg.(_msg) {} |
| 45 | virtual ~cxx . . $ ErrorWriting#`~ErrorWriting`(ced63f7c635d850d).ErrorWritingcxx . . $ ErrorWriting#() throw() {} |
| 46 | virtual const char* whatcxx . . $ ErrorWriting#what(ba32b354807b2b81).() const throw() { |
| 47 | return msgcxx . . $ ErrorWriting#msg..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | struct writer_buffercxx . . $ writer_buffer# { |
| 52 | volatile bool fullcxx . . $ writer_buffer#full.; |
| 53 | hash_writer_tcxx . . $ hash_writer_t# writercxx . . $ writer_buffer#writer.; |
| 54 | }; |
| 55 | struct writer_infocxx . . $ writer_info# { |
| 56 | lockscxx . . $ locks/::pthreadcxx . . $ locks/pthread/::condcxx . . $ locks/pthread/cond# condcxx . . $ writer_info#cond.; |
| 57 | volatile bool donecxx . . $ writer_info#done.; |
| 58 | uint_tcxx . . $ uint_t# nb_bufferscxx . . $ writer_info#nb_buffers.; |
| 59 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream# *outcxx . . $ writer_info#out.; |
| 60 | writer_buffercxx . . $ writer_buffer# *bufferscxx . . $ writer_info#buffers.; |
| 61 | }; |
| 62 | |
| 63 | void *writer_functioncxx . . $ writer_function(9f162e79bfc6c74).(void *_info) { |
| 64 | writer_infocxx . . $ writer_info# *info = (writer_infocxx . . $ writer_info# *)_info; |
| 65 | uint_tcxx . . $ uint_t# buf_id = 0; |
| 66 | uint64_tcxx . . $ uint64_t# waiting = 0; |
| 67 | |
| 68 | while(true) { |
| 69 | info->condcxx . . $ writer_info#cond..lockcxx . . $ locks/pthread/cond#lock(49f6e7a06ebc5aa8).(); |
| 70 | while(!info->bufferscxx . . $ writer_info#buffers.[buf_id].fullcxx . . $ writer_buffer#full.) { |
| 71 | if(info->donecxx . . $ writer_info#done.) { |
| 72 | info->condcxx . . $ writer_info#cond..unlockcxx . . $ locks/pthread/cond#unlock(49f6e7a06ebc5aa8).(); |
| 73 | return new uint64_tcxx . . $ uint64_t#(waiting); |
| 74 | } |
| 75 | waiting++; |
| 76 | info->condcxx . . $ writer_info#cond..waitcxx . . $ locks/pthread/cond#wait(49f6e7a06ebc5aa8).(); |
| 77 | } |
| 78 | info->condcxx . . $ writer_info#cond..unlockcxx . . $ locks/pthread/cond#unlock(49f6e7a06ebc5aa8).(); |
| 79 | |
| 80 | info->bufferscxx . . $ writer_info#buffers.[buf_id].writercxx . . $ writer_buffer#writer..dumpcxx . . $ jellyfish/compacted_hash/writer#dump(5d3481b062d90072).(info->outcxx . . $ writer_info#out.); |
| 81 | |
| 82 | info->condcxx . . $ writer_info#cond..lockcxx . . $ locks/pthread/cond#lock(49f6e7a06ebc5aa8).(); |
| 83 | info->bufferscxx . . $ writer_info#buffers.[buf_id].fullcxx . . $ writer_buffer#full. = false; |
| 84 | info->condcxx . . $ writer_info#cond..signalcxx . . $ locks/pthread/cond#signal(49f6e7a06ebc5aa8).(); |
| 85 | info->condcxx . . $ writer_info#cond..unlockcxx . . $ locks/pthread/cond#unlock(49f6e7a06ebc5aa8).(); |
| 86 | |
| 87 | buf_id = (buf_id + 1) % info->nb_bufferscxx . . $ writer_info#nb_buffers.; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | int merge_maincxx . . $ merge_main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 92 | { |
| 93 | merge_argscxx . . $ merge_args# argscxx . . $ merge_args#merge_args(c759356ac01a31e7).(argc, argv); |
| 94 | |
| 95 | int i; |
| 96 | unsigned int rklen = 0; |
| 97 | size_t max_reprobe = 0; |
| 98 | size_t hash_size = 0; |
| 99 | SquareBinaryMatrixcxx . . $ SquareBinaryMatrix# hash_matrixcxx . . $ SquareBinaryMatrix#SquareBinaryMatrix(49f6e7a06ebc5aa8).; |
| 100 | SquareBinaryMatrixcxx . . $ SquareBinaryMatrix# hash_inverse_matrixcxx . . $ SquareBinaryMatrix#SquareBinaryMatrix(49f6e7a06ebc5aa8).; |
| 101 | |
| 102 | // compute the number of hashes we're going to read |
| 103 | int num_hashes = args.input_argcxx . . $ merge_args#input_arg..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); |
| 104 | |
| 105 | // this is our row of iterators |
| 106 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<hash_reader_tcxx . . $ hash_reader_t#> iterscxx . . $ std/vector#vector(83fdeebbe0501a83).(num_hashes); |
| 107 | |
| 108 | // create an iterator for each hash file |
| 109 | for(i = 0; i < num_hashes; i++) { |
| 110 | // open the hash database |
| 111 | const char *db_file = args.input_argcxx . . $ merge_args#input_arg.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]; |
| 112 | |
| 113 | try { |
| 114 | iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].initializecxx . . $ jellyfish/compacted_hash/reader#initialize(9c3e69dccae39219).(db_filecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., args.out_buffer_size_argcxx . . $ merge_args#out_buffer_size_arg.); |
| 115 | } catch(stdcxx . . $ std/::exception *e) { |
| 116 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Can't open k-mer database: " <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). e; |
| 117 | } |
| 118 | |
| 119 | unsigned int len = iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_key_lencxx . . $ jellyfish/compacted_hash/reader#get_key_len(fe4d2d262d4164a8).(); |
| 120 | if(rklen != 0 && len != rklen) |
| 121 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Can't merge hashes of different key lengths"; |
| 122 | rklen = len; |
| 123 | |
| 124 | uint64_tcxx . . $ uint64_t# rep = iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_max_reprobecxx . . $ jellyfish/compacted_hash/reader#get_max_reprobe(fe4d2d262d4164a8).(); |
| 125 | if(max_reprobe != 0 && rep != max_reprobe) |
| 126 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Can't merge hashes with different reprobing stratgies"; |
| 127 | max_reprobe = rep; |
| 128 | |
| 129 | size_t size = iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_sizecxx . . $ jellyfish/compacted_hash/reader#get_size(fe4d2d262d4164a8).(); |
| 130 | if(hash_size != 0 && size != hash_size) |
| 131 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Can't merge hash with different size"; |
| 132 | hash_size = size; |
| 133 | |
| 134 | if(hash_matrix.get_sizecxx . . $ SquareBinaryMatrix#get_size(455f465bc33b4cdf).() == 0) { |
| 135 | hash_matrix =cxx . . $ SquareBinaryMatrix#`operator=`(9a673f9fdd59cc84). iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_hash_matrixcxx . . $ jellyfish/compacted_hash/reader#get_hash_matrix(dc810cbe11cd8a39).(); |
| 136 | hash_inverse_matrix =cxx . . $ SquareBinaryMatrix#`operator=`(9a673f9fdd59cc84). iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_hash_inverse_matrixcxx . . $ jellyfish/compacted_hash/reader#get_hash_inverse_matrix(dc810cbe11cd8a39).(); |
| 137 | } else { |
| 138 | SquareBinaryMatrixcxx . . $ SquareBinaryMatrix# new_hash_matrix = iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_hash_matrixcxx . . $ jellyfish/compacted_hash/reader#get_hash_matrix(dc810cbe11cd8a39).(); |
| 139 | SquareBinaryMatrixcxx . . $ SquareBinaryMatrix# new_hash_inverse_matrix = |
| 140 | iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].get_hash_inverse_matrixcxx . . $ jellyfish/compacted_hash/reader#get_hash_inverse_matrix(dc810cbe11cd8a39).(); |
| 141 | if(new_hash_matrix !=cxx . . $ SquareBinaryMatrix#`operator!=`(23651a59e019f298). hash_matrix || |
| 142 | new_hash_inverse_matrix !=cxx . . $ SquareBinaryMatrix#`operator!=`(23651a59e019f298). hash_inverse_matrix) |
| 143 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Can't merge hash with different hash function"; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | if(rklen == 0) |
| 148 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "No valid hash tables found"; |
| 149 | |
| 150 | typedef jellyfishcxx . . $ jellyfish/::heap_tcxx . . $ jellyfish/heap_t#<hash_reader_tcxx . . $ hash_reader_t#> hheap_tcxx . . $ merge_main(afcd3168fc1188a4).hheap_t#; |
| 151 | hheap_tcxx . . $ merge_main(afcd3168fc1188a4).hheap_t# heapcxx . . $ jellyfish/heap_t#heap_t(2c44cd906ae4e829).(num_hashes); |
| 152 | |
| 153 | if(args.verbose_flagcxx . . $ merge_args#verbose_flag.) |
| 154 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "mer length = " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). (rklen / 2) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 155 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "hash size = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). hash_size <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 156 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "num hashes = " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). num_hashes <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 157 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "max reprobe = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). max_reprobe <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 158 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "heap capa = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). heap.capacitycxx . . $ jellyfish/heap_t#capacity(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 159 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "matrix = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). hash_matrix.xor_sumcxx . . $ SquareBinaryMatrix#xor_sum(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" |
| 160 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "inv_matrix = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). hash_inverse_matrix.xor_sumcxx . . $ SquareBinaryMatrix#xor_sum(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 161 | |
| 162 | // populate the initial heap |
| 163 | for(int h = 0; h < num_hashes; ++h) { |
| 164 | if(iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).h].nextcxx . . $ jellyfish/compacted_hash/reader#next(c9857a73d68e59ba).()) |
| 165 | heap.pushcxx . . $ jellyfish/heap_t#push(8e935d9c2e576e3a).(iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).h]); |
| 166 | } |
| 167 | assertcxx . . $ `/usr/include/assert.h:102:11`!(heap.size() == heap.capacity()); |
| 168 | |
| 169 | if(heap.is_emptycxx . . $ jellyfish/heap_t#is_empty(50ce9a9e25b4a850).()) |
| 170 | diecxx . . $ `jellyfish/err.hpp:138:9`! <<cxx . . $ err/die_t#`operator<<`(f22e16ce67cbf691). "Hashes contain no items."; |
| 171 | |
| 172 | // open the output file |
| 173 | stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream# outcxx . . $ std/basic_ofstream#basic_ofstream(b8cd37071ce335df).(args.output_argcxx . . $ merge_args#output_arg..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 174 | size_t nb_records = args.out_buffer_size_argcxx . . $ merge_args#out_buffer_size_arg. / |
| 175 | (bits_to_bytescxx . . $ bits_to_bytes(11815c24b85c60f1).(rklen) + bits_to_bytescxx . . $ bits_to_bytes(11815c24b85c60f1).(8 * args.out_counter_len_argcxx . . $ merge_args#out_counter_len_arg.)); |
| 176 | if(args.verbose_flagcxx . . $ merge_args#verbose_flag.) |
| 177 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "buffer size " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). args.out_buffer_size_argcxx . . $ merge_args#out_buffer_size_arg. |
| 178 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nb_records " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). nb_records <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 179 | writer_infocxx . . $ writer_info# info; |
| 180 | info.nb_bufferscxx . . $ writer_info#nb_buffers. = 4; |
| 181 | info.outcxx . . $ writer_info#out. = &out; |
| 182 | info.donecxx . . $ writer_info#done. = false; |
| 183 | info.bufferscxx . . $ writer_info#buffers. = new writer_buffercxx . . $ writer_buffer#[info.nb_bufferscxx . . $ writer_info#nb_buffers.]; |
| 184 | for(uint_tcxx . . $ uint_t# j = 0; j < info.nb_bufferscxx . . $ writer_info#nb_buffers.; j++) { |
| 185 | info.bufferscxx . . $ writer_info#buffers.[j].fullcxx . . $ writer_buffer#full. = false; |
| 186 | info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..initializecxx . . $ jellyfish/compacted_hash/writer#initialize(975a63120551339d).(nb_records, rklen, |
| 187 | 8 * args.out_counter_len_argcxx . . $ merge_args#out_counter_len_arg., &iters[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0]); |
| 188 | } |
| 189 | info.bufferscxx . . $ writer_info#buffers.[0].writercxx . . $ writer_buffer#writer..write_headercxx . . $ jellyfish/compacted_hash/writer#write_header(7b1875f5045e6781).(&out); |
| 190 | |
| 191 | pthread_t writer_thread; |
| 192 | pthread_create(&writer_thread, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, writer_functioncxx . . $ writer_function(9f162e79bfc6c74)., &info); |
| 193 | |
| 194 | if(args.verbose_flagcxx . . $ merge_args#verbose_flag.) |
| 195 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "out kmer len = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). info.bufferscxx . . $ writer_info#buffers.[0].writercxx . . $ writer_buffer#writer..get_key_len_bytescxx . . $ jellyfish/compacted_hash/writer#get_key_len_bytes(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " bytes\n" |
| 196 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "out val len = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). info.bufferscxx . . $ writer_info#buffers.[0].writercxx . . $ writer_buffer#writer..get_val_len_bytescxx . . $ jellyfish/compacted_hash/writer#get_val_len_bytes(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " bytes\n"; |
| 197 | |
| 198 | uint_tcxx . . $ uint_t# buf_id = 0; |
| 199 | uint64_tcxx . . $ uint64_t# waiting = 0; |
| 200 | hheap_tcxx . . $ merge_main(afcd3168fc1188a4).hheap_t#::const_item_tcxx . . $ jellyfish/heap_t#const_item_t# head = heap.headcxx . . $ jellyfish/heap_t#head(c5ce83d38a535d13).(); |
| 201 | while(heap.is_not_emptycxx . . $ jellyfish/heap_t#is_not_empty(50ce9a9e25b4a850).()) { |
| 202 | uint64_tcxx . . $ uint64_t# key = head->keycxx . . $ jellyfish/heap_item_t#key.; |
| 203 | uint64_tcxx . . $ uint64_t# sum = 0; |
| 204 | do { |
| 205 | sum += head->valcxx . . $ jellyfish/heap_item_t#val.; |
| 206 | heap.popcxx . . $ jellyfish/heap_t#pop(49f6e7a06ebc5aa8).(); |
| 207 | if(head->itcxx . . $ jellyfish/heap_item_t#it.->nextcxx . . $ jellyfish/compacted_hash/reader#next(c9857a73d68e59ba).()) |
| 208 | heap.pushcxx . . $ jellyfish/heap_t#push(8e935d9c2e576e3a).(*head->itcxx . . $ jellyfish/heap_item_t#it.); |
| 209 | head = heap.headcxx . . $ jellyfish/heap_t#head(c5ce83d38a535d13).(); |
| 210 | } while(heap.is_not_emptycxx . . $ jellyfish/heap_t#is_not_empty(50ce9a9e25b4a850).() && head->keycxx . . $ jellyfish/heap_item_t#key. == key); |
| 211 | |
| 212 | while(!info.bufferscxx . . $ writer_info#buffers.[buf_id].writercxx . . $ writer_buffer#writer..appendcxx . . $ jellyfish/compacted_hash/writer#append(7dc03904b9dbe7ff).(key, sum)) { |
| 213 | info.condcxx . . $ writer_info#cond..lockcxx . . $ locks/pthread/cond#lock(49f6e7a06ebc5aa8).(); |
| 214 | info.bufferscxx . . $ writer_info#buffers.[buf_id].fullcxx . . $ writer_buffer#full. = true; |
| 215 | buf_id = (buf_id + 1) % info.nb_bufferscxx . . $ writer_info#nb_buffers.; |
| 216 | while(info.bufferscxx . . $ writer_info#buffers.[buf_id].fullcxx . . $ writer_buffer#full.) { waiting++; info.condcxx . . $ writer_info#cond..waitcxx . . $ locks/pthread/cond#wait(49f6e7a06ebc5aa8).(); } |
| 217 | info.condcxx . . $ writer_info#cond..signalcxx . . $ locks/pthread/cond#signal(49f6e7a06ebc5aa8).(); |
| 218 | info.condcxx . . $ writer_info#cond..unlockcxx . . $ locks/pthread/cond#unlock(49f6e7a06ebc5aa8).(); |
| 219 | } |
| 220 | } |
| 221 | info.condcxx . . $ writer_info#cond..lockcxx . . $ locks/pthread/cond#lock(49f6e7a06ebc5aa8).(); |
| 222 | // while(info.buffers[buf_id].full) { waiting++; info.cond.wait(); } |
| 223 | info.bufferscxx . . $ writer_info#buffers.[buf_id].fullcxx . . $ writer_buffer#full. = true; |
| 224 | info.donecxx . . $ writer_info#done. = true; |
| 225 | info.condcxx . . $ writer_info#cond..signalcxx . . $ locks/pthread/cond#signal(49f6e7a06ebc5aa8).(); |
| 226 | info.condcxx . . $ writer_info#cond..unlockcxx . . $ locks/pthread/cond#unlock(49f6e7a06ebc5aa8).(); |
| 227 | |
| 228 | //uint64_t *writer_waiting; |
| 229 | pthread_join(writer_thread, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 230 | |
| 231 | uint64_tcxx . . $ uint64_t# unique = 0, distinct = 0, total = 0, max_count = 0; |
| 232 | for(uint_tcxx . . $ uint_t# j = 0; j < info.nb_bufferscxx . . $ writer_info#nb_buffers.; j++) { |
| 233 | unique += info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..get_uniquecxx . . $ jellyfish/compacted_hash/writer#get_unique(fe4d2d262d4164a8).(); |
| 234 | distinct += info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..get_distinctcxx . . $ jellyfish/compacted_hash/writer#get_distinct(fe4d2d262d4164a8).(); |
| 235 | total += info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..get_totalcxx . . $ jellyfish/compacted_hash/writer#get_total(fe4d2d262d4164a8).(); |
| 236 | if(info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..get_max_countcxx . . $ jellyfish/compacted_hash/writer#get_max_count(fe4d2d262d4164a8).() > max_count) |
| 237 | max_count = info.bufferscxx . . $ writer_info#buffers.[j].writercxx . . $ writer_buffer#writer..get_max_countcxx . . $ jellyfish/compacted_hash/writer#get_max_count(fe4d2d262d4164a8).(); |
| 238 | } |
| 239 | info.bufferscxx . . $ writer_info#buffers.[0].writercxx . . $ writer_buffer#writer..update_stats_withcxx . . $ jellyfish/compacted_hash/writer#update_stats_with(3412871b3cd9923a).(&out, unique, distinct, total, max_count); |
| 240 | out.closecxx . . $ std/basic_ofstream#close(49f6e7a06ebc5aa8).(); |
| 241 | return 0; |
| 242 | } |