From 8d7b398b00c87021616ebdd8642627530b60c12d Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 5 May 2005 22:28:17 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=6048 --- checkin_notes | 20 ++++++++++++++++++++ client/app.C | 1 + client/app.h | 3 +++ client/app_control.C | 31 +++++++++++++++++++++++++------ client/cs_benchmark.C | 2 +- client/cs_prefs.C | 6 +++++- clientgui/ViewStatistics.cpp | 12 ++++++++---- 7 files changed, 63 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index cebc1d2755..7ff635ab1b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6199,3 +6199,23 @@ David 5 May 2005 team.inc user/ team_display.php + +Rom 5 May 2005 + - When running benchmarks, close down and remove science applications + from memory. If a science application isn't listening to the quit request + it may not be responding to suspend/resume either which would cause problems + during the benchmark process. + - If a science application doesn't shutdown within 10 seconds, kill it. + - Fix the bug I introduced last night with the view statistics tab. + - Make suspend_all call atp->preempt() instead of doing the same thing itself. + - Move the starting benchmark message to a place right before the benchmarks + start. We were receiving a few process control messages and people might + interpret that to mean other stuff was going on during the benchmarks. + + client/ + app.C, .h + app_control.C + cs_benchmark.C + cs_prefs.C + clientgui/ + ViewStatistics.cpp diff --git a/client/app.C b/client/app.C index 4580385395..dafa76bc4b 100644 --- a/client/app.C +++ b/client/app.C @@ -212,6 +212,7 @@ bool ACTIVE_TASK_SET::poll(double now) { graphics_poll(); process_control_poll(); action |= check_rsc_limits_exceeded(); + action |= check_quit_timeout_exceeded(); if (get_msgs()) { action = true; } diff --git a/client/app.h b/client/app.h index fd542ea122..03c9c89bd6 100644 --- a/client/app.h +++ b/client/app.h @@ -124,6 +124,8 @@ public: bool have_trickle_down; bool send_upload_file_status; bool pending_suspend_via_quit; // waiting for task to suspend via quit + double pending_suspend_via_quit_time; // check to see if the application has quit + // before timing out, otherwise kill it. APP_CLIENT_SHM app_client_shm; // core/app shared mem MSG_QUEUE graphics_request_queue; @@ -203,6 +205,7 @@ public: bool get_msgs(); bool check_app_exited(); bool check_rsc_limits_exceeded(); + bool check_quit_timeout_exceeded(); bool vm_limit_exceeded(double); int get_free_slot(); void send_heartbeats(); diff --git a/client/app_control.C b/client/app_control.C index 9d4e9cbd0e..5091b59dc9 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -171,6 +171,7 @@ int ACTIVE_TASK::preempt(bool quit_task) { if (quit_task) { retval = request_exit(); pending_suspend_via_quit = true; + pending_suspend_via_quit_time = dtime(); } else { retval = suspend(); } @@ -541,6 +542,29 @@ bool ACTIVE_TASK_SET::check_rsc_limits_exceeded() { return false; } +// Check if any of the active tasks have exceeded their +// timeout to quit gracefully +// +bool ACTIVE_TASK_SET::check_quit_timeout_exceeded() { + unsigned int j; + ACTIVE_TASK *atp; + double now = dtime(); + + for (j=0;jtask_state != PROCESS_EXECUTING) continue; + if (atp->scheduler_state != CPU_SCHED_PREEMPTED) continue; + if (atp->pending_suspend_via_quit) { + if ((now - atp->pending_suspend_via_quit_time) > 10.0) { + atp->kill_task(); + return true; + } + } + } + + return false; +} + // If process is running, send it a kill signal // This is done when app has exceeded CPU, disk, or mem limits // @@ -723,12 +747,7 @@ void ACTIVE_TASK_SET::suspend_all(bool leave_apps_in_memory) { atp = active_tasks[i]; if (atp->task_state != PROCESS_EXECUTING) continue; if (atp->result->project->non_cpu_intensive) continue; - if (leave_apps_in_memory) { - atp->suspend(); - } else { - atp->request_exit(); - atp->pending_suspend_via_quit = true; - } + atp->preempt(!leave_apps_in_memory); } } diff --git a/client/cs_benchmark.C b/client/cs_benchmark.C index 19647be5a3..4399940215 100644 --- a/client/cs_benchmark.C +++ b/client/cs_benchmark.C @@ -186,7 +186,6 @@ void CLIENT_STATE::start_cpu_benchmarks() { remove_benchmark_file(BM_TYPE_INT); cpu_benchmarks_start = dtime(); - msg_printf(NULL, MSG_INFO, "Running CPU benchmarks"); if (!benchmark_descs) { benchmark_descs = (BENCHMARK_DESC*)calloc( host_info.p_ncpus, sizeof(BENCHMARK_DESC) @@ -297,6 +296,7 @@ bool CLIENT_STATE::cpu_benchmarks_poll() { switch (bm_state) { case BM_FP_INIT: if (now - cpu_benchmarks_start > FP_START) { + msg_printf(NULL, MSG_INFO, "Running CPU benchmarks"); make_benchmark_file(BM_TYPE_FP); bm_state = BM_FP; } diff --git a/client/cs_prefs.C b/client/cs_prefs.C index 1bd15dcd7e..15abb013e7 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -188,7 +188,11 @@ int CLIENT_STATE::suspend_activities(int reason) { s_reason += " - out of disk space - change global prefs"; } msg_printf(NULL, MSG_INFO, const_cast(s_reason.c_str())); - active_tasks.suspend_all(global_prefs.leave_apps_in_memory); + if (reason & SUSPEND_REASON_BENCHMARKS) { + active_tasks.suspend_all(false); + } else { + active_tasks.suspend_all(global_prefs.leave_apps_in_memory); + } pers_file_xfers->suspend(); return 0; } diff --git a/clientgui/ViewStatistics.cpp b/clientgui/ViewStatistics.cpp index 18bd8589e9..0b01d75ac5 100644 --- a/clientgui/ViewStatistics.cpp +++ b/clientgui/ViewStatistics.cpp @@ -361,7 +361,6 @@ void CViewStatistics::OnStatisticsUserTotal( wxCommandEvent& event ) { pFrame->UpdateStatusText(_("Updating charts...")); m_PaintStatistics->heading=_("User Total"); m_PaintStatistics->m_SelectedStatistic=0; - m_PaintStatistics->Refresh(); pFrame->UpdateStatusText(wxT("")); UpdateSelection(); @@ -382,7 +381,6 @@ void CViewStatistics::OnStatisticsUserAverage( wxCommandEvent& event ) { pFrame->UpdateStatusText(_("Updating charts...")); m_PaintStatistics->heading=_("User Average"); m_PaintStatistics->m_SelectedStatistic=1; - m_PaintStatistics->Refresh(); pFrame->UpdateStatusText(wxT("")); UpdateSelection(); @@ -403,7 +401,6 @@ void CViewStatistics::OnStatisticsHostTotal( wxCommandEvent& event ) { pFrame->UpdateStatusText(_("Updating charts...")); m_PaintStatistics->heading=_("Host Total"); m_PaintStatistics->m_SelectedStatistic=2; - m_PaintStatistics->Refresh(); pFrame->UpdateStatusText(wxT("")); UpdateSelection(); @@ -424,7 +421,6 @@ void CViewStatistics::OnStatisticsHostAverage( wxCommandEvent& event ) { pFrame->UpdateStatusText(_("Updating charts...")); m_PaintStatistics->heading=_("Host Average"); m_PaintStatistics->m_SelectedStatistic=3; - m_PaintStatistics->Refresh(); pFrame->UpdateStatusText(wxT("")); UpdateSelection(); @@ -461,6 +457,14 @@ bool CViewStatistics::OnRestoreState(wxConfigBase* pConfig) { void CViewStatistics::OnListRender( wxTimerEvent& event ) { + CMainDocument* pDoc = wxGetApp().GetDocument(); + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + + if (pDoc->GetStatisticsCount()) { + m_PaintStatistics->Refresh(); + } }