diff --git a/pool/page_stats.php b/pool/page_stats.php index d528f630..94fe02ce 100644 --- a/pool/page_stats.php +++ b/pool/page_stats.php @@ -16,10 +16,20 @@ function dostats($data, $user) { $info = $data['info']; + $pe = false; if (isset($info['p_elapsed'])) { $dspel = howlongago($info['p_elapsed']); - $pg .= "Pool Uptime: $dspel
"; + $pg .= "Pool Uptime: $dspel"; + $pe = true; + } + + if (isset($info['ckdb_elapsed'])) + { + if ($pe) + $pg .= ' '; + $dspel = howlongago($info['ckdb_elapsed']); + $pg .= "CKDB Uptime: $dspel"; } $dsp = '?THs'; diff --git a/src/ckdb.c b/src/ckdb.c index 4e1e8893..6bb8a85f 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -322,6 +322,8 @@ static sem_t socketer_sem; // command called for any ckdb alerts char *ckdb_alert_cmd = NULL; +tv_t ckdb_start; + char *btc_server = "http://127.0.0.1:8330"; char *btc_auth; int btc_timeout = 5; @@ -7244,6 +7246,8 @@ int main(int argc, char **argv) char *kill; tv_t now; + setnow(&ckdb_start); + printf("CKDB Master V%s (C) Kano (see source code)\n", CKDB_VERSION); feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); diff --git a/src/ckdb.h b/src/ckdb.h index e37b3d2f..af8ebe78 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.5" -#define CKDB_VERSION DB_VERSION"-2.106" +#define CKDB_VERSION DB_VERSION"-2.107" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ @@ -385,6 +385,8 @@ extern uint64_t blis_processed; // Access using event_limits_free lock extern char *ckdb_alert_cmd; +extern tv_t ckdb_start; + extern char *btc_server; extern char *btc_auth; extern int btc_timeout; diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 257108fd..a43a6ee4 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -3515,13 +3515,18 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id, tvs_to_buf(&(poolstats->createdate), reply, siz); snprintf(tmp, sizeof(tmp), "p_statsdate=%s%c", reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); + + snprintf(tmp, sizeof(tmp), "ckdb_elapsed=%d%c", + (int)(now->tv_sec - ckdb_start.tv_sec), FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); } else { snprintf(tmp, sizeof(tmp), "users=?%cworkers=?%cp_hashrate=?%c" "p_hashrate5m=?%cp_hashrate1hr=?%c" "p_hashrate24hr=?%cp_elapsed=?%c" - "p_statsdate=?%c", + "p_statsdate=?%cckdb_elapsed=?%c", FLDSEP, FLDSEP, FLDSEP, FLDSEP, - FLDSEP, FLDSEP, FLDSEP, FLDSEP); + FLDSEP, FLDSEP, FLDSEP, FLDSEP, + FLDSEP); APPEND_REALLOC(buf, off, len, tmp); }