diff --git a/pool/page_stats.php b/pool/page_stats.php index bc469389..2e5c108f 100644 --- a/pool/page_stats.php +++ b/pool/page_stats.php @@ -2,7 +2,7 @@ # function allusersort($a, $b) { - $cmp = $a['u_hashrate1hr'] != $b['u_hashrate1hr']; + $cmp = $a['u_hashrate5m'] != $b['u_hashrate5m']; if ($cmp != 0) return $cmp; return $a['userid'] - $b['userid']; @@ -18,7 +18,7 @@ function dostats($data, $user) $pg .= "\n"; $pg .= ""; $pg .= ""; - $pg .= ""; + $pg .= ""; $pg .= "\n"; if ($ans['STATUS'] == 'ok') { @@ -28,7 +28,7 @@ function dostats($data, $user) { $all[] = array('username' => $ans['username'.$i], 'userid' => $ans['userid'.$i], - 'u_hashrate1hr' => $ans['u_hashrate1hr'.$i]); + 'u_hashrate5m' => $ans['u_hashrate5m'.$i]); } usort($all, 'allusersort'); @@ -42,7 +42,7 @@ function dostats($data, $user) $pg .= ""; $pg .= ''; - $uhr = $all[$i]['u_hashrate1hr']; + $uhr = $all[$i]['u_hashrate5m']; if ($uhr == '?') $uhr = '?GHs'; else diff --git a/src/ckdb.c b/src/ckdb.c index 94bced6b..9d8a4952 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -6797,6 +6797,7 @@ static char *cmd_allusers(__maybe_unused PGconn *conn, char *cmd, char *id, size_t len, off; int rows; int64_t userid = -1; + double u_hashrate5m = 0.0; double u_hashrate1hr = 0.0; LOGDEBUG("%s(): cmd '%s'", __func__, cmd); @@ -6812,6 +6813,7 @@ static char *cmd_allusers(__maybe_unused PGconn *conn, char *cmd, char *id, DATA_USERSTATS(usw_item)->userid = DATA_USERSTATS(us_item)->userid; strcpy(DATA_USERSTATS(usw_item)->workername, DATA_USERSTATS(us_item)->workername); + DATA_USERSTATS(usw_item)->hashrate5m = DATA_USERSTATS(us_item)->hashrate5m; DATA_USERSTATS(usw_item)->hashrate1hr = DATA_USERSTATS(us_item)->hashrate1hr; userstats_workername_root = add_to_ktree(userstats_workername_root, usw_item, cmp_userstats_workername); @@ -6842,6 +6844,10 @@ static char *cmd_allusers(__maybe_unused PGconn *conn, char *cmd, char *id, snprintf(tmp, sizeof(tmp), "userid%d=%s%c", rows, reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); + double_to_buf(u_hashrate5m, reply, sizeof(reply)); + snprintf(tmp, sizeof(tmp), "u_hashrate5m%d=%s%c", rows, reply, FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + double_to_buf(u_hashrate1hr, reply, sizeof(reply)); snprintf(tmp, sizeof(tmp), "u_hashrate1hr%d=%s%c", rows, reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); @@ -6850,8 +6856,10 @@ static char *cmd_allusers(__maybe_unused PGconn *conn, char *cmd, char *id, } } userid = DATA_USERSTATS(usw_item)->userid; + u_hashrate5m = 0; u_hashrate1hr = 0; } + u_hashrate5m += DATA_USERSTATS(usw_item)->hashrate5m; u_hashrate1hr += DATA_USERSTATS(usw_item)->hashrate1hr; tmp_item = usw_item; @@ -6875,6 +6883,10 @@ static char *cmd_allusers(__maybe_unused PGconn *conn, char *cmd, char *id, snprintf(tmp, sizeof(tmp), "userid%d=%s%c", rows, reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); + double_to_buf(u_hashrate5m, reply, sizeof(reply)); + snprintf(tmp, sizeof(tmp), "u_hashrate5m%d=%s%c", rows, reply, FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + double_to_buf(u_hashrate1hr, reply, sizeof(reply)); snprintf(tmp, sizeof(tmp), "u_hashrate1hr%d=%s%c", rows, reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp);
UsernameHash Rate 1hrHash Rate 5m
'.$all[$i]['username'].'