|
|
|
@ -5631,73 +5631,71 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id,
|
|
|
|
|
__maybe_unused tv_t *notcd, __maybe_unused K_TREE *trf_root) |
|
|
|
|
{ |
|
|
|
|
char tmp[1024], *buf; |
|
|
|
|
const char *name; |
|
|
|
|
size_t len, off; |
|
|
|
|
uint64_t ram, ram2, tot = 0; |
|
|
|
|
K_LIST *klist; |
|
|
|
|
K_LISTS *klists; |
|
|
|
|
int rows = 0; |
|
|
|
|
bool istree; |
|
|
|
|
|
|
|
|
|
LOGDEBUG("%s(): cmd '%s'", __func__, cmd); |
|
|
|
|
|
|
|
|
|
APPEND_REALLOC_INIT(buf, off, len); |
|
|
|
|
APPEND_REALLOC(buf, off, len, "ok."); |
|
|
|
|
|
|
|
|
|
// FYI average transactiontree length of the ~119k I have is ~28k (>3.3GB)
|
|
|
|
|
#define USEINFO(_obj, _stores, _trees) \ |
|
|
|
|
klist = _obj ## _free; \
|
|
|
|
|
ram = sizeof(K_LIST) + _stores * sizeof(K_STORE) + \
|
|
|
|
|
klist->allocate * klist->item_mem_count * klist->siz + \
|
|
|
|
|
sizeof(K_TREE) * (klist->total - klist->count) * _trees; \
|
|
|
|
|
ram2 = klist->ram; \
|
|
|
|
|
snprintf(tmp, sizeof(tmp), \
|
|
|
|
|
"name:%d=" #_obj "%cinitial:%d=%d%callocated:%d=%d%c" \
|
|
|
|
|
"store:%d=%d%ctrees:%d=%d%cram:%d=%"PRIu64"%c" \
|
|
|
|
|
"ram2:%d=%"PRIu64"%ccull:%d=%d%c", \
|
|
|
|
|
rows, FLDSEP, \
|
|
|
|
|
rows, klist->allocate, FLDSEP, \
|
|
|
|
|
rows, klist->total, FLDSEP, \
|
|
|
|
|
rows, klist->total - klist->count, FLDSEP, \
|
|
|
|
|
rows, _trees, FLDSEP, \
|
|
|
|
|
rows, ram, FLDSEP, \
|
|
|
|
|
rows, ram2, FLDSEP, \
|
|
|
|
|
rows, klist->cull_count, FLDSEP); \
|
|
|
|
|
APPEND_REALLOC(buf, off, len, tmp); \
|
|
|
|
|
tot += ram + ram2; \
|
|
|
|
|
rows++; |
|
|
|
|
|
|
|
|
|
USEINFO(users, 1, 2); |
|
|
|
|
USEINFO(useratts, 1, 1); |
|
|
|
|
USEINFO(workers, 1, 1); |
|
|
|
|
USEINFO(paymentaddresses, 1, 2); |
|
|
|
|
USEINFO(payments, 1, 1); |
|
|
|
|
USEINFO(accountbalance, 1, 1); |
|
|
|
|
USEINFO(idcontrol, 1, 0); |
|
|
|
|
USEINFO(optioncontrol, 1, 1); |
|
|
|
|
USEINFO(workinfo, 1, 1); |
|
|
|
|
// Trees don't share items so count as 1 tree
|
|
|
|
|
USEINFO(shares, 2, 1); |
|
|
|
|
// Trees don't share items so count as 1 tree
|
|
|
|
|
USEINFO(shareerrors, 2, 1); |
|
|
|
|
// _pool doesn't share items so is included
|
|
|
|
|
USEINFO(sharesummary, 1, 2); |
|
|
|
|
USEINFO(workmarkers, 1, 2); |
|
|
|
|
// _pool doesn't share items so is included
|
|
|
|
|
USEINFO(markersummary, 1, 2); |
|
|
|
|
USEINFO(marks, 1, 1); |
|
|
|
|
USEINFO(blocks, 1, 1); |
|
|
|
|
USEINFO(miningpayouts, 1, 1); |
|
|
|
|
USEINFO(payouts, 1, 3); |
|
|
|
|
USEINFO(auths, 1, 1); |
|
|
|
|
USEINFO(poolstats, 1, 1); |
|
|
|
|
USEINFO(userstats, 2, 1); |
|
|
|
|
USEINFO(workerstatus, 1, 1); |
|
|
|
|
USEINFO(userinfo, 1, 1); |
|
|
|
|
USEINFO(msgline, 1, 0); |
|
|
|
|
USEINFO(workqueue, 3, 0); |
|
|
|
|
USEINFO(transfer, 0, 0); |
|
|
|
|
USEINFO(heartbeatqueue, 1, 0); |
|
|
|
|
USEINFO(logqueue, 1, 0); |
|
|
|
|
USEINFO(seqset, 1, 0); |
|
|
|
|
USEINFO(seqtrans, 0, 0); |
|
|
|
|
/* All but temporary lists are in klist_all
|
|
|
|
|
* All trees are there also since all trees have a node klist */ |
|
|
|
|
ck_wlock(&lock_check_lock); |
|
|
|
|
klists = all_klists; |
|
|
|
|
while (klists) { |
|
|
|
|
klist = klists->klist; |
|
|
|
|
|
|
|
|
|
ram = sizeof(*klist); |
|
|
|
|
if (klist->name == tree_node_list_name) { |
|
|
|
|
ram += sizeof(K_TREE); |
|
|
|
|
istree = true; |
|
|
|
|
name = klist->name2; |
|
|
|
|
} else { |
|
|
|
|
istree = false; |
|
|
|
|
name = klist->name; |
|
|
|
|
} |
|
|
|
|
if (klist->lock) |
|
|
|
|
ram += sizeof(*(klist->lock)); |
|
|
|
|
// List of item lists
|
|
|
|
|
ram += klist->item_mem_count * sizeof(*(klist->item_memory)); |
|
|
|
|
// items
|
|
|
|
|
ram += klist->total * sizeof(K_ITEM); |
|
|
|
|
// List of data lists
|
|
|
|
|
ram += klist->data_mem_count * sizeof(*(klist->data_memory)); |
|
|
|
|
// data
|
|
|
|
|
ram += klist->total * klist->siz; |
|
|
|
|
|
|
|
|
|
// stores
|
|
|
|
|
ram += klist->stores * sizeof(K_STORE); |
|
|
|
|
|
|
|
|
|
ram2 = klist->ram; |
|
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), |
|
|
|
|
"name:%d=%s%s%s%cinitial:%d=%d%callocated:%d=%d%c" |
|
|
|
|
"instore:%d=%d%cram:%d=%"PRIu64"%c" |
|
|
|
|
"ram2:%d=%"PRIu64"%ccull:%d=%d%c", |
|
|
|
|
rows, name, istree ? " (tree)" : "", |
|
|
|
|
klist->is_lock_only ? " (lock)" : "", FLDSEP, |
|
|
|
|
rows, klist->allocate, FLDSEP, |
|
|
|
|
rows, klist->total, FLDSEP, |
|
|
|
|
rows, klist->total - klist->count, FLDSEP, |
|
|
|
|
rows, ram, FLDSEP, |
|
|
|
|
rows, ram2, FLDSEP, |
|
|
|
|
rows, klist->cull_count, FLDSEP); |
|
|
|
|
APPEND_REALLOC(buf, off, len, tmp); |
|
|
|
|
|
|
|
|
|
tot += ram + ram2; |
|
|
|
|
rows++; |
|
|
|
|
|
|
|
|
|
klists = klists->next; |
|
|
|
|
} |
|
|
|
|
ck_wunlock(&lock_check_lock); |
|
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), "totalram=%"PRIu64"%c", tot, FLDSEP); |
|
|
|
|
APPEND_REALLOC(buf, off, len, tmp); |
|
|
|
@ -5705,7 +5703,7 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id,
|
|
|
|
|
snprintf(tmp, sizeof(tmp), |
|
|
|
|
"rows=%d%cflds=%s%c", |
|
|
|
|
rows, FLDSEP, |
|
|
|
|
"name,initial,allocated,store,trees,ram,cull", FLDSEP); |
|
|
|
|
"name,initial,allocated,instore,ram,cull", FLDSEP); |
|
|
|
|
APPEND_REALLOC(buf, off, len, tmp); |
|
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), "arn=%s%carp=%s", "Stats", FLDSEP, ""); |
|
|
|
|