2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This 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 2.1 of the License, or (at your option) any later version.
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// 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
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
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
|
|
|
|
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
|
|
|
|
2006-06-09 23:17:05 +00:00
|
|
|
int init_result(RESULT const& /*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$";
|