2011-02-04 18:52:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "DlgItemProperties.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "DlgItemProperties.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "BOINCBaseFrame.h"
|
|
|
|
#include "Events.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CDlgItemProperties, wxDialog)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CDlgItemProperties, wxDialog)
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/* Constructor */
|
|
|
|
CDlgItemProperties::CDlgItemProperties(wxWindow* parent) :
|
|
|
|
wxDialog( parent, ID_ANYDIALOG, wxEmptyString, wxDefaultPosition,
|
|
|
|
wxSize( 503,480 ), wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ) {
|
|
|
|
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
if (!pFrame) return;
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
|
|
SetExtraStyle( GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
|
|
|
|
|
|
|
|
m_bSizer1 = new wxBoxSizer( wxVERTICAL );
|
|
|
|
|
|
|
|
m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
|
|
m_scrolledWindow->SetScrollRate( 5, 5 );
|
|
|
|
wxBoxSizer* m_bSizer2;
|
|
|
|
m_bSizer2 = new wxBoxSizer( wxVERTICAL );
|
|
|
|
|
|
|
|
m_gbSizer = new wxGridBagSizer( 0, 0 );
|
|
|
|
m_gbSizer->AddGrowableCol( 1 );
|
|
|
|
m_gbSizer->SetFlexibleDirection( wxBOTH );
|
|
|
|
m_gbSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
|
|
|
|
|
|
m_bSizer2->Add( m_gbSizer, 1, wxEXPAND, 5 );
|
|
|
|
|
|
|
|
m_scrolledWindow->SetSizer( m_bSizer2 );
|
|
|
|
m_scrolledWindow->Layout();
|
|
|
|
m_bSizer2->Fit( m_scrolledWindow );
|
|
|
|
m_bSizer1->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 );
|
|
|
|
|
|
|
|
m_btnClose = new wxButton( this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_btnClose->SetDefault();
|
|
|
|
m_bSizer1->Add( m_btnClose, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
|
|
|
|
|
|
|
|
SetSizer( m_bSizer1 );
|
|
|
|
Layout();
|
|
|
|
|
|
|
|
Centre( wxBOTH );
|
|
|
|
|
|
|
|
m_current_row=0;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
int currentTabView = pFrame->GetCurrentViewPage();
|
|
|
|
switch(currentTabView) {
|
2011-02-11 17:35:37 +00:00
|
|
|
case VW_PROJ:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgProjectProperties/"));
|
|
|
|
break;
|
2011-02-11 17:35:37 +00:00
|
|
|
case VW_TASK:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgTaskProperties/"));
|
|
|
|
break;
|
2011-02-11 17:35:37 +00:00
|
|
|
default:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgProperties/"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
RestoreState();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// destructor
|
|
|
|
CDlgItemProperties::~CDlgItemProperties() {
|
2011-02-11 17:35:37 +00:00
|
|
|
SaveState();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* saves dialog size and (on Mac) position */
|
|
|
|
bool CDlgItemProperties::SaveState() {
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
|
|
|
|
wxASSERT(pConfig);
|
2011-02-11 17:35:37 +00:00
|
|
|
if (!pConfig) return false;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->SetPath(m_strBaseConfigLocation);
|
|
|
|
pConfig->Write(wxT("Width"), GetSize().GetWidth());
|
|
|
|
pConfig->Write(wxT("Height"), GetSize().GetHeight());
|
2011-02-04 18:52:14 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
pConfig->Write(wxT("XPos"), GetPosition().x);
|
|
|
|
pConfig->Write(wxT("YPos"), GetPosition().y);
|
|
|
|
#endif
|
2011-02-11 17:35:37 +00:00
|
|
|
return true;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* restores former dialog size and (on Mac) position */
|
|
|
|
bool CDlgItemProperties::RestoreState() {
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2011-02-11 17:35:37 +00:00
|
|
|
int iWidth, iHeight;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
wxASSERT(pConfig);
|
2011-02-04 18:52:14 +00:00
|
|
|
if (!pConfig) return false;
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->SetPath(m_strBaseConfigLocation);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
|
|
|
|
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
// Set size to saved values or defaults if no saved values
|
2011-02-11 17:35:37 +00:00
|
|
|
SetSize(iWidth, iHeight);
|
2011-02-04 18:52:14 +00:00
|
|
|
#else
|
2011-02-11 17:35:37 +00:00
|
|
|
int iTop, iLeft;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord);
|
|
|
|
pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord);
|
|
|
|
|
|
|
|
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
|
|
|
|
// it displays on the screen.
|
|
|
|
if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30;
|
|
|
|
if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30;
|
|
|
|
|
|
|
|
// Set size and position to saved values or defaults if no saved values
|
|
|
|
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
|
|
|
|
|
|
|
|
// Now make sure window is on screen
|
|
|
|
GetScreenPosition(&iLeft, &iTop);
|
|
|
|
GetSize(&iWidth, &iHeight);
|
|
|
|
|
|
|
|
Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth };
|
|
|
|
InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible
|
|
|
|
RgnHandle displayRgn = NewRgn();
|
|
|
|
CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays
|
|
|
|
Rect menuRect = ((**GetMainDevice())).gdRect;
|
|
|
|
menuRect.bottom = GetMBarHeight() + menuRect.top;
|
|
|
|
RgnHandle menuRgn = NewRgn();
|
|
|
|
RectRgn(menuRgn, &menuRect); // Region hidden by menu bar
|
|
|
|
DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar region
|
|
|
|
if (!RectInRgn(&titleRect, displayRgn)) {
|
|
|
|
iTop = iLeft = 30;
|
|
|
|
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
|
|
|
|
}
|
|
|
|
DisposeRgn(menuRgn);
|
|
|
|
DisposeRgn(displayRgn);
|
|
|
|
#endif
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
return true;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
// show project properties
|
|
|
|
//
|
|
|
|
void CDlgItemProperties::renderInfos(PROJECT* project_in) {
|
2011-02-11 17:35:37 +00:00
|
|
|
std::string projectname;
|
|
|
|
//collecting infos
|
|
|
|
project_in->get_name(projectname);
|
|
|
|
//disk usage needs additional lookups
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
pDoc->CachedDiskUsageUpdate();
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
// 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));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (project->min_rpc_time > dtime()) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime()));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
if (project->download_backoff) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
if (project->upload_backoff) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Disk usage"),FormatDiskSpace(diskusage));
|
2011-02-04 18:52:14 +00:00
|
|
|
addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid));
|
2011-04-14 01:04:10 +00:00
|
|
|
if (project->non_cpu_intensive) {
|
|
|
|
addProperty(_("Non CPU intensive"), _("yes"));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Suspended via GUI"),project->suspended_via_gui ? _("yes") : _("no"));
|
|
|
|
addProperty(_("Don't request more work"),project->dont_request_more_work ? _("yes") : _("no"));
|
2011-04-14 01:04:10 +00:00
|
|
|
if (project->scheduler_rpc_in_progress) {
|
|
|
|
addProperty(_("Scheduler call in progress"), _("yes"));
|
|
|
|
}
|
|
|
|
if (project->trickle_up_pending) {
|
|
|
|
addProperty(_("Trickle-up pending"), _("yes"));
|
|
|
|
}
|
2011-02-04 18:52:14 +00:00
|
|
|
if (strlen(project->venue)) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Host location"), wxString(project->venue, wxConvUTF8));
|
|
|
|
} else {
|
|
|
|
addProperty(_("Host location"), _("default"));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
2011-04-14 01:04:10 +00:00
|
|
|
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"));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addSection(_("Credit"));
|
|
|
|
addProperty(_("User"),
|
2011-02-04 18:52:14 +00:00
|
|
|
wxString::Format(
|
|
|
|
wxT("%0.2f total, %0.2f average"),
|
|
|
|
project->user_total_credit,
|
|
|
|
project->user_expavg_credit
|
|
|
|
)
|
|
|
|
);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Host"),
|
2011-02-04 18:52:14 +00:00
|
|
|
wxString::Format(
|
|
|
|
wxT("%0.2f total, %0.2f average"),
|
|
|
|
project->host_total_credit,
|
|
|
|
project->host_expavg_credit
|
|
|
|
)
|
|
|
|
);
|
2011-02-11 17:35:37 +00:00
|
|
|
|
2011-02-04 18:52:14 +00:00
|
|
|
if (!project->non_cpu_intensive) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addSection(_("Scheduling"));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (project->no_cpu_pref) {
|
|
|
|
addProperty(_("Project preference"), _("Don't fetch CPU tasks"));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("CPU scheduling priority"),wxString::Format(wxT("%0.2f"), project->cpu_short_term_debt));
|
|
|
|
addProperty(_("CPU work fetch priority"),wxString::Format(wxT("%0.2f"), project->cpu_long_term_debt));
|
2011-02-04 18:52:14 +00:00
|
|
|
double x = project->cpu_backoff_time - dtime();
|
|
|
|
if (x<0) x = 0;
|
|
|
|
addProperty(_("CPU work fetch deferred for"), FormatTime(x));
|
|
|
|
addProperty(_("CPU work fetch deferral interval"), FormatTime(project->cpu_backoff_interval));
|
|
|
|
if (pDoc->state.have_cuda) {
|
|
|
|
if (project->no_cuda_pref) {
|
|
|
|
addProperty(_("Project preference"), _("Don't fetch NVIDIA GPU tasks"));
|
|
|
|
}
|
|
|
|
addProperty(_("NVIDIA GPU scheduling priority"),wxString::Format(wxT("%0.2f"), project->cuda_short_term_debt));
|
|
|
|
addProperty(_("NVIDIA GPU work fetch priority"),wxString::Format(wxT("%0.2f"), project->cuda_debt));
|
|
|
|
x = project->cuda_backoff_time - dtime();
|
|
|
|
if (x<0) x = 0;
|
|
|
|
addProperty(_("NVIDIA GPU work fetch deferred for"), FormatTime(x));
|
|
|
|
addProperty(_("NVIDIA GPU work fetch deferral interval"), FormatTime(project->cuda_backoff_interval));
|
|
|
|
}
|
|
|
|
if (pDoc->state.have_ati) {
|
|
|
|
if (project->no_ati_pref) {
|
|
|
|
addProperty(_("Project preference"), _("Don't fetch ATI GPU tasks"));
|
|
|
|
}
|
|
|
|
addProperty(_("ATI GPU scheduling priority"),wxString::Format(wxT("%0.2f"), project->ati_short_term_debt));
|
|
|
|
addProperty(_("ATI GPU work fetch priority"),wxString::Format(wxT("%0.2f"), project->ati_debt));
|
|
|
|
x = project->ati_backoff_time - dtime();
|
|
|
|
if (x<0) x = 0;
|
|
|
|
addProperty(_("ATI GPU work fetch deferred for"), FormatTime(x));
|
|
|
|
addProperty(_("ATI GPU work fetch deferral interval"), FormatTime(project->ati_backoff_interval));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Duration correction factor"),wxString::Format(wxT("%0.4f"), project->duration_correction_factor));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
m_gbSizer->Layout();
|
2011-02-11 17:35:37 +00:00
|
|
|
m_scrolledWindow->FitInside();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// show task properties
|
|
|
|
//
|
|
|
|
void CDlgItemProperties::renderInfos(RESULT* result) {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxDateTime dt;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString wxTitle = _("Properties of task ");
|
|
|
|
wxTitle.append(wxString(result->name, wxConvUTF8));
|
|
|
|
SetTitle(wxTitle);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
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));
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Workunit name"),wxString(result->wu_name, wxConvUTF8));
|
|
|
|
addProperty(_("State"), result_description(result, false));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (result->received_time) {
|
|
|
|
dt.Set((time_t)result->received_time);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Received"), dt.Format());
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
dt.Set((time_t)result->report_deadline);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Report deadline"), dt.Format());
|
|
|
|
if (strlen(result->resources)) {
|
|
|
|
addProperty(_("Resources"), wxString(result->resources, wxConvUTF8));
|
|
|
|
}
|
2011-02-04 18:52:14 +00:00
|
|
|
if (avp) {
|
|
|
|
addProperty(_("Estimated app speed"), wxString::Format(wxT("%.2f GFLOPs/sec"), avp->flops/1e9));
|
|
|
|
}
|
|
|
|
if (wup) {
|
|
|
|
addProperty(_("Estimated task size"), wxString::Format(wxT("%.0f GFLOPs"), wup->rsc_fpops_est/1e9));
|
|
|
|
addProperty(_("Max RAM usage"), wxString::Format(wxT("%.0f MB"), wup->rsc_memory_bound/MEGA));
|
|
|
|
}
|
|
|
|
if (result->active_task) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time));
|
|
|
|
addProperty(_("CPU time"), FormatTime(result->current_cpu_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (result->elapsed_time >= 0) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Elapsed time"), FormatTime(result->elapsed_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
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));
|
2011-02-04 18:52:14 +00:00
|
|
|
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));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
} else if (result->state >= RESULT_COMPUTE_ERROR) {
|
|
|
|
addProperty(_("CPU time"), FormatTime(result->final_cpu_time));
|
|
|
|
addProperty(_("Elapsed time"), FormatTime(result->final_elapsed_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
m_gbSizer->Layout();
|
|
|
|
m_scrolledWindow->FitInside();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString CDlgItemProperties::FormatDiskSpace(double bytes) {
|
2011-02-04 18:52:14 +00:00
|
|
|
double xTera = 1099511627776.0;
|
|
|
|
double xGiga = 1073741824.0;
|
|
|
|
double xMega = 1048576.0;
|
|
|
|
double xKilo = 1024.0;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer= wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
if (bytes >= xTera) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f TB"), bytes/xTera);
|
|
|
|
} else if (bytes >= xGiga) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f GB"), bytes/xGiga);
|
|
|
|
} else if (bytes >= xMega) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f MB"), bytes/xMega);
|
|
|
|
} else if (bytes >= xKilo) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f KB"), bytes/xKilo);
|
|
|
|
} else {
|
|
|
|
strBuffer.Printf(wxT("%0.0f bytes"), bytes);
|
|
|
|
}
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
wxString CDlgItemProperties::FormatApplicationName(RESULT* result ) {
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
RESULT* state_result = NULL;
|
|
|
|
wxString strAppBuffer = wxEmptyString;
|
|
|
|
wxString strClassBuffer = wxEmptyString;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
|
|
|
if (!state_result) {
|
|
|
|
pDoc->ForceCacheUpdate();
|
|
|
|
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
|
|
|
}
|
|
|
|
wxASSERT(state_result);
|
|
|
|
|
|
|
|
if (!state_result) return strBuffer;
|
|
|
|
WORKUNIT* wup = state_result->wup;
|
|
|
|
if (!wup) return strBuffer;
|
|
|
|
APP* app = wup->app;
|
|
|
|
if (!app) return strBuffer;
|
|
|
|
APP_VERSION* avp = state_result->avp;
|
|
|
|
if (!avp) return strBuffer;
|
|
|
|
|
|
|
|
if (strlen(app->user_friendly_name)) {
|
|
|
|
strAppBuffer = wxString(state_result->app->user_friendly_name, wxConvUTF8);
|
|
|
|
} else {
|
|
|
|
strAppBuffer = wxString(state_result->avp->app_name, wxConvUTF8);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(avp->plan_class)) {
|
|
|
|
strClassBuffer.Printf(
|
|
|
|
wxT(" (%s)"),
|
|
|
|
wxString(avp->plan_class, wxConvUTF8).c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
strBuffer.Printf(
|
|
|
|
wxT("%s%s %d.%02d %s"),
|
|
|
|
state_result->project->anonymous_platform?_("Local: "):wxT(""),
|
|
|
|
strAppBuffer.c_str(),
|
|
|
|
state_result->avp->version_num / 100,
|
|
|
|
state_result->avp->version_num % 100,
|
|
|
|
strClassBuffer.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
wxString CDlgItemProperties::FormatTime(float fBuffer) {
|
|
|
|
wxInt32 iHour = 0;
|
|
|
|
wxInt32 iMin = 0;
|
|
|
|
wxInt32 iSec = 0;
|
|
|
|
wxTimeSpan ts;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer= wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
if (0 >= fBuffer) {
|
|
|
|
strBuffer = wxT("---");
|
|
|
|
} else {
|
|
|
|
iHour = (wxInt32)(fBuffer / (60 * 60));
|
|
|
|
iMin = (wxInt32)(fBuffer / 60) % 60;
|
|
|
|
iSec = (wxInt32)(fBuffer) % 60;
|
|
|
|
|
|
|
|
ts = wxTimeSpan(iHour, iMin, iSec);
|
|
|
|
|
|
|
|
strBuffer = ts.Format();
|
|
|
|
}
|
|
|
|
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
// adds a title section label to the dialog
|
|
|
|
void CDlgItemProperties::addSection(const wxString& title) {
|
2011-02-11 17:35:37 +00:00
|
|
|
wxStaticText* staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, 0);
|
|
|
|
staticText->Wrap( -1 );
|
|
|
|
staticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
|
|
|
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 0 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 3);
|
|
|
|
m_current_row++;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// adds a property row to the dialog
|
|
|
|
void CDlgItemProperties::addProperty(const wxString& name, const wxString& value) {
|
2011-02-11 17:35:37 +00:00
|
|
|
|
|
|
|
wxStaticText* staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
staticText->Wrap( -1 );
|
|
|
|
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 0 ), wxGBSpan( 1, 1 ), wxALL, 3 );
|
|
|
|
|
|
|
|
staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
staticText->Wrap( -1 );
|
|
|
|
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 3 );
|
|
|
|
m_current_row++;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|