// show task properties // void CDlgItemProperties::renderInfos(RESULT* result) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxDateTime dt; wxString wxTitle = _("Properties of task "); wxTitle.append(wxString(result->name, wxConvUTF8)); SetTitle(wxTitle); APP_VERSION* avp = NULL; WORKUNIT* wup = NULL; RESULT* r = pDoc->state.lookup_result(result->project_url, result->name); if (r) { avp = r->avp; wup = r->wup; } addProperty(_("Application"), FormatApplicationName(result)); addProperty(_("Workunit name"),wxString(result->wu_name, wxConvUTF8)); addProperty(_("State"), result_description(result, false)); if (result->received_time) { dt.Set((time_t)result->received_time); addProperty(_("Received"), dt.Format()); } dt.Set((time_t)result->report_deadline); addProperty(_("Report deadline"), dt.Format()); if (strlen(result->resources)) { addProperty(_("Resources"), wxString(result->resources, wxConvUTF8)); } if (wup) { addProperty(_("Estimated computation size"), wxString::Format(wxT("%.0f GFLOPs"), wup->rsc_fpops_est/1e9)); } if (result->active_task) { addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time)); addProperty(_("CPU time"), FormatTime(result->current_cpu_time)); if (result->elapsed_time >= 0) { addProperty(_("Elapsed time"), FormatTime(result->elapsed_time)); } addProperty(_("Estimated time remaining"), FormatTime(result->estimated_cpu_time_remaining)); addProperty(_("Fraction done"), wxString::Format(wxT("%.3f %%"), result->fraction_done*100)); addProperty(_("Virtual memory size"), FormatDiskSpace(result->swap_size)); addProperty(_("Working set size"), FormatDiskSpace(result->working_set_size_smoothed)); if (result->slot >= 0) { addProperty(_("Directory"), wxString::Format(wxT("slots/%d"), result->slot)); } if (result->pid) { addProperty(_("Process ID"), wxString::Format(wxT("%d"), result->pid)); } } else if (result->state >= RESULT_COMPUTE_ERROR) { addProperty(_("CPU time"), FormatTime(result->final_cpu_time)); addProperty(_("Elapsed time"), FormatTime(result->final_elapsed_time)); } m_gbSizer->Layout(); m_scrolledWindow->FitInside(); }
void CViewResources::OnListRender( wxTimerEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxString diskspace; static double project_total=0.0; unsigned int i; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); //get data for BOINC projects disk usage pDoc->CachedDiskUsageUpdate(); pDoc->CachedStateUpdate(); bool refreshBOINC=false; if (pDoc->disk_usage.projects.size()>0) { m_BOINCwasEmpty=false; //check for changes worth a refresh if(pDoc->disk_usage.projects.size() != m_pieCtrlBOINC->m_Series.size()) { refreshBOINC=true; } else { for (i=0; i<pDoc->disk_usage.projects.size(); i++) { wxString oldValue; wxString newValue; FormatDiskSpace(pDoc->DiskUsageProject(i)->disk_usage, newValue); FormatDiskSpace(m_pieCtrlBOINC->m_Series.Item(i).GetValue(), oldValue); if(newValue.Cmp(oldValue)!=0) { refreshBOINC=true; break; } } } //only refresh when worthy changes if(refreshBOINC) { m_pieCtrlBOINC->m_Series.Clear(); project_total = 0; for (i=0; i<pDoc->disk_usage.projects.size(); i++) { //update data for boinc projects pie chart PROJECT* project = pDoc->DiskUsageProject(i); wxString projectname; FormatProjectName(project, projectname); FormatDiskSpace(project->disk_usage, diskspace); double usage = project->disk_usage; project_total += usage; wxPiePart part; part.SetLabel(projectname + wxT(": ") + diskspace); part.SetValue(usage); unsigned char r=128+(rand()&127); unsigned char g=128+(rand()&127); unsigned char b=128+(rand()&127); part.SetColour(wxColour(r, g, b)); m_pieCtrlBOINC->m_Series.Add(part); } m_pieCtrlBOINC->Refresh(); } } else { if(!m_BOINCwasEmpty) { //paint an empty black pie m_pieCtrlBOINC->m_Series.Clear(); wxPiePart part; part.SetLabel(_("not attached to any BOINC project: 0 bytes")); part.SetValue(1); part.SetColour(wxColour(0,0,0)); m_pieCtrlBOINC->m_Series.Add(part); m_pieCtrlBOINC->Refresh(); m_BOINCwasEmpty=true; refreshBOINC=true; } } //pDoc->disk_usage.d_allowed = 0; //data for pie chart 2 (total disk usage) // // good source of color palettes: // http://www.siteprocentral.com/cgi-bin/feed/feed.cgi // bool refreshTotal=false; double free = pDoc->disk_usage.d_free; double total = pDoc->disk_usage.d_total; if(m_pieCtrlTotal->m_Series.size()>0) { wxString oldFree; wxString newFree; FormatDiskSpace(free, newFree); FormatDiskSpace(m_pieCtrlTotal->m_Series.Item(0).GetValue(), oldFree); if(oldFree.Cmp(newFree)!=0) { refreshTotal=true; } } else { refreshTotal=true; } if(refreshBOINC || refreshTotal) { m_pieCtrlTotal->m_Series.Clear(); wxPiePart part; // used by BOINC double boinc_total = project_total + pDoc->disk_usage.d_boinc; FormatDiskSpace(boinc_total, diskspace); part.SetLabel(_("used by BOINC: ") + diskspace); part.SetValue(boinc_total); part.SetColour(wxColour(0,0,0)); m_pieCtrlTotal->m_Series.Add(part); if (pDoc->disk_usage.d_allowed > 0) { double avail = pDoc->disk_usage.d_allowed - boinc_total; if (avail > 0) { if (avail > free) avail = free; FormatDiskSpace(avail, diskspace); part.SetLabel(_("free, available to BOINC: ") + diskspace); part.SetValue(avail); part.SetColour(wxColour(128, 128, 128)); m_pieCtrlTotal->m_Series.Add(part); } else { avail = 0; } double not_avail = free - avail; if (not_avail > 0) { FormatDiskSpace(not_avail, diskspace); part.SetLabel(_("free, not available to BOINC: ") + diskspace); part.SetValue(not_avail); part.SetColour(wxColour(238,238,238)); m_pieCtrlTotal->m_Series.Add(part); } } else { // if d_allowed is zero, we must be talking to a pre-6.3 client. // Just show free space // FormatDiskSpace(free, diskspace); part.SetLabel(_("free: ") + diskspace); part.SetValue(free); part.SetColour(wxColour(238,238,238)); m_pieCtrlTotal->m_Series.Add(part); } // used by others double used_by_others = total-boinc_total-free; FormatDiskSpace(used_by_others, diskspace); part.SetLabel(_("used by other programs: ") + diskspace); part.SetValue(used_by_others); part.SetColour(wxColour(192,192,192)); m_pieCtrlTotal->m_Series.Add(part); m_pieCtrlTotal->Refresh(); } }
// show project properties // void CDlgItemProperties::renderInfos(PROJECT* project_in) { std::string projectname; //collecting infos project_in->get_name(projectname); //disk usage needs additional lookups CMainDocument* pDoc = wxGetApp().GetDocument(); pDoc->CachedDiskUsageUpdate(); // CachedDiskUsageUpdate() may have invalidated our project // pointer, so get an updated pointer to this project PROJECT* project = pDoc->project(project_in->master_url); if(!project) return; // TODO: display some sort of error alert? std::vector<PROJECT*> dp = pDoc->disk_usage.projects; double diskusage=0.0; for (unsigned int i=0; i< dp.size(); i++) { PROJECT* tp = dp[i]; std::string tname; tp->get_name(tname); wxString t1(wxString(tname.c_str(),wxConvUTF8)); if(t1.IsSameAs(wxString(projectname.c_str(),wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) { diskusage =tp->disk_usage; break; } } //set dialog title wxString wxTitle = _("Properties of project "); wxTitle.append(wxString(projectname.c_str(),wxConvUTF8)); SetTitle(wxTitle); //layout controls addSection(_("General")); addProperty(_("Master URL"),wxString(project->master_url, wxConvUTF8)); addProperty(_("User name"),wxString(project->user_name.c_str(),wxConvUTF8)); addProperty(_("Team name"),wxString(project->team_name.c_str(),wxConvUTF8)); addProperty(_("Resource share"),wxString::Format(wxT("%0.0f"),project->resource_share)); if (project->min_rpc_time > dtime()) { addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime())); } if (project->download_backoff) { addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff)); } if (project->upload_backoff) { addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff)); } addProperty(_("Disk usage"),FormatDiskSpace(diskusage)); addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid)); if (project->non_cpu_intensive) { addProperty(_("Non CPU intensive"), _("yes")); } addProperty(_("Suspended via GUI"),project->suspended_via_gui ? _("yes") : _("no")); addProperty(_("Don't request more work"),project->dont_request_more_work ? _("yes") : _("no")); if (project->scheduler_rpc_in_progress) { addProperty(_("Scheduler call in progress"), _("yes")); } if (project->trickle_up_pending) { addProperty(_("Trickle-up pending"), _("yes")); } if (strlen(project->venue)) { addProperty(_("Host location"), wxString(project->venue, wxConvUTF8)); } else { addProperty(_("Host location"), _("default")); } if (project->attached_via_acct_mgr) { addProperty(_("Added via account manager"), _("yes")); } if (project->detach_when_done) { addProperty(_("Remove when tasks done"), _("yes")); } if (project->ended) { addProperty(_("Ended"), _("yes")); } addSection(_("Credit")); addProperty(_("User"), wxString::Format( wxT("%0.2f total, %0.2f average"), project->user_total_credit, project->user_expavg_credit ) ); addProperty(_("Host"), wxString::Format( wxT("%0.2f total, %0.2f average"), project->host_total_credit, project->host_expavg_credit ) ); if (!project->non_cpu_intensive) { addSection(_("Scheduling")); addProperty(_("Scheduling priority"),wxString::Format(wxT("%0.2f"), project->sched_priority)); show_rsc(_("CPU"), project->rsc_desc_cpu); if (pDoc->state.have_nvidia) { show_rsc(_("NVIDIA GPU"), project->rsc_desc_nvidia); } if (pDoc->state.have_ati) { show_rsc(_("ATI GPU"), project->rsc_desc_ati); } addProperty(_("Duration correction factor"),wxString::Format(wxT("%0.4f"), project->duration_correction_factor)); } m_gbSizer->Layout(); m_scrolledWindow->FitInside(); }