8 #include "misc/utils.h"
10 #ifdef MULTITHREAD_SUPPORT
12 const int MAX_THREADS = 64;
19 int main(int argc, char** argv)
21 std::cout << "RLCSA display test" << std::endl;
24 std::cout << "Usage: extract_sequence base_name sequence_number output" << std::endl;
28 std::cout << "Base name: " << argv[1] << std::endl;
29 usint sequence = atoi(argv[2]);
30 std::cout << "Sequence number: " << sequence << std::endl;
31 std::cout << "Output: " << argv[3] << std::endl;
32 std::cout << std::endl;
35 if(!rlcsa.supportsDisplay())
37 std::cerr << "Error: Display is not supported!" << std::endl;
41 rlcsa.reportSize(true);
42 if(sequence >= rlcsa.getNumberOfSequences())
44 std::cerr << "Error: Invalid sequence number!" << std::endl;
48 std::ofstream output(argv[3], std::ios_base::binary);
51 std::cerr << "Error: Cannot open output file!" << std::endl;
55 double start = readTimer();
56 uchar* buffer = rlcsa.display(sequence);
57 usint bytes = length(rlcsa.getSequenceRange(sequence));
58 output.write((char*)buffer, bytes);
62 double time = readTimer() - start;
63 double megabytes = bytes / (double)MEGABYTE;
64 std::cout << megabytes << " megabytes in " << time << " seconds (" << (megabytes / time) << " MB/s)" << std::endl;
65 std::cout << std::endl;