forked from simongog/sdsl-lite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hugepages.cpp
49 lines (45 loc) · 1.06 KB
/
hugepages.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <sdsl/int_vector.hpp>
#include <sdsl/suffix_trees.hpp>
#include <sdsl/wt_rlmn.hpp>
#include <sdsl/testutils.hpp>
#include <sdsl/bit_vector_interleaved.hpp>
#include <iostream>
#include <string>
using namespace sdsl;
using namespace std;
template<class tCsa>
void do_something(const tCsa &csa){
util::stop_watch sw;
uint64_t sum=0;
sw.start();
for(size_t i=0; i<csa.size() and i<10000000;++i){
sum+=csa.psi(i);
}
sw.stop();
cout << sw.real_time() << endl;
cout<<"sum="<<sum<<endl;
}
int main(int argc, char** argv){
// util::verbose = true;
{
bit_vector b(32,1);
cout << b << endl;
}
{
bit_vector b(32,0);
bool mapped = mm::map_hp();
if ( mapped ) mm::unmap_hp();
cout << b << endl;
}
bool mapped;
// bool mapped = mm::map_hp();
// if( mapped ) mm::unmap_hp();
csa_wt<wt_huff<bit_vector_interleaved<> > > csa;
construct(csa, argv[1], 1);
do_something(csa); // before it is mapped
mapped = mm::map_hp();
do_something(csa); // while it is mapped
if ( mapped ) mm::unmap_hp();
do_something(csa); // after it is unmapped
util::clear(csa);
}