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
|
2003-08-14 00:02:15 +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.
|
2003-08-14 00:02:15 +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.
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
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/>.
|
2003-08-14 00:02:15 +00:00
|
|
|
|
2004-07-13 12:23:47 +00:00
|
|
|
// A sample validator that grants credit to any result whose CPU time is above
|
|
|
|
// a certain minimum
|
2004-03-17 01:26:44 +00:00
|
|
|
|
2008-02-27 23:26:38 +00:00
|
|
|
#include <cstdlib>
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
2003-08-14 00:02:15 +00:00
|
|
|
#include "validate_util.h"
|
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
using std::vector;
|
|
|
|
|
2004-10-04 23:59:51 +00:00
|
|
|
static const double MIN_CPU_TIME = 0;
|
2003-11-04 19:53:32 +00:00
|
|
|
|
2008-03-13 23:35:13 +00:00
|
|
|
int init_result(RESULT& /*result*/, void*& /*data*/) {
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-06-09 23:17:05 +00:00
|
|
|
int compare_results(
|
2004-09-09 22:25:10 +00:00
|
|
|
RESULT & r1, void* /*data1*/,
|
2004-09-09 22:28:00 +00:00
|
|
|
RESULT const& r2, void* /*data2*/,
|
|
|
|
bool& match
|
2004-03-17 01:26:44 +00:00
|
|
|
) {
|
2004-09-09 22:28:00 +00:00
|
|
|
match = (r1.cpu_time >= MIN_CPU_TIME && r2.cpu_time >= MIN_CPU_TIME);
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-06-09 23:17:05 +00:00
|
|
|
int cleanup_result(RESULT const&, void*) {
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-01-30 18:19:30 +00:00
|
|
|
double compute_granted_credit(WORKUNIT& wu, vector<RESULT>& results) {
|
|
|
|
return median_mean_credit(wu, results);
|
2007-01-23 21:37:27 +00:00
|
|
|
}
|
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_f3a7a34795 = "$Id$";
|