Skip to content

Commit

Permalink
More improvements to the new memory manager
Browse files Browse the repository at this point in the history
the memory manager now compiles with g++4.7. The hugepages example
now shows how the memory monitor is used.
  • Loading branch information
mpetri committed Sep 11, 2013
1 parent c9c8c07 commit 4cfa4af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions examples/hugepages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void do_something(const tCsa& csa)
sum+=csa.psi(i);
}
auto stop = timer::now();
cout << "runtime in ms: " << duration_cast<microseconds>(stop-start).count() << endl;
cout << "runtime in s: " << duration_cast<seconds>(stop-start).count() << endl;
cout <<"sum="<<sum<<endl;
}

Expand All @@ -33,10 +33,18 @@ int main(int argc, char** argv)
memory_manager::use_hugepages(500*1024*1024);
}

memory_monitor::start();

csa_wt<> csa;
auto start = timer::now();
construct(csa, argv[1], 1);
auto stop = timer::now();
cout << "construction in ms: " << duration_cast<microseconds>(stop-start).count() << endl;
cout << "construction in s: " << duration_cast<seconds>(stop-start).count() << endl;
do_something(csa); // before it is mapped

memory_monitor::stop();

std::ofstream ofs("cst-construction.json");
memory_monitor::write_memory_log<JSON>(ofs);
ofs.close();
}
2 changes: 1 addition & 1 deletion include/sdsl/memory_management.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class memory_monitor
int64_t usage;
mm_event(timer::time_point t,int64_t u) : timestamp(t) , usage(u) {};
};
std::chrono::milliseconds log_granularity = std::chrono::milliseconds(50);
std::chrono::milliseconds log_granularity = std::chrono::milliseconds(20);
int64_t current_usage = 0;
int64_t peak_usage = 0;
bool track_usage = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/memory_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ hugepage_allocator::remove_from_free_set(mm_block_t* block)
void
hugepage_allocator::insert_into_free_set(mm_block_t* block)
{
m_free_large.emplace(block->size,block);
m_free_large.insert( {block->size,block});
}

mm_block_t*
Expand Down

0 comments on commit 4cfa4af

Please sign in to comment.