Skip to content

Commit

Permalink
Always show free memory at startup steemit#958
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Mar 21, 2017
1 parent 4186c57 commit 1f9a83a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ namespace detail {
}
}
}
_chain_db->show_free_memory( true );

if( _options->count("api-user") )
{
Expand Down
11 changes: 8 additions & 3 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,14 +2654,19 @@ void database::apply_block( const signed_block& next_block, uint32_t skip )
}
}

show_free_memory( false );

} FC_CAPTURE_AND_RETHROW( (next_block) ) }

void database::show_free_memory( bool force )
{
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) )
if( force || (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 )
{ try {
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/steemit/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ namespace steemit { namespace chain {
const std::string& get_json_schema() const;

void set_flush_interval( uint32_t flush_blocks );
void show_free_memory( bool force );

#ifdef IS_TEST_NET
bool liquidity_rewards_enabled = true;
Expand Down

0 comments on commit 1f9a83a

Please sign in to comment.