Browse Source

ckdb/php - add more stats in pplns about where the shares come from

master
kanoi 10 years ago
parent
commit
5fe3dd77e2
  1. 6
      pool/page_pplns.php
  2. 2
      src/ckdb.h
  3. 33
      src/ckdb_cmd.c

6
pool/page_pplns.php

@ -179,7 +179,11 @@ Block: <input type=text name=blk size=10 value='$blkuse'>
'Network Difficulty' => 'block_ndiff', 'Network Difficulty' => 'block_ndiff',
'PPLNS Factor' => 'diff_times', 'PPLNS Factor' => 'diff_times',
'PPLNS Added' => 'diff_add', 'PPLNS Added' => 'diff_add',
'Share Count' => 'share_count'); 'Accepted Share Count' => 'acc_share_count',
'Total Share Count' => 'total_share_count',
'ShareSummary Count' => 'ss_count',
'WorkMarkers Count' => 'wm_count',
'MarkerSummary Count' => 'ms_count');
$pg = '<br><a href=https://blockchain.info/block-height/'; $pg = '<br><a href=https://blockchain.info/block-height/';
$pg .= $ans['block'].'>Blockchain '.$ans['block']."</a><br>\n"; $pg .= $ans['block'].'>Blockchain '.$ans['block']."</a><br>\n";

2
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9.5" #define DB_VERSION "0.9.5"
#define CKDB_VERSION DB_VERSION"-0.646" #define CKDB_VERSION DB_VERSION"-0.647"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

33
src/ckdb_cmd.c

@ -2971,7 +2971,8 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
int32_t height; int32_t height;
int64_t workinfoid, end_workinfoid = 0; int64_t workinfoid, end_workinfoid = 0;
int64_t begin_workinfoid; int64_t begin_workinfoid;
int64_t share_count; int64_t total_share_count, acc_share_count;
int64_t ss_count, wm_count, ms_count;
char tv_buf[DATE_BUFSIZ]; char tv_buf[DATE_BUFSIZ];
tv_t cd, begin_tv, block_tv, end_tv; tv_t cd, begin_tv, block_tv, end_tv;
K_TREE_CTX ctx[1], wm_ctx[1], ms_ctx[1]; K_TREE_CTX ctx[1], wm_ctx[1], ms_ctx[1];
@ -3044,6 +3045,8 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
} }
workinfoid = blocks->workinfoid; workinfoid = blocks->workinfoid;
copy_tv(&block_tv, &(blocks->createdate)); copy_tv(&block_tv, &(blocks->createdate));
/* Last share should be the share that found it and match the createdate,
* or not long after it for shares accepted until the workinfo switch */
copy_tv(&end_tv, &(blocks->createdate)); copy_tv(&end_tv, &(blocks->createdate));
w_item = find_workinfo(workinfoid); w_item = find_workinfo(workinfoid);
@ -3064,8 +3067,9 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
} }
begin_workinfoid = 0; begin_workinfoid = 0;
share_count = 0; total_share_count = acc_share_count = 0;
total = 0; total = 0;
ss_count = wm_count = ms_count = 0;
mu_store = k_new_store(miningpayouts_free); mu_store = k_new_store(miningpayouts_free);
mu_root = new_ktree(); mu_root = new_ktree();
@ -3096,7 +3100,9 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
default: default:
share_status = "Not ready1"; share_status = "Not ready1";
} }
share_count += sharesummary->sharecount; ss_count++;
total_share_count += sharesummary->sharecount;
acc_share_count += sharesummary->shareacc;
total += (int64_t)(sharesummary->diffacc); total += (int64_t)(sharesummary->diffacc);
begin_workinfoid = sharesummary->workinfoid; begin_workinfoid = sharesummary->workinfoid;
if (tv_newer(&end_tv, &(sharesummary->lastshare))) if (tv_newer(&end_tv, &(sharesummary->lastshare)))
@ -3122,7 +3128,9 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
else else
share_status = "Not ready1+2"; share_status = "Not ready1+2";
} }
share_count++; ss_count++;
total_share_count += sharesummary->sharecount;
acc_share_count += sharesummary->shareacc;
total += (int64_t)(sharesummary->diffacc); total += (int64_t)(sharesummary->diffacc);
mu_root = upd_add_mu(mu_root, mu_store, mu_root = upd_add_mu(mu_root, mu_store,
sharesummary->userid, sharesummary->userid,
@ -3144,6 +3152,7 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
DATA_WORKMARKERS_NULL(workmarkers, wm_item); DATA_WORKMARKERS_NULL(workmarkers, wm_item);
while (total < diff_want && wm_item && CURRENT(&(workmarkers->expirydate))) { while (total < diff_want && wm_item && CURRENT(&(workmarkers->expirydate))) {
if (WMREADY(workmarkers->status)) { if (WMREADY(workmarkers->status)) {
wm_count++;
lookmarkersummary.markerid = workmarkers->markerid; lookmarkersummary.markerid = workmarkers->markerid;
lookmarkersummary.userid = MAXID; lookmarkersummary.userid = MAXID;
lookmarkersummary.workername = EMPTY; lookmarkersummary.workername = EMPTY;
@ -3156,7 +3165,9 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
while (ms_item && markersummary->markerid == workmarkers->markerid) { while (ms_item && markersummary->markerid == workmarkers->markerid) {
if (end_workinfoid == 0) if (end_workinfoid == 0)
end_workinfoid = workmarkers->workinfoidend; end_workinfoid = workmarkers->workinfoidend;
share_count += markersummary->sharecount; ms_count++;
total_share_count += markersummary->sharecount;
acc_share_count += markersummary->shareacc;
total += (int64_t)(markersummary->diffacc); total += (int64_t)(markersummary->diffacc);
begin_workinfoid = workmarkers->workinfoidstart; begin_workinfoid = workmarkers->workinfoidstart;
if (tv_newer(&end_tv, &(markersummary->lastshare))) if (tv_newer(&end_tv, &(markersummary->lastshare)))
@ -3308,7 +3319,17 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "diff_want=%f%c", diff_want, FLDSEP); snprintf(tmp, sizeof(tmp), "diff_want=%f%c", diff_want, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "share_count=%"PRId64, share_count); snprintf(tmp, sizeof(tmp), "acc_share_count=%"PRId64"%c",
acc_share_count, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "total_share_count=%"PRId64"%c",
total_share_count, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "ss_count=%"PRId64"%c", ss_count, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "wm_count=%"PRId64"%c", wm_count, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "ms_count=%"PRId64, ms_count);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
mu_root = free_ktree(mu_root, NULL); mu_root = free_ktree(mu_root, NULL);

Loading…
Cancel
Save