diff --git a/checkin_notes b/checkin_notes index 6819daa280..20f90e89c9 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2847,3 +2847,12 @@ Rom 27 Mar 2007 boinc_dll_2003.vcproj boincmgr_curl.vcproj boincmgr_curl_2003.vcproj + +David 27 Mar 2007 + - client: on startup, show how much RAM and disk are usable + (taking prefs into account) + + client/ + cs_prefs.C + lib/ + str_util.h diff --git a/client/client_state.h b/client/client_state.h index 18f160c608..d20cb0e1be 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -356,7 +356,7 @@ public: int project_disk_usage(PROJECT*, double&); int total_disk_usage(double&); // returns the total disk usage of BOINC on this host - int allowed_disk_usage(double&); + double allowed_disk_usage(); int allowed_project_disk_usage(double&); int suspend_tasks(int reason); int resume_tasks(int reason=0); diff --git a/client/cs_prefs.C b/client/cs_prefs.C index ac00dd7472..0743a30843 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -49,23 +49,21 @@ using std::string; #define MAX_PROJ_PREFS_LEN 65536 // max length of project-specific prefs -#if 0 // Return the maximum allowed disk usage as determined by user preferences. // There are three different settings in the prefs; // return the least of the three. // -int CLIENT_STATE::allowed_disk_usage(double& size) { +double CLIENT_STATE::allowed_disk_usage() { double percent_space, min_val; percent_space = host_info.d_total*global_prefs.disk_max_used_pct/100.0; min_val = host_info.d_free - global_prefs.disk_min_free_gb*1e9; - size = min(min(global_prefs.disk_max_used_gb*(1e9), percent_space), min_val); + double size = min(min(global_prefs.disk_max_used_gb*(1e9), percent_space), min_val); if (size < 0) size = 0; - return 0; + return size; } -#endif int CLIENT_STATE::project_disk_usage(PROJECT* p, double& size) { char buf[256]; @@ -400,6 +398,10 @@ void CLIENT_STATE::read_global_prefs() { fclose(f); } + msg_printf(NULL, MSG_INFO, + "Preferences limit memory usage to %.2fMB, disk usage to %.2fGB", + max_available_ram()/MEGA, allowed_disk_usage()/GIGA + ); // max_cpus, bandwidth limits may have changed // set_ncpus(); diff --git a/lib/str_util.h b/lib/str_util.h index d839278c57..f528954839 100755 --- a/lib/str_util.h +++ b/lib/str_util.h @@ -28,6 +28,7 @@ #include #define MEGA (1048576.0) +#define GIGA (1024.*1048576.0) #if !defined(HAVE_STRLCPY) extern size_t strlcpy(char*, const char*, size_t);