Skip to content

Commit

Permalink
Add current profileset to signal handler output
Browse files Browse the repository at this point in the history
  • Loading branch information
navv1234 committed Dec 23, 2017
1 parent 677dba3 commit 51656a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 7 additions & 2 deletions engine/sc_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ struct sim_signal_handler_t
std::cerr << "sim_signal_handler: " << name
<< "! Iteration=" << global_sim -> current_iteration
<< " Seed=" << global_sim -> seed
<< " TargetHealth=" << global_sim -> target -> resources.initial[ RESOURCE_HEALTH ]
<< std::endl;
<< " TargetHealth=" << global_sim -> target -> resources.initial[ RESOURCE_HEALTH ];
auto profileset = global_sim -> profilesets.current_profileset_name();
if ( ! profileset.empty() )
{
std::cerr << " ProfileSet=" << profileset;
}
std::cerr << std::endl;
fflush( stderr );
}

Expand Down
14 changes: 14 additions & 0 deletions engine/sim/sc_profileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,20 @@ void profilesets_t::set_state( state new_state )
m_mutex.unlock();
}

std::string profilesets_t::current_profileset_name()
{
if ( is_done() || m_work_index == 0 )
{
return std::string();
}

m_control_lock.lock();
std::string profileset_name = m_profilesets[ m_work_index - 1 ] -> name();
m_control_lock.unlock();

return profileset_name;
}

bool profilesets_t::iterate( sim_t* parent )
{
if ( parent -> profileset_map.size() == 0 )
Expand Down
2 changes: 2 additions & 0 deletions engine/sim/sc_profileset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ class profilesets_t
size_t n_profilesets() const
{ return m_profilesets.size(); }

std::string current_profileset_name();

bool parse( sim_t* );
void initialize( sim_t* );
void cancel();
Expand Down

0 comments on commit 51656a3

Please sign in to comment.