Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print free memory #642

Merged
merged 1 commit into from
Dec 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void database::reindex( const fc::path& data_dir, const fc::path& shared_mem_dir
{
auto cur_block_num = itr.first.block_num();
if( cur_block_num % 100000 == 0 )
std::cerr << " " << double( cur_block_num * 100 ) / last_block_num << "% " << cur_block_num << " of " << last_block_num << " \n";
std::cerr << " " << double( cur_block_num * 100 ) / last_block_num << "% " << cur_block_num << " of " << last_block_num <<
" (" << (get_free_memory() / (1024*1024)) << "M free)\n";
apply_block( itr.first, skip_flags );
itr = _block_log.read_block( itr.second );
}
Expand Down Expand Up @@ -2959,6 +2960,13 @@ void database::apply_block( const signed_block& next_block, uint32_t skip )
}
}

uint32_t free_gb = uint32_t(get_free_memory() / (1024*1024*1024));
if( (free_gb < _last_free_gb_printed) || (free_gb > _last_free_gb_printed+1) )
{
ilog( "Free memory is now ${n}G", ("n", free_gb) );
_last_free_gb_printed = free_gb;
}

} FC_CAPTURE_AND_RETHROW( (next_block) ) }

void database::_apply_block( const signed_block& next_block )
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/include/steemit/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ namespace steemit { namespace chain {
uint32_t _flush_blocks = 0;
uint32_t _next_flush_block = 0;

uint32_t _last_free_gb_printed = 0;

flat_map< std::string, std::shared_ptr< custom_operation_interpreter > > _custom_operation_interpreters;
std::string _json_schema;
};
Expand Down
2 changes: 1 addition & 1 deletion libraries/chainbase