2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2005-01-20 23:22:22 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2005-06-07 19:22:50 +00:00
|
|
|
#ifndef _TIME_STATS_
|
|
|
|
#define _TIME_STATS_
|
|
|
|
|
2006-07-10 04:09:55 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2012-10-29 22:44:51 +00:00
|
|
|
#include "miofile.h"
|
|
|
|
#include "common_defs.h"
|
|
|
|
|
|
|
|
struct CLIENT_TIME_STATS : TIME_STATS {
|
2002-04-30 22:22:54 +00:00
|
|
|
bool first;
|
2007-04-11 21:49:57 +00:00
|
|
|
int previous_connected_state;
|
2012-07-03 22:36:59 +00:00
|
|
|
|
2008-05-28 19:15:44 +00:00
|
|
|
double last_update;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2007-04-11 21:49:57 +00:00
|
|
|
FILE* time_stats_log;
|
2006-07-10 04:09:55 +00:00
|
|
|
double inactive_start;
|
|
|
|
|
2010-08-23 05:00:22 +00:00
|
|
|
void update(int suspend_reason, int gpu_suspend_reason);
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2012-07-03 22:36:59 +00:00
|
|
|
void init();
|
2012-10-29 22:44:51 +00:00
|
|
|
int write(MIOFILE&, bool to_remote);
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2006-07-10 04:09:55 +00:00
|
|
|
|
2012-04-25 04:10:29 +00:00
|
|
|
double availability_frac(int rsc_type) {
|
|
|
|
double x;
|
|
|
|
if (rsc_type == 0) {
|
|
|
|
x = on_frac*active_frac;
|
|
|
|
} else {
|
|
|
|
x = on_frac*gpu_active_frac;
|
|
|
|
}
|
|
|
|
return x>0?x:1;
|
|
|
|
}
|
2007-04-11 21:49:57 +00:00
|
|
|
void log_append(const char*, double);
|
|
|
|
void log_append_net(int);
|
|
|
|
void trim_stats_log();
|
|
|
|
void get_log_after(double, MIOFILE&);
|
2007-12-02 15:57:08 +00:00
|
|
|
void start();
|
2007-04-11 21:49:57 +00:00
|
|
|
void quit();
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
2005-06-07 19:22:50 +00:00
|
|
|
|
|
|
|
#endif
|