mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5236
This commit is contained in:
parent
ec8ed073d5
commit
aa6b06a2a9
|
@ -23367,3 +23367,16 @@ David 28 Jan 2005
|
|||
|
||||
sched/
|
||||
server_types.C
|
||||
|
||||
David 28 Jan 2005
|
||||
- core client: in MESSAGE_DESC
|
||||
(used to save messages, so they can be sent to core client)
|
||||
store project name, instead of pointer to project.
|
||||
By the time we send msg to GUI, the project object might be deleted!
|
||||
- improve time_stats
|
||||
|
||||
client/
|
||||
client_msgs.C,h
|
||||
client_state.C
|
||||
gui_rpc_server.C
|
||||
time_stats.C,h
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using std::deque;
|
||||
|
||||
#include "log_flags.h"
|
||||
#include "client_types.h"
|
||||
#include "client_msgs.h"
|
||||
|
||||
#define MAX_SAVED_MESSAGES 1000
|
||||
|
@ -99,7 +100,10 @@ void msg_printf(PROJECT *p, int priority, char *fmt, ...) {
|
|||
void record_message(PROJECT* p, int priority, int now, char* message) {
|
||||
MESSAGE_DESC* mdp = new MESSAGE_DESC;
|
||||
static int seqno = 1;
|
||||
mdp->project = p;
|
||||
strcpy(mdp->project_name, "");
|
||||
if (p) {
|
||||
strcpy(mdp->project_name, p->get_project_name());
|
||||
}
|
||||
mdp->priority = priority;
|
||||
mdp->timestamp = now;
|
||||
mdp->seqno = seqno++;
|
||||
|
|
|
@ -52,7 +52,7 @@ class PROJECT;
|
|||
// the following stores a message in memory, where it can be retrieved via RPC
|
||||
//
|
||||
struct MESSAGE_DESC {
|
||||
PROJECT* project;
|
||||
char project_name[256];
|
||||
int priority;
|
||||
int timestamp;
|
||||
int seqno;
|
||||
|
|
|
@ -471,7 +471,7 @@ bool CLIENT_STATE::do_something(double now) {
|
|||
if (actions > 0) {
|
||||
return true;
|
||||
} else {
|
||||
time_stats.update(true, !activities_suspended);
|
||||
time_stats.update(now, true, !activities_suspended);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -303,21 +303,17 @@ void handle_get_messages(char* buf, MIOFILE& fout) {
|
|||
mdp = message_descs[i];
|
||||
fout.printf(
|
||||
"<msg>\n"
|
||||
" <project>%s</project>\n"
|
||||
" <pri>%d</pri>\n"
|
||||
" <seqno>%d</seqno>\n"
|
||||
" <body>\n%s\n</body>\n"
|
||||
" <time>%d</time>\n",
|
||||
mdp->project_name,
|
||||
mdp->priority,
|
||||
mdp->seqno,
|
||||
mdp->message.c_str(),
|
||||
mdp->timestamp
|
||||
);
|
||||
if (mdp->project) {
|
||||
fout.printf(
|
||||
" <project>%s</project>\n",
|
||||
mdp->project->get_project_name()
|
||||
);
|
||||
}
|
||||
fout.printf("</msg>\n");
|
||||
}
|
||||
fout.printf("</msgs>\n");
|
||||
|
|
|
@ -49,10 +49,12 @@ TIME_STATS::TIME_STATS() {
|
|||
}
|
||||
|
||||
// Update time statistics based on current activities
|
||||
// NOTE: we don't set the state-file dirty flag here,
|
||||
// so these get written to disk only when other activities
|
||||
// cause this to happen. Maybe should change this.
|
||||
//
|
||||
void TIME_STATS::update(bool is_connected, bool is_active) {
|
||||
int now = time(0), dt;
|
||||
double w1, w2;
|
||||
void TIME_STATS::update(double now, bool is_connected, bool is_active) {
|
||||
double dt, w1, w2;
|
||||
|
||||
if (last_update == 0) {
|
||||
// this is the first time this client has executed.
|
||||
|
@ -60,12 +62,12 @@ void TIME_STATS::update(bool is_connected, bool is_active) {
|
|||
|
||||
on_frac = 1;
|
||||
connected_frac = is_connected?1:0;
|
||||
active_frac = true;
|
||||
active_frac = is_active?1:0;
|
||||
first = false;
|
||||
last_update = now;
|
||||
} else {
|
||||
dt = now - last_update;
|
||||
if (dt <= 0) return;
|
||||
if (dt <= 10) return;
|
||||
w1 = 1 - exp(-dt/ALPHA);
|
||||
w2 = 1 - w1;
|
||||
if (first) {
|
||||
|
|
|
@ -27,12 +27,14 @@ public:
|
|||
double on_frac;
|
||||
// the fraction of total time this host runs the core client
|
||||
double connected_frac;
|
||||
// the fraction of total time the host is connected to the Internet
|
||||
// of the time this host runs the core client,
|
||||
// the fraction it is connected to the Internet
|
||||
double active_frac;
|
||||
// the fraction of total time the core client is able to work
|
||||
// of the time this host runs the core client,
|
||||
// the fraction it is enabled to work
|
||||
// (due to preferences, manual suspend/resume, etc.)
|
||||
|
||||
void update(bool is_connected, bool is_active);
|
||||
void update(double now, bool is_connected, bool is_active);
|
||||
|
||||
TIME_STATS();
|
||||
int write(MIOFILE&, bool to_server);
|
||||
|
|
|
@ -217,9 +217,9 @@ struct HOST {
|
|||
char last_ip_addr[256]; // internal IP address as of last RPC
|
||||
int nsame_ip_addr; // # of RPCs with same IP address
|
||||
|
||||
double on_frac; // Fraction of time (0-1) that BOINC is running
|
||||
double connected_frac; // Fraction of time that host is connected to net
|
||||
double active_frac; // Fraction of time that host is enabled to work
|
||||
double on_frac; // see client/time_stats.h
|
||||
double connected_frac;
|
||||
double active_frac;
|
||||
|
||||
int p_ncpus; // Number of CPUs on host
|
||||
char p_vendor[256]; // Vendor name of CPU
|
||||
|
|
Loading…
Reference in New Issue