From 5d7760d7b2cadd39431288e13eef963c4df18950 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 4 Apr 2005 21:14:49 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=5773 --- checkin_notes | 15 +++++++++++++++ client/client_state.C | 3 +-- client/client_types.C | 2 +- client/ss_logic.C | 11 +++++++---- client/ss_logic.h | 14 +++++++++++--- client/time_stats.C | 3 ++- client/time_stats.h | 2 +- client/win/win_screensaver.cpp | 2 +- lib/boinc_cmd.C | 16 ++++++++-------- 9 files changed, 47 insertions(+), 21 deletions(-) diff --git a/checkin_notes b/checkin_notes index 49f144ea85..0d97debcc9 100755 --- a/checkin_notes +++ b/checkin_notes @@ -26639,3 +26639,18 @@ David 4 April 2005 cliengui/ MainFrame.cpp Makefile.am + +David 4 April 2005 + - Call get_connected_state() every 10 seconds, not 10X per second + (it does a registry lookup on Win) + - fix names of SS constants + + client/ + client_state.C + client_types.C + ss_logic.C,h + time_stats.C,h + win/ + win_screensaver.cpp + lib/ + boinc_cmd.C diff --git a/client/client_state.C b/client/client_state.C index 28579f7a47..390f4ae70c 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -499,8 +499,7 @@ bool CLIENT_STATE::do_something(double now) { if (actions > 0) { return true; } else { - int connected_state = get_connected_state(); - time_stats.update(now, connected_state, !activities_suspended); + time_stats.update(now, !activities_suspended); return false; } } diff --git a/client/client_types.C b/client/client_types.C index ff24952af0..c7218606ab 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -326,7 +326,7 @@ void PROJECT::copy_state_fields(PROJECT& p) { // Write project statistic to project statistics file // -int PROJECT::write_statistics(MIOFILE& out, bool gui_rpc) { +int PROJECT::write_statistics(MIOFILE& out, bool /*gui_rpc*/) { out.printf( "\n" " %s\n", diff --git a/client/ss_logic.C b/client/ss_logic.C index 4ca3f76271..bca7992e00 100644 --- a/client/ss_logic.C +++ b/client/ss_logic.C @@ -32,8 +32,8 @@ SS_LOGIC::SS_LOGIC() { ss_status = 0; } -// this is called when the core client receives a set_screensaver_mode RPC -// from the screensaver module. +// called in response to a set_screensaver_mode RPC with . +// Start providing screensaver graphics // void SS_LOGIC::start_ss(GRAPHICS_MSG& m, double new_blank_time) { ACTIVE_TASK* atp; @@ -57,6 +57,9 @@ void SS_LOGIC::start_ss(GRAPHICS_MSG& m, double new_blank_time) { } } +// called in response to a set_screensaver_mode RPC without +// Stop providing screensaver graphics +// void SS_LOGIC::stop_ss() { if (!do_ss) return; reset(); @@ -66,6 +69,7 @@ void SS_LOGIC::stop_ss() { } // If an app is acting as screensaver, tell it to stop. +// Called from CLIENT_STATE::schedule_cpus() // void SS_LOGIC::reset() { GRAPHICS_MSG m; @@ -116,7 +120,6 @@ void SS_LOGIC::poll() { m.mode = MODE_HIDE_GRAPHICS; atp->request_graphics_mode(m); atp->is_ss_app = false; - ss_status = SS_STATUS_NOTGRAPHICSCAPABLE; } } } else { @@ -129,7 +132,7 @@ void SS_LOGIC::poll() { if (gstate.projects.size()>0) { ss_status = SS_STATUS_NOAPPSEXECUTING; } else { - ss_status = SS_STATUS_NOAPPSEXECUTINGNOPROJECTSDETECTED; + ss_status = SS_STATUS_NOPROJECTSDETECTED; } } else { ss_status = SS_STATUS_NOGRAPHICSAPPSEXECUTING; diff --git a/client/ss_logic.h b/client/ss_logic.h index 104e691e12..198306d6d2 100644 --- a/client/ss_logic.h +++ b/client/ss_logic.h @@ -24,15 +24,24 @@ #include #endif +// the core client can be requested to provide screensaver graphics (SSG). +// The following are states of this function: + #define SS_STATUS_ENABLED 1 + // requested to provide SSG #define SS_STATUS_RESTARTREQUEST 2 + // ??? #define SS_STATUS_BLANKED 3 + // not providing SSG, SS should blank screen #define SS_STATUS_BOINCSUSPENDED 4 -#define SS_STATUS_NOTGRAPHICSCAPABLE 5 + // not providing SS because suspended #define SS_STATUS_NOAPPSEXECUTING 6 + // no apps executing #define SS_STATUS_NOGRAPHICSAPPSEXECUTING 7 + // apps executing, but none graphical #define SS_STATUS_QUIT 8 -#define SS_STATUS_NOAPPSEXECUTINGNOPROJECTSDETECTED 9 + // not requested to provide SSG +#define SS_STATUS_NOPROJECTSDETECTED 9 class SS_LOGIC { public: @@ -54,7 +63,6 @@ private: // invariants // -// do_boinc_logo_ss and do_blank are not both true // at most one app has request_mode = FULLSCREEN // pre-ss mode of all apps is not FULLSCREEN }; diff --git a/client/time_stats.C b/client/time_stats.C index c1f09871fd..96aa0995c1 100644 --- a/client/time_stats.C +++ b/client/time_stats.C @@ -55,7 +55,7 @@ TIME_STATS::TIME_STATS() { // so these get written to disk only when other activities // cause this to happen. Maybe should change this. // -void TIME_STATS::update(double now, int connected_state, bool is_active) { +void TIME_STATS::update(double now, bool is_active) { double dt, w1, w2; if (last_update == 0) { @@ -73,6 +73,7 @@ void TIME_STATS::update(double now, int connected_state, bool is_active) { w1 = 1 - exp(-dt/ALPHA); // weight for recent period w2 = 1 - w1; // weight for everything before that // (close to zero if long gap) + int connected_state = get_connected_state(); if (first) { // the client has just started; this is the first call. // diff --git a/client/time_stats.h b/client/time_stats.h index 422f7787f6..e8e9b5eba1 100644 --- a/client/time_stats.h +++ b/client/time_stats.h @@ -35,7 +35,7 @@ public: // the fraction it is enabled to work // (as determined by preferences, manual suspend/resume, etc.) - void update(double now, int connected_state, bool is_active); + void update(double now, bool is_active); TIME_STATS(); int write(MIOFILE&, bool to_server); diff --git a/client/win/win_screensaver.cpp b/client/win/win_screensaver.cpp index 5a5104a814..717be82c37 100755 --- a/client/win/win_screensaver.cpp +++ b/client/win/win_screensaver.cpp @@ -911,7 +911,7 @@ LRESULT CScreensaver::SaverProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa m_bErrorMode = TRUE; m_hrError = SCRAPPERR_BOINCNOAPPSEXECUTING; break; - case SS_STATUS_NOAPPSEXECUTINGNOPROJECTSDETECTED: + case SS_STATUS_NOPROJECTSDETECTED: m_bErrorMode = TRUE; m_hrError = SCRAPPERR_BOINCNOAPPSEXECUTINGNOPROJECTSDETECTED; break; diff --git a/lib/boinc_cmd.C b/lib/boinc_cmd.C index 0da7c0f244..86cd80dded 100644 --- a/lib/boinc_cmd.C +++ b/lib/boinc_cmd.C @@ -70,7 +70,7 @@ void usage() { exit(1); } -void parse_display_args(int argc, char** argv, int& i, DISPLAY_INFO& di) { +void parse_display_args(char** argv, int& i, DISPLAY_INFO& di) { strcpy(di.window_station, "winsta0"); strcpy(di.desktop, "default"); strcpy(di.display, ""); @@ -179,11 +179,11 @@ int main(int argc, char** argv) { retval = rpc.result_op(result, "abort"); } else if (!strcmp(op, "graphics_window")) { DISPLAY_INFO di; - parse_display_args(argc, argv, i, di); + parse_display_args(argv, i, di); retval = rpc.show_graphics(project_url, name, false, di); } else if (!strcmp(op, "graphics_fullscreen")) { DISPLAY_INFO di; - parse_display_args(argc, argv, i, di); + parse_display_args(argv, i, di); retval = rpc.show_graphics(project_url, name, true, di); } else { fprintf(stderr, "Unknown op %s\n", op); @@ -290,10 +290,10 @@ int main(int argc, char** argv) { retval = rpc.get_host_info(hi); if (!retval) hi.print(); } else if (!strcmp(cmd, "--acct_mgr_rpc")) { - char* url = next_arg(argc, argv, i); - char* name = next_arg(argc, argv, i); - char* passwd = next_arg(argc, argv, i); - retval = rpc.acct_mgr_rpc(url, name, passwd); + char* am_url = next_arg(argc, argv, i); + char* am_name = next_arg(argc, argv, i); + char* am_passwd = next_arg(argc, argv, i); + retval = rpc.acct_mgr_rpc(am_url, am_name, am_passwd); } else if (!strcmp(cmd, "--run_benchmarks")) { retval = rpc.run_benchmarks(); } else if (!strcmp(cmd, "--get_screensaver_mode")) { @@ -308,7 +308,7 @@ int main(int argc, char** argv) { char* op = next_arg(argc, argv, i); if (!strcmp(op, "on")) enabled = true; blank_time = atof(next_arg(argc, argv, i)); - parse_display_args(argc, argv, i, di); + parse_display_args(argv, i, di); retval = rpc.set_screensaver_mode(enabled, blank_time, di); } else if (!strcmp(cmd, "--quit")) { retval = rpc.quit();