- boinccmd: add --set_gpu_mode command

- fix some compile warnings


svn path=/trunk/boinc/; revision=21002
This commit is contained in:
David Anderson 2010-03-25 23:48:58 +00:00
parent 37d450bff8
commit e5ac873205
8 changed files with 44 additions and 10 deletions

View File

@ -2091,3 +2091,14 @@ Rom 25 Mar 2010
clientgui/
BOINCTaskBar.cpp
David 25 Mar 2010
- boinccmd: add --set_gpu_mode command
- fix some compile warnings
client/
cs_notice.cpp,h
work_fetch.cpp
boinc_cmd.cpp
gui_http.cpp,h
main.cpp

View File

@ -81,6 +81,8 @@ Commands:\n\
op = retry | abort\n\
--set_run_mode mode duration set run mode for given duration\n\
mode = always | auto | never\n\
--set_gpu_mode mode duration set GPU run mode for given duration\n\
mode = always | auto | never\n\
--set_network_mode mode duration\n\
--set_proxy_settings\n\
--run_benchmarks\n\
@ -328,6 +330,23 @@ int main(int argc, char** argv) {
} else {
fprintf(stderr, "Unknown op %s\n", op);
}
} else if (!strcmp(cmd, "--set_gpu_mode")) {
char* op = next_arg(argc, argv, i);
double duration;
if (i >= argc || (argv[i][0] == '-')) {
duration = 0;
} else {
duration = atof(next_arg(argc, argv, i));
}
if (!strcmp(op, "always")) {
retval = rpc.set_gpu_mode(RUN_MODE_ALWAYS, duration);
} else if (!strcmp(op, "auto")) {
retval = rpc.set_gpu_mode(RUN_MODE_AUTO, duration);
} else if (!strcmp(op, "never")) {
retval = rpc.set_gpu_mode(RUN_MODE_NEVER, duration);
} else {
fprintf(stderr, "Unknown op %s\n", op);
}
} else if (!strcmp(cmd, "--set_network_mode")) {
char* op = next_arg(argc, argv, i);
double duration;

View File

@ -324,7 +324,7 @@ bool NOTICES::append(NOTICE& n, bool keep_old) {
// If rfp is NULL it's a system msg, else a feed msg.
// insert items in NOTICES
//
int NOTICES::read_archive_file(char* path, RSS_FEED* rfp) {
int NOTICES::read_archive_file(const char* path, RSS_FEED* rfp) {
char tag[256];
bool is_tag;

View File

@ -72,7 +72,7 @@ struct NOTICES {
bool append(NOTICE&, bool keep_old);
void init();
void init_rss();
int read_archive_file(char* file, struct RSS_FEED*);
int read_archive_file(const char* file, struct RSS_FEED*);
void write_archive(struct RSS_FEED*);
bool remove_dups(NOTICE&, bool keep_old);
};

View File

@ -28,7 +28,7 @@
#include "gui_http.h"
int GUI_HTTP::do_rpc(GUI_HTTP_OP* op, char* url, char* output_file) {
int GUI_HTTP::do_rpc(GUI_HTTP_OP* op, char* url, const char* output_file) {
int retval;
// this check should be done at a higher level.
@ -47,7 +47,10 @@ int GUI_HTTP::do_rpc(GUI_HTTP_OP* op, char* url, char* output_file) {
return 0;
}
int GUI_HTTP::do_rpc_post(GUI_HTTP_OP* op, char* url, char* input_file, char* output_file) {
int GUI_HTTP::do_rpc_post(
GUI_HTTP_OP* op, char* url,
const char* input_file, const char* output_file
) {
int retval;
if (gui_http_state != GUI_HTTP_STATE_IDLE) {

View File

@ -35,9 +35,10 @@ struct GUI_HTTP {
HTTP_OP http_op;
GUI_HTTP(): gui_http_state(GUI_HTTP_STATE_IDLE) {}
int do_rpc(struct GUI_HTTP_OP*, char* url, char* output_file);
int do_rpc(struct GUI_HTTP_OP*, char* url, const char* output_file);
int do_rpc_post(
struct GUI_HTTP_OP*, char* url, char* input_file, char* output_file
struct GUI_HTTP_OP*, char* url,
const char* input_file, const char* output_file
);
bool poll();
inline bool is_busy() {

View File

@ -115,7 +115,7 @@ void show_message(PROJECT *p, char* msg, int priority) {
// Log informational messages to system specific places
//
void log_message_startup(char* msg) {
void log_message_startup(const char* msg) {
char evt_msg[2048];
snprintf(evt_msg, sizeof(evt_msg),
"%s\n",
@ -136,7 +136,7 @@ void log_message_startup(char* msg) {
// Log error messages to system specific places
//
void log_message_error(char* msg) {
void log_message_error(const char* msg) {
char evt_msg[2048];
#ifdef _WIN32
snprintf(evt_msg, sizeof(evt_msg),
@ -163,7 +163,7 @@ void log_message_error(char* msg) {
}
}
void log_message_error(char* msg, int error_code) {
void log_message_error(const char* msg, int error_code) {
char evt_msg[2048];
snprintf(evt_msg, sizeof(evt_msg),
"%s\n"

View File

@ -55,7 +55,7 @@ WORK_FETCH work_fetch;
// to use its instance share,
// get work from the one with greatest LTD.
static char* criterion_name(int criterion) {
static const char* criterion_name(int criterion) {
switch (criterion) {
case FETCH_IF_IDLE_INSTANCE: return "idle instance";
case FETCH_IF_MAJOR_SHORTFALL: return "major shortfall";