*** empty log message ***

svn path=/trunk/boinc/; revision=7955
This commit is contained in:
David Anderson 2005-09-09 20:28:55 +00:00
parent a10fc79f9f
commit f45961a433
5 changed files with 66 additions and 22 deletions

View File

@ -11558,3 +11558,14 @@ Bruce 9 Sept 2005
Rom 9 Sept 2005 (staging)
- Tag for 5.1.3 release, all platforms
boinc_core_release_5_1_3
David 9 Sept 2005
- fix web bug, make zip code optional
- add some comments
client/
client_state.C
html/user/
account_finish_action.php
lib/
util.C

View File

@ -402,8 +402,15 @@ void CLIENT_STATE::do_io_or_sleep(double x) {
&tv
);
//printf("select in %d out %d\n", all_fds.max_fd, n);
// Note: curl apparently likes to have curl_multi_perform()
// (called from net_xfers->got_select())
// called pretty often, even if no descriptors are enabled.
// So do the "if (n==0) break" AFTER the got_selects().
net_xfers->got_select(all_fds, x);
gui_rpcs.got_select(all_fds);
if (n==0) break;
now = dtime();

View File

@ -71,6 +71,7 @@ the following function is used to update the
recent average credit of the host, user and team:
<pre>",htmlspecialchars("
void update_average(
double work_start_time, // when new work was started
// (or zero if no new work)
@ -82,6 +83,24 @@ void update_average(
double now = dtime();
if (avg_time) {
// If an average R already exists, imagine that the new work was done
// entirely between avg_time and now.
// That gives a rate R'.
// Replace R with a weighted average of R and R',
// weighted so that we get the right half-life if R' == 0.
//
// But this blows up if avg_time == now; you get 0*(1/0)
// So consider the limit as diff->0,
// using the first-order Taylor expansion of
// exp(x)=1+x+O(x^2).
// So to the lowest order in diff:
// weight = 1 - diff ln(2) / half_life
// so one has
// avg += (1-weight)*(work/diff_days)
// avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff)
// notice that diff cancels out, leaving
// avg += [ln(2)/half_life] * work*SECONDS_PER_DAY
double diff, diff_days, weight;
diff = now - avg_time;
@ -94,17 +113,17 @@ void update_average(
if ((1.0-weight) > 1.e-6) {
avg += (1-weight)*(work/diff_days);
}
else {
} else {
avg += M_LN2*work*SECONDS_PER_DAY/half_life;
}
} else if (work) {
// If first time, average is just work/duration
//
double dd = (now - work_start_time)/SECONDS_PER_DAY;
avg = work/dd;
}
avg_time = now;
}
"),"
</pre>

View File

@ -30,7 +30,7 @@ if (!is_valid_country($country)) {
show_error( "bad country");
}
$postal_code = strip_tags(process_user_text(post_str("postal_code")));
$postal_code = strip_tags(process_user_text(post_str("postal_code", true)));
$query = "update user set name='$name', country='$country', postal_code='$postal_code' where authenticator='$auth'";
$retval = mysql_query($query);

View File

@ -792,18 +792,6 @@ int boinc_calling_thread_cpu_time(double &cpu_t) {
// NOTE: if you change this, also change update_average in
// html/inc/credit.inc
//
// David, the quick fix I have done is minimalist. Consider the limit
// as diff->0, using the first-order Taylor expansion of
// exp(x)=1+x+O(x^2).
// So to the lowest order in diff:
// weight = 1 - diff ln(2) / half_life
// so one has
// avg += (1-weight)*(work/diff_days)
// avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff)
// notice that diff cancels out, leaving
// avg += [ln(2)/half_life] * work*SECONDS_PER_DAY
void update_average(
double work_start_time, // when new work was started
// (or zero if no new work)
@ -815,6 +803,24 @@ void update_average(
double now = dtime();
if (avg_time) {
// If an average R already exists, imagine that the new work was done
// entirely between avg_time and now.
// That gives a rate R'.
// Replace R with a weighted average of R and R',
// weighted so that we get the right half-life if R' == 0.
//
// But this blows up if avg_time == now; you get 0*(1/0)
// So consider the limit as diff->0,
// using the first-order Taylor expansion of
// exp(x)=1+x+O(x^2).
// So to the lowest order in diff:
// weight = 1 - diff ln(2) / half_life
// so one has
// avg += (1-weight)*(work/diff_days)
// avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff)
// notice that diff cancels out, leaving
// avg += [ln(2)/half_life] * work*SECONDS_PER_DAY
double diff, diff_days, weight;
diff = now - avg_time;
@ -827,11 +833,12 @@ void update_average(
if ((1.0-weight) > 1.e-6) {
avg += (1-weight)*(work/diff_days);
}
else {
} else {
avg += M_LN2*work*SECONDS_PER_DAY/half_life;
}
} else if (work) {
// If first time, average is just work/duration
//
double dd = (now - work_start_time)/SECONDS_PER_DAY;
avg = work/dd;
}