mirror of https://github.com/BOINC/boinc.git
client: track and report network, disk, and memory usage
- store final network usage in RESULT; write/parse in state file - final disk and memory usage weren't being written to state file; do so. - add --network_usage option to example app, to test this stuff
This commit is contained in:
parent
3752906ba8
commit
f3366ec5ba
|
@ -385,6 +385,8 @@ void ACTIVE_TASK::copy_final_info() {
|
|||
result->final_peak_working_set_size = peak_working_set_size;
|
||||
result->final_peak_swap_size = peak_swap_size;
|
||||
result->final_peak_disk_usage = peak_disk_usage;
|
||||
result->final_bytes_sent = bytes_sent;
|
||||
result->final_bytes_received = bytes_received;
|
||||
}
|
||||
|
||||
// deal with a process that has exited, for whatever reason:
|
||||
|
@ -1332,13 +1334,17 @@ bool ACTIVE_TASK::get_app_status_msg() {
|
|||
parse_double(msg_buf, "<intops_cumulative>", result->intops_cumulative);
|
||||
if (parse_double(msg_buf, "<bytes_sent>", dtemp)) {
|
||||
if (dtemp > bytes_sent_episode) {
|
||||
daily_xfer_history.add(dtemp - bytes_sent_episode, true);
|
||||
double nbytes = dtemp - bytes_sent_episode;
|
||||
daily_xfer_history.add(nbytes, true);
|
||||
bytes_sent += nbytes;
|
||||
}
|
||||
bytes_sent_episode = dtemp;
|
||||
}
|
||||
if (parse_double(msg_buf, "<bytes_received>", dtemp)) {
|
||||
if (dtemp > bytes_received_episode) {
|
||||
daily_xfer_history.add(dtemp - bytes_received_episode, false);
|
||||
double nbytes = dtemp - bytes_received_episode;
|
||||
daily_xfer_history.add(nbytes, false);
|
||||
bytes_received += nbytes;
|
||||
}
|
||||
bytes_received_episode = dtemp;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,11 @@ void RESULT::clear() {
|
|||
got_server_ack = false;
|
||||
final_cpu_time = 0;
|
||||
final_elapsed_time = 0;
|
||||
final_peak_working_set_size = 0;
|
||||
final_peak_swap_size = 0;
|
||||
final_peak_disk_usage = 0;
|
||||
final_bytes_sent = 0;
|
||||
final_bytes_received = 0;
|
||||
#ifdef SIM
|
||||
peak_flop_count = 0;
|
||||
#endif
|
||||
|
@ -145,6 +150,11 @@ int RESULT::parse_state(XML_PARSER& xp) {
|
|||
}
|
||||
if (xp.parse_double("final_cpu_time", final_cpu_time)) continue;
|
||||
if (xp.parse_double("final_elapsed_time", final_elapsed_time)) continue;
|
||||
if (xp.parse_double("final_peak_working_set_size", final_peak_working_set_size)) continue;
|
||||
if (xp.parse_double("final_peak_swap_size", final_peak_swap_size)) continue;
|
||||
if (xp.parse_double("final_peak_disk_usage", final_peak_disk_usage)) continue;
|
||||
if (xp.parse_double("final_bytes_sent", final_bytes_sent)) continue;
|
||||
if (xp.parse_double("final_bytes_received", final_bytes_received)) continue;
|
||||
if (xp.parse_int("exit_status", exit_status)) continue;
|
||||
if (xp.parse_bool("got_server_ack", got_server_ack)) continue;
|
||||
if (xp.parse_bool("ready_to_report", ready_to_report)) continue;
|
||||
|
@ -208,16 +218,40 @@ int RESULT::write(MIOFILE& out, bool to_server) {
|
|||
if (intops_cumulative) {
|
||||
out.printf(" <intops_cumulative>%f</intops_cumulative>\n", intops_cumulative);
|
||||
}
|
||||
if (final_peak_working_set_size) {
|
||||
out.printf(
|
||||
" <final_peak_working_set_size>%.0f</final_peak_working_set_size>\n",
|
||||
final_peak_working_set_size
|
||||
);
|
||||
}
|
||||
if (final_peak_swap_size) {
|
||||
out.printf(
|
||||
" <final_peak_swap_size>%.0f</final_peak_swap_size>\n",
|
||||
final_peak_swap_size
|
||||
);
|
||||
}
|
||||
if (final_peak_disk_usage) {
|
||||
out.printf(
|
||||
" <final_peak_disk_usage>%.0f</final_peak_disk_usage>\n",
|
||||
final_peak_disk_usage
|
||||
);
|
||||
}
|
||||
if (final_bytes_sent) {
|
||||
out.printf(
|
||||
" <final_bytes_sent>%.0f</final_bytes_sent>\n",
|
||||
final_bytes_sent
|
||||
);
|
||||
}
|
||||
if (final_bytes_received) {
|
||||
out.printf(
|
||||
" <final_bytes_received>%.0f</final_bytes_received>\n",
|
||||
final_bytes_received
|
||||
);
|
||||
}
|
||||
if (to_server) {
|
||||
out.printf(
|
||||
" <app_version_num>%d</app_version_num>\n"
|
||||
" <final_peak_working_set_size>%.0f</final_peak_working_set_size>\n"
|
||||
" <final_peak_swap_size>%.0f</final_peak_swap_size>\n"
|
||||
" <final_peak_disk_usage>%.0f</final_peak_disk_usage>\n",
|
||||
wup->version_num,
|
||||
final_peak_working_set_size,
|
||||
final_peak_swap_size,
|
||||
final_peak_disk_usage
|
||||
" <app_version_num>%d</app_version_num>\n",
|
||||
wup->version_num
|
||||
);
|
||||
}
|
||||
n = (int)stderr_out.length();
|
||||
|
|
|
@ -43,6 +43,8 @@ struct RESULT {
|
|||
double final_peak_working_set_size;
|
||||
double final_peak_swap_size;
|
||||
double final_peak_disk_usage;
|
||||
double final_bytes_sent;
|
||||
double final_bytes_received;
|
||||
#ifdef SIM
|
||||
double peak_flop_count;
|
||||
double sim_flops_left;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
// --run_slow: sleep 1 second after each character
|
||||
// --trickle_up: sent a trickle-up message
|
||||
// --trickle_down: receive a trickle-up message
|
||||
// --network_usage: tell the client we used some network
|
||||
//
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -77,6 +78,7 @@ bool trickle_up = false;
|
|||
bool trickle_down = false;
|
||||
bool critical_section = false; // run most of the time in a critical section
|
||||
bool report_fraction_done = true;
|
||||
bool network_usage = false;
|
||||
double cpu_time = 20, comp_result;
|
||||
|
||||
// do about .5 seconds of computing
|
||||
|
@ -151,6 +153,7 @@ int main(int argc, char **argv) {
|
|||
if (strstr(argv[i], "early_sleep")) early_sleep = true;
|
||||
if (strstr(argv[i], "run_slow")) run_slow = true;
|
||||
if (strstr(argv[i], "critical_section")) critical_section = true;
|
||||
if (strstr(argv[i], "network_usage")) network_usage = true;
|
||||
if (strstr(argv[i], "cpu_time")) {
|
||||
cpu_time = atof(argv[++i]);
|
||||
}
|
||||
|
@ -235,6 +238,10 @@ int main(int argc, char **argv) {
|
|||
boinc_register_timer_callback(update_shmem);
|
||||
#endif
|
||||
|
||||
if (network_usage) {
|
||||
boinc_network_usage(5., 17.);
|
||||
}
|
||||
|
||||
// main loop - read characters, convert to UC, write
|
||||
//
|
||||
for (i=0; ; i++) {
|
||||
|
|
Loading…
Reference in New Issue