- modified holt_widget to show processes or threads
- updated test-holt_widget to show processes or threads git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@930 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
8911016da8
commit
2ff804ecbe
3 changed files with 127 additions and 124 deletions
|
@ -243,6 +243,7 @@ protected:
|
|||
virtual void on_button_stop_clicked();
|
||||
virtual void on_button_pause_clicked();
|
||||
virtual void on_button_runmode_clicked();
|
||||
virtual void on_button_showthreads_clicked();
|
||||
virtual void on_buttons_radio_clicked();
|
||||
virtual void on_buttons_radio_disp_clicked();
|
||||
virtual bool on_timer_timeout();
|
||||
|
@ -254,6 +255,7 @@ protected:
|
|||
Gtk::Button _stop_button;
|
||||
Gtk::Button _pause_button;
|
||||
Gtk::CheckButton _runmode_button;
|
||||
Gtk::CheckButton _showthreads_button;
|
||||
Gtk::RadioButton _noscale_radio;
|
||||
Gtk::RadioButton _fit_radio;
|
||||
Gtk::RadioButton _stretch_radio;
|
||||
|
@ -276,6 +278,7 @@ MainWindow::MainWindow(Simulation& simulation)
|
|||
_stop_button("Stop"),
|
||||
_pause_button("Pause"),
|
||||
_runmode_button("Continue"),
|
||||
_showthreads_button("Show threads"),
|
||||
_noscale_radio("no scale"),
|
||||
_fit_radio("scale all"),
|
||||
_stretch_radio("stretch"),
|
||||
|
@ -299,6 +302,10 @@ MainWindow::MainWindow(Simulation& simulation)
|
|||
_runmode_button.set_active(false);
|
||||
_runmode_button.show();
|
||||
|
||||
_buttons_box.pack_start(_showthreads_button);
|
||||
_showthreads_button.set_active(false);
|
||||
_showthreads_button.show();
|
||||
|
||||
// scale radio buttons
|
||||
Gtk::RadioButton::Group group = _noscale_radio.get_group();
|
||||
_fit_radio.set_group(group);
|
||||
|
@ -348,6 +355,7 @@ MainWindow::MainWindow(Simulation& simulation)
|
|||
_stop_button.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_button_stop_clicked), true );
|
||||
_pause_button.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_button_pause_clicked), true );
|
||||
_runmode_button.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_button_runmode_clicked), true );
|
||||
_showthreads_button.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_button_showthreads_clicked), true );
|
||||
|
||||
_noscale_radio.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_buttons_radio_clicked), true );
|
||||
_fit_radio.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_buttons_radio_clicked), true );
|
||||
|
@ -359,6 +367,9 @@ MainWindow::MainWindow(Simulation& simulation)
|
|||
|
||||
Glib::signal_timeout().connect(sigc::mem_fun(*this, &MainWindow::on_timer_timeout), 1000);
|
||||
|
||||
on_button_runmode_clicked();
|
||||
on_button_showthreads_clicked();
|
||||
|
||||
//is equivalent to:
|
||||
/*
|
||||
const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(1000);
|
||||
|
@ -373,6 +384,7 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::on_button_start_clicked()
|
||||
{
|
||||
std::cout << "on_button_start_clicked" << endl;
|
||||
if(_sim_state == Simulation::state_stopped
|
||||
|| _sim_state == Simulation::state_paused)
|
||||
{
|
||||
|
@ -392,6 +404,7 @@ void MainWindow::on_button_start_clicked()
|
|||
}
|
||||
void MainWindow::on_button_stop_clicked()
|
||||
{
|
||||
std::cout << "on_button_stop_clicked" << endl;
|
||||
if(_sim_state == Simulation::state_running
|
||||
|| _sim_state == Simulation::state_paused)
|
||||
{
|
||||
|
@ -402,6 +415,7 @@ void MainWindow::on_button_stop_clicked()
|
|||
}
|
||||
void MainWindow::on_button_pause_clicked()
|
||||
{
|
||||
std::cout << "on_button_pause_clicked" << endl;
|
||||
if(_sim_state == Simulation::state_running)
|
||||
{
|
||||
_sim_state = Simulation::state_paused;
|
||||
|
@ -411,12 +425,23 @@ void MainWindow::on_button_pause_clicked()
|
|||
_sim_state = Simulation::state_running;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_button_runmode_clicked()
|
||||
{
|
||||
std::cout << "on_button_runmode_clicked" << endl;
|
||||
}
|
||||
|
||||
void MainWindow::on_button_showthreads_clicked()
|
||||
{
|
||||
std::cout << "on_button_showthreads_clicked" << endl;
|
||||
_holt_widget.set_show_threads(_showthreads_button.get_active());
|
||||
_holt_widget.resize_redraw();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_buttons_radio_clicked()
|
||||
{
|
||||
std::cout << "on_buttons_radio_clicked" << endl;
|
||||
if(_noscale_radio.get_active())
|
||||
{
|
||||
// std::cout << "scaling_none" << endl;
|
||||
|
@ -443,6 +468,7 @@ void MainWindow::on_buttons_radio_clicked()
|
|||
|
||||
void MainWindow::on_buttons_radio_disp_clicked()
|
||||
{
|
||||
std::cout << "on_buttons_radio_disp_clicked" << endl;
|
||||
if(_horizontal_radio.get_active())
|
||||
{
|
||||
// std::cout << "_horizontal_radio" << endl;
|
||||
|
@ -570,11 +596,11 @@ void fillHistory(History &hist)
|
|||
History::ResourcePair respair = hist.add_resource(Glib::ustring("Resource 1"), false, 1, 2);
|
||||
|
||||
// add a resource - name, preemptable, places, availability
|
||||
History::ResourcePair respair2 = hist.add_resource(Glib::ustring("Invalid? Resource <n> 1"), false, 1, 2);
|
||||
History::ResourcePair respair2 = hist.add_resource(Glib::ustring("Very Long Named Resource 2"), false, 1, 2);
|
||||
|
||||
// delete resources to kreate a key numbering hole
|
||||
hist.remove(respair0.first);
|
||||
hist.remove(respair00.first);
|
||||
// hist.remove(respair0.first);
|
||||
// hist.remove(respair00.first);
|
||||
|
||||
// add a process - name, arrival time, priority
|
||||
Process& p1 = hist.add_process(Glib::ustring("Process 1"), 0, 2); // name, arrival time, priority
|
||||
|
@ -586,22 +612,31 @@ void fillHistory(History &hist)
|
|||
Process& p3 = hist.add_process(Glib::ustring("Process 3"), 5, 5); // name, arrival time, priority
|
||||
|
||||
// add a process - name, arrival time, priority
|
||||
Process& p4 = hist.add_process(Glib::ustring("Invalid? <process/> &3 or\\4"), 9, 1); // name, arrival time, priority
|
||||
Process& p4 = hist.add_process(Glib::ustring("Very Long Named Process 4"), 9, 1); // name, arrival time, priority
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p1_t1 = hist.add_thread(Glib::ustring("P1 - Thread 1"), p1, 14, 0, 2);
|
||||
Thread& p1_t1 = hist.add_thread(Glib::ustring("P1 - Th 1"), p1, 14, 0, 2);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
// Thread& p1_t2 = hist.add_thread(Glib::ustring("P1 - Thread 2"), p1, 3, 0, 5);
|
||||
Thread& p1_t2 = hist.add_thread(Glib::ustring("P1 - Th 2"), p1, 3, 3, 5);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p2_t1 = hist.add_thread(Glib::ustring("P2 - Thread 1"), p2, 20, 0, 2);
|
||||
Thread& p1_t3 = hist.add_thread(Glib::ustring("P1 - Th 3"), p1, 4, 3, 5);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p3_t1 = hist.add_thread(Glib::ustring("P3 - Thread 2"), p3, 12, 0, 2);
|
||||
Thread& p1_t4 = hist.add_thread(Glib::ustring("P1 - Th 4"), p1, 5, 3, 4);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p4_t1 = hist.add_thread(Glib::ustring("P4 - Thread 1"), p4, 3, 0, 2);
|
||||
Thread& p2_t1 = hist.add_thread(Glib::ustring("P2 - Th 1"), p2, 20, 0, 2);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p3_t1 = hist.add_thread(Glib::ustring("P3 - Th 2"), p3, 12, 0, 2);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p4_t1 = hist.add_thread(Glib::ustring("P4 - Th 1"), p4, 7, 0, 2);
|
||||
|
||||
// add a thread - name, parent, cpu time, arrival time, priority
|
||||
Thread& p4_t2 = hist.add_thread(Glib::ustring("P4 - Th 2"), p4, 3, 6, 2);
|
||||
|
||||
// add a request - Thread, time
|
||||
Request& req1 = hist.add_request(p1_t1, 3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue