mirror of https://github.com/BOINC/boinc.git
get simple GUI info
svn path=/trunk/boinc/; revision=10527
This commit is contained in:
parent
e72059e2c1
commit
41a5e8c63d
|
@ -6925,3 +6925,17 @@ David 27 June 2006
|
|||
client_state.C
|
||||
client_types.C
|
||||
proxy.C,h (removed)
|
||||
|
||||
David 27 June 2006
|
||||
- Add new GUI RPC get_simple_gui_info(): returns list
|
||||
of projects and active results.
|
||||
|
||||
client/
|
||||
client_state.h
|
||||
cs_statefile.C
|
||||
gui_rpc_server_ops.C
|
||||
lib/
|
||||
boinc_cmd.C
|
||||
gui_rpc_client.h
|
||||
gui_rpc_client_ops.C
|
||||
gui_rpc_client_print.C
|
||||
|
|
|
@ -406,7 +406,7 @@ public:
|
|||
int parse_app_info(PROJECT*, FILE*);
|
||||
int write_state_gui(MIOFILE&);
|
||||
int write_file_transfers_gui(MIOFILE&);
|
||||
int write_tasks_gui(MIOFILE&);
|
||||
int write_tasks_gui(MIOFILE&, bool);
|
||||
|
||||
// --------------- cs_trickle.C:
|
||||
private:
|
||||
|
|
|
@ -621,16 +621,16 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CLIENT_STATE::write_tasks_gui(MIOFILE& f) {
|
||||
int CLIENT_STATE::write_tasks_gui(MIOFILE& f, bool active_only) {
|
||||
unsigned int i;
|
||||
|
||||
f.printf("<results>\n");
|
||||
for(i=0; i<results.size(); i++) {
|
||||
for (i=0; i<results.size(); i++) {
|
||||
RESULT* rp = results[i];
|
||||
if (active_only) {
|
||||
if (!gstate.active_tasks.lookup_result(rp)) continue;
|
||||
}
|
||||
rp->write_gui(f);
|
||||
}
|
||||
f.printf("</results>\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,17 @@ void GUI_RPC_CONN::handle_auth2(char* buf, MIOFILE& fout) {
|
|||
auth_needed = false;
|
||||
}
|
||||
|
||||
static void handle_get_simple_gui_info(MIOFILE& fout) {
|
||||
unsigned int i;
|
||||
fout.printf("<simple_gui_info>\n");
|
||||
for (i=0; i<gstate.projects.size(); i++) {
|
||||
PROJECT* p = gstate.projects[i];
|
||||
p->write_state(fout, true);
|
||||
}
|
||||
gstate.write_tasks_gui(fout, true);
|
||||
fout.printf("</simple_gui_info>\n");
|
||||
}
|
||||
|
||||
static void handle_get_project_status(MIOFILE& fout) {
|
||||
unsigned int i;
|
||||
fout.printf("<projects>\n");
|
||||
|
@ -804,7 +815,9 @@ int GUI_RPC_CONN::handle_rpc() {
|
|||
} else if (match_tag(request_msg, "<get_state")) {
|
||||
gstate.write_state_gui(mf);
|
||||
} else if (match_tag(request_msg, "<get_results")) {
|
||||
gstate.write_tasks_gui(mf);
|
||||
mf.printf("<results>\n");
|
||||
gstate.write_tasks_gui(mf, false);
|
||||
mf.printf("</results>\n");
|
||||
} else if (match_tag(request_msg, "<get_screensaver_mode")) {
|
||||
handle_get_screensaver_mode(request_msg, mf);
|
||||
} else if (match_tag(request_msg, "<set_screensaver_mode")) {
|
||||
|
@ -818,6 +831,8 @@ int GUI_RPC_CONN::handle_rpc() {
|
|||
gstate.write_file_transfers_gui(mf);
|
||||
} else if (match_tag(request_msg, "<get_project_status")) {
|
||||
handle_get_project_status(mf);
|
||||
} else if (match_tag(request_msg, "<get_simple_gui_info")) {
|
||||
handle_get_simple_gui_info(mf);
|
||||
} else if (match_tag(request_msg, "<get_disk_usage")) {
|
||||
handle_get_disk_usage(mf);
|
||||
} else if (match_tag(request_msg, "<project_nomorework")) {
|
||||
|
|
|
@ -24,6 +24,7 @@ list_item("--password", "The password for RPC authentication
|
|||
);
|
||||
list_item("--get_state", "show client state");
|
||||
list_item("--get_results", "show results");
|
||||
list_item("--get_simple_gui_info", "show projects and active results");
|
||||
list_item("--get_file_transfers", "show file transfers");
|
||||
list_item("--get_project_status", "show status of all projects");
|
||||
list_item("--get_disk_usage", "Show disk usage by project");
|
||||
|
|
|
@ -51,6 +51,10 @@ list_item_func(
|
|||
use CC_STATE::lookup_project() to find this project in the current state;
|
||||
if it's not there, call get_state() again."
|
||||
);
|
||||
list_item_func(
|
||||
"get_simple_gui_info(SIMPLE_GUI_INFO&)",
|
||||
"Return the list of projects and of active results."
|
||||
);
|
||||
list_item_func(
|
||||
"get_project_status(vector<PROJECT>&)",
|
||||
"Get a list of projects, with only basic fields filled in."
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
require_once("docutil.php");
|
||||
|
||||
page_head("Statistics data");
|
||||
page_head("Credit statistics web sites and services");
|
||||
echo "
|
||||
<b>Statistics data</b> is the number of
|
||||
<a href=credit.php>Cobblestones</a> (credit units)
|
||||
granted to hosts, participants and teams by the
|
||||
various BOINC projects.
|
||||
granted to hosts, participants and teams by the various BOINC projects.
|
||||
This can be used for various purposes, such as:
|
||||
<ul>
|
||||
<li>
|
||||
|
@ -20,11 +19,16 @@ Examples are listed at <a href=stats_sites.php>here</a>.
|
|||
that show user and/or team credit, possible across projects.
|
||||
Examples are listed at <a href=stats_sites.php>here</a>.
|
||||
|
||||
<li> Displays of current credit on cell phones and PDAs. </ul>
|
||||
<li> Displays of current credit on cell phones and PDAs.
|
||||
</ul>
|
||||
|
||||
Displays that use colors to distinguish BOINC projects should use
|
||||
<a href=http://boinc.netsoft-online.com/project_colors.html>these colors</a>.
|
||||
|
||||
|
||||
<p>
|
||||
BOINC provides a flexible architecture for distributing
|
||||
statistics data, with the goal of enabling new display applications.
|
||||
BOINC provides a flexible architecture for distributing statistics data,
|
||||
with the goal of enabling new display applications.
|
||||
<hr>
|
||||
<center>
|
||||
<img src=stats.png>
|
||||
|
|
|
@ -64,6 +64,7 @@ Commands:\n\
|
|||
--get_results show results\n\
|
||||
--get_file_transfers show file transfers\n\
|
||||
--get_project_status show status of all projects\n\
|
||||
--get_simple_gui_info show status of projects and active results\n\
|
||||
--get_disk_usage\n\
|
||||
--result url result_name {suspend | resume | abort | graphics_window | graphics_fullscreen}\n\
|
||||
--project url {reset | detach | update | suspend | resume | nomorework | allowmorework}\n\
|
||||
|
@ -228,6 +229,10 @@ int main(int argc, char** argv) {
|
|||
PROJECTS ps;
|
||||
retval = rpc.get_project_status(ps);
|
||||
if (!retval) ps.print();
|
||||
} else if (!strcmp(cmd, "--get_simple_gui_info")) {
|
||||
SIMPLE_GUI_INFO sgi;
|
||||
retval = rpc.get_simple_gui_info(sgi);
|
||||
if (!retval) sgi.print();
|
||||
} else if (!strcmp(cmd, "--get_disk_usage")) {
|
||||
PROJECTS ps;
|
||||
retval = rpc.get_disk_usage(ps);
|
||||
|
|
|
@ -508,6 +508,12 @@ struct CC_STATUS {
|
|||
bool ams_password_error;
|
||||
};
|
||||
|
||||
struct SIMPLE_GUI_INFO {
|
||||
std::vector<PROJECT*> projects;
|
||||
std::vector<RESULT*> results;
|
||||
void print();
|
||||
};
|
||||
|
||||
class RPC_CLIENT {
|
||||
public:
|
||||
int sock;
|
||||
|
@ -541,6 +547,7 @@ public:
|
|||
int get_state(CC_STATE&);
|
||||
int get_results(RESULTS&);
|
||||
int get_file_transfers(FILE_TRANSFERS&);
|
||||
int get_simple_gui_info(SIMPLE_GUI_INFO&);
|
||||
int get_project_status(CC_STATE&);
|
||||
int get_project_status(PROJECTS&);
|
||||
int get_disk_usage(PROJECTS&);
|
||||
|
|
|
@ -1045,6 +1045,37 @@ int RPC_CLIENT::get_file_transfers(FILE_TRANSFERS& t) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
int RPC_CLIENT::get_simple_gui_info(SIMPLE_GUI_INFO& sgi) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
char buf[256];
|
||||
RPC rpc(this);
|
||||
|
||||
sgi.projects.clear();
|
||||
sgi.results.clear();
|
||||
retval = rpc.do_rpc("<get_simple_gui_info>\n");
|
||||
if (!retval) {
|
||||
while (rpc.fin.fgets(buf, 256)) {
|
||||
if (match_tag(buf, "</simple_gui_info>")) break;
|
||||
else if (match_tag(buf, "<project>")) {
|
||||
PROJECT* project = new PROJECT();
|
||||
project->parse(rpc.fin);
|
||||
sgi.projects.push_back(project);
|
||||
continue;
|
||||
}
|
||||
else if (match_tag(buf, "<result>")) {
|
||||
RESULT* result = new RESULT();
|
||||
result->parse(rpc.fin);
|
||||
sgi.results.push_back(result);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
// creates new array of PROJECTs
|
||||
//
|
||||
int RPC_CLIENT::get_project_status(PROJECTS& p) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
|
@ -1068,6 +1099,10 @@ int RPC_CLIENT::get_project_status(PROJECTS& p) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
// Updates the PROJECT array in the CC_STATE in place;
|
||||
// flags any projects that don't exist anymore.
|
||||
// KLUDGE - doesn't belong here
|
||||
//
|
||||
int RPC_CLIENT::get_project_status(CC_STATE& state) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
|
|
|
@ -167,6 +167,20 @@ void HOST_INFO::print() {
|
|||
printf(" disk free: %f\n", d_free);
|
||||
}
|
||||
|
||||
void SIMPLE_GUI_INFO::print() {
|
||||
unsigned int i;
|
||||
printf("======== Projects ========\n");
|
||||
for (i=0; i<projects.size(); i++) {
|
||||
printf("%d) -----------\n", i+1);
|
||||
projects[i]->print();
|
||||
}
|
||||
printf("\n======== Results ========\n");
|
||||
for (i=0; i<results.size(); i++) {
|
||||
printf("%d) -----------\n", i+1);
|
||||
results[i]->print();
|
||||
}
|
||||
}
|
||||
|
||||
void CC_STATE::print() {
|
||||
unsigned int i;
|
||||
printf("======== Projects ========\n");
|
||||
|
|
Loading…
Reference in New Issue