00001 // This file is part of BOINC. 00002 // http://boinc.berkeley.edu 00003 // Copyright (C) 2008 University of California 00004 // 00005 // BOINC is free software; you can redistribute it and/or modify it 00006 // under the terms of the GNU Lesser General Public License 00007 // as published by the Free Software Foundation, 00008 // either version 3 of the License, or (at your option) any later version. 00009 // 00010 // BOINC is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00013 // See the GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with BOINC. If not, see <http://www.gnu.org/licenses/>. 00017 00018 #ifndef _TIME_STATS_ 00019 #define _TIME_STATS_ 00020 00021 #include "miofile.h" 00022 #include <vector> 00023 00024 class TIME_STATS { 00025 bool first; 00026 int previous_connected_state; 00027 public: 00028 double last_update; 00029 // we maintain an exponentially weighted average of these quantities: 00031 double on_frac; 00035 double connected_frac; 00039 double active_frac; 00045 double cpu_efficiency; 00046 00047 FILE* time_stats_log; 00048 double inactive_start; 00049 00050 void update(int suspend_reason); 00051 void update_cpu_efficiency(double cpu_wall_time, double cpu_time); 00052 00053 TIME_STATS(); 00054 int write(MIOFILE&, bool to_server); 00055 int parse(MIOFILE&); 00056 00057 void log_append(const char*, double); 00058 void log_append_net(int); 00059 void trim_stats_log(); 00060 void get_log_after(double, MIOFILE&); 00061 void start(); 00062 void quit(); 00063 }; 00064 00065 #endif
1.5.6