Browse Source

ckdb/php - show only recent workers with an option to disable it

master
kanoi 10 years ago
parent
commit
c42de09e5c
  1. 2
      pool/page.php
  2. 61
      pool/page_workmgt.php
  3. 4
      src/ckdb.h
  4. 325
      src/ckdb_cmd.c

2
pool/page.php

@ -165,7 +165,7 @@ function pghead($script_marker, $name)
$head .= "window.onpaint=jst();\n</script>\n"; $head .= "window.onpaint=jst();\n</script>\n";
$head .= "<style type='text/css'> $head .= "<style type='text/css'>
input {vertical-align: -2px;} input[type=checkbox] {vertical-align: -2px;}
form {display: inline-block;} form {display: inline-block;}
html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;} html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;}
.page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;} .page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;}

61
pool/page_workmgt.php

@ -7,6 +7,21 @@ function workmgtuser($data, $user, $err)
if ($err != '') if ($err != '')
$pg .= "<span class=err>$err<br><br></span>"; $pg .= "<span class=err>$err<br><br></span>";
$ans = getWorkers($user, 'N');
if ($ans['STATUS'] == 'ok')
{
if (isset($ans['oldworkers']) && $ans['oldworkers'] == '0')
$chk = '';
else
$chk = ' checked';
$pg .= makeForm('workmgt');
$pg .= '<span>Active workers (7 days)';
$pg .= "<input type=checkbox name=seven$chk>";
$pg .= '<input type=submit name=S value=Update>';
$pg .= '</span></form><br><br>';
}
$pg .= makeForm('workmgt'); $pg .= makeForm('workmgt');
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n"; $pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= '<tr class=title>'; $pg .= '<tr class=title>';
@ -14,8 +29,6 @@ function workmgtuser($data, $user, $err)
$pg .= '<td class=dr>Minimum Diff</td>'; $pg .= '<td class=dr>Minimum Diff</td>';
$pg .= '</tr>'; $pg .= '</tr>';
$ans = getWorkers($user, 'N');
$offset = 0; $offset = 0;
if ($ans['STATUS'] == 'ok') if ($ans['STATUS'] == 'ok')
{ {
@ -58,26 +71,42 @@ function workmgtuser($data, $user, $err)
function doworkmgt($data, $user) function doworkmgt($data, $user)
{ {
$err = ''; $err = '';
$OK = getparam('OK', false); $S = getparam('S', false);
$count = getparam('rows', false); $chk = getparam('seven', false);
if ($OK == 'OK' && !nuem($count)) if ($S == 'Update')
{
$settings = array();
if ($chk == 'on')
$settings['oldworkers'] = '7';
else
$settings['oldworkers'] = '0';
$ans = workerSet($user, $settings);
if ($ans['STATUS'] != 'ok')
$err = $ans['ERROR'];
}
else
{ {
if ($count > 0 && $count < 9999) $OK = getparam('OK', false);
$count = getparam('rows', false);
if ($OK == 'OK' && !nuem($count))
{ {
$settings = array(); if ($count > 0 && $count < 9999)
for ($i = 0; $i < $count; $i++)
{ {
$wn = urldecode(getparam('workername:'.$i, false)); $settings = array();
$md = getparam('difficultydefault:'.$i, false); for ($i = 0; $i < $count; $i++)
if (!nuem($wn) && !nuem($md))
{ {
$settings['workername:'.$i] = $wn; $wn = urldecode(getparam('workername:'.$i, false));
$settings['difficultydefault:'.$i] = $md; $md = getparam('difficultydefault:'.$i, false);
if (!nuem($wn) && !nuem($md))
{
$settings['workername:'.$i] = $wn;
$settings['difficultydefault:'.$i] = $md;
}
} }
$ans = workerSet($user, $settings);
if ($ans['STATUS'] != 'ok')
$err = $ans['ERROR'];
} }
$ans = workerSet($user, $settings);
if ($ans['STATUS'] != 'ok')
$err = $ans['ERROR'];
} }
} }

4
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.0" #define DB_VERSION "1.0.0"
#define CKDB_VERSION DB_VERSION"-1.042" #define CKDB_VERSION DB_VERSION"-1.043"
#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__
@ -801,6 +801,8 @@ extern K_STORE *useratts_store;
// This att means the user uses multiple % based payout addresses // This att means the user uses multiple % based payout addresses
#define USER_MULTI_PAYOUT "PayAddresses" #define USER_MULTI_PAYOUT "PayAddresses"
#define USER_OLD_WORKERS "OldWorkersDays"
#define USER_OLD_WORKERS_DEFAULT 7
// WORKERS // WORKERS
typedef struct workers { typedef struct workers {

325
src/ckdb_cmd.c

@ -408,16 +408,18 @@ struckout:
} }
static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now, static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now,
char *by, char *code, char *inet, char *by, char *code, char *inet, tv_t *cd,
__maybe_unused tv_t *notcd, K_TREE *trf_root) K_TREE *trf_root)
{ {
K_ITEM *i_username, *i_workername, *i_diffdef, *u_item, *w_item; K_ITEM *i_username, *i_workername, *i_diffdef, *i_oldworkers;
K_ITEM *u_item, *ua_item, *w_item;
HEARTBEATQUEUE *heartbeatqueue; HEARTBEATQUEUE *heartbeatqueue;
K_ITEM *hq_item; K_ITEM *hq_item;
char workername_buf[32]; // 'workername:' + digits char workername_buf[32]; // 'workername:' + digits
char diffdef_buf[32]; // 'difficultydefault:' + digits char diffdef_buf[32]; // 'difficultydefault:' + digits
char reply[1024] = ""; char reply[1024] = "";
size_t siz = sizeof(reply); size_t siz = sizeof(reply);
USERATTS *useratts;
WORKERS *workers; WORKERS *workers;
USERS *users; USERS *users;
int32_t difficultydefault; int32_t difficultydefault;
@ -448,6 +450,37 @@ static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now,
// Default answer if no problems // Default answer if no problems
answer = strdup("updated"); answer = strdup("updated");
i_oldworkers = optional_name(trf_root, "oldworkers",
1, NULL, reply, siz);
if (i_oldworkers) {
bool update = false;
int64_t new_ow = atol(transfer_data(i_oldworkers));
K_RLOCK(useratts_free);
ua_item = find_useratts(users->userid, USER_OLD_WORKERS);
K_RUNLOCK(useratts_free);
if (!ua_item) {
if (new_ow != USER_OLD_WORKERS_DEFAULT)
update = true;
} else {
DATA_USERATTS(useratts, ua_item);
if (new_ow != useratts->attnum)
update = true;
}
if (update) {
ua_item = useratts_add(conn, users->username,
USER_OLD_WORKERS, EMPTY,
EMPTY, EMPTY,
transfer_data(i_oldworkers),
EMPTY, EMPTY, EMPTY,
by, code, inet, cd,
trf_root, false);
if (!ua_item)
reason = "Invalid";
}
goto kazuki;
}
// Loop through the list of workers and do any changes // Loop through the list of workers and do any changes
for (workernum = 0; workernum < 9999; workernum++) { for (workernum = 0; workernum < 9999; workernum++) {
snprintf(workername_buf, sizeof(workername_buf), snprintf(workername_buf, sizeof(workername_buf),
@ -524,6 +557,7 @@ static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now,
} }
} }
kazuki:
struckout: struckout:
if (reason) { if (reason) {
if (answer) if (answer)
@ -1336,8 +1370,7 @@ static char *cmd_percent(char *cmd, char *id, tv_t *now, USERS *users)
DATA_WORKERS_NULL(workers, w_item); DATA_WORKERS_NULL(workers, w_item);
while (w_item && workers->userid == users->userid) { while (w_item && workers->userid == users->userid) {
if (CURRENT(&(workers->expirydate))) { if (CURRENT(&(workers->expirydate))) {
ws_item = find_workerstatus(users->userid, workers->workername, ws_item = get_workerstatus(users->userid, workers->workername);
__FILE__, __func__, __LINE__);
if (ws_item) { if (ws_item) {
DATA_WORKERSTATUS(workerstatus, ws_item); DATA_WORKERSTATUS(workerstatus, ws_item);
t_diffacc += workerstatus->diffacc; t_diffacc += workerstatus->diffacc;
@ -1520,10 +1553,13 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
WORKERS lookworkers, *workers; WORKERS lookworkers, *workers;
WORKERSTATUS *workerstatus; WORKERSTATUS *workerstatus;
USERSTATS *userstats; USERSTATS *userstats;
USERATTS *useratts;
USERS *users; USERS *users;
char reply[1024] = ""; char reply[1024] = "";
char tmp[1024]; char tmp[1024];
int64_t oldworkers = USER_OLD_WORKERS_DEFAULT;
size_t siz = sizeof(reply); size_t siz = sizeof(reply);
tv_t last_share;
char *buf; char *buf;
size_t len, off; size_t len, off;
bool stats, percent; bool stats, percent;
@ -1561,6 +1597,14 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
if (percent) if (percent)
return cmd_percent(cmd, id, now, users); return cmd_percent(cmd, id, now, users);
K_RLOCK(useratts_free);
ua_item = find_useratts(users->userid, USER_OLD_WORKERS);
K_RUNLOCK(useratts_free);
if (ua_item) {
DATA_USERATTS(useratts, ua_item);
oldworkers = useratts->attnum;
}
APPEND_REALLOC_INIT(buf, off, len); APPEND_REALLOC_INIT(buf, off, len);
APPEND_REALLOC(buf, off, len, "ok."); APPEND_REALLOC(buf, off, len, "ok.");
snprintf(tmp, sizeof(tmp), "blockacc=%.1f%c", snprintf(tmp, sizeof(tmp), "blockacc=%.1f%c",
@ -1569,6 +1613,13 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "blockreward=%"PRId64"%c", snprintf(tmp, sizeof(tmp), "blockreward=%"PRId64"%c",
pool.reward, FLDSEP); pool.reward, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "oldworkers=%"PRId64"%c",
oldworkers, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
if (oldworkers > 0)
oldworkers *= 24L * 60L * 60L;
else
oldworkers = now->tv_sec + 1;
INIT_WORKERS(&w_look); INIT_WORKERS(&w_look);
@ -1582,157 +1633,169 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
rows = 0; rows = 0;
while (w_item && workers->userid == users->userid) { while (w_item && workers->userid == users->userid) {
if (CURRENT(&(workers->expirydate))) { if (CURRENT(&(workers->expirydate))) {
str_to_buf(workers->workername, reply, sizeof(reply)); ws_item = get_workerstatus(users->userid, workers->workername);
snprintf(tmp, sizeof(tmp), "workername:%d=%s%c", rows, reply, FLDSEP); if (ws_item) {
APPEND_REALLOC(buf, off, len, tmp); DATA_WORKERSTATUS(workerstatus, ws_item);
K_RLOCK(workerstatus_free);
copy_tv(&last_share, &(workerstatus->last_share));
K_RUNLOCK(workerstatus_free);
} else
last_share.tv_sec = last_share.tv_usec = 0L;
if (tvdiff(now, &last_share) < oldworkers) {
str_to_buf(workers->workername, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "workername:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
int_to_buf(workers->difficultydefault, reply, sizeof(reply)); int_to_buf(workers->difficultydefault, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "difficultydefault:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "difficultydefault:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
str_to_buf(workers->idlenotificationenabled, reply, sizeof(reply)); str_to_buf(workers->idlenotificationenabled, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "idlenotificationenabled:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "idlenotificationenabled:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
int_to_buf(workers->idlenotificationtime, reply, sizeof(reply)); int_to_buf(workers->idlenotificationtime, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "idlenotificationtime:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "idlenotificationtime:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
if (stats) { if (stats) {
double w_hashrate5m, w_hashrate1hr; double w_hashrate5m, w_hashrate1hr;
double w_hashrate24hr; double w_hashrate24hr;
int64_t w_elapsed; int64_t w_elapsed;
tv_t w_lastshare; tv_t w_lastshare;
double w_lastdiff, w_diffacc, w_diffinv; double w_lastdiff, w_diffacc, w_diffinv;
double w_diffsta, w_diffdup; double w_diffsta, w_diffdup;
double w_diffhi, w_diffrej; double w_diffhi, w_diffrej;
double w_shareacc, w_shareinv; double w_shareacc, w_shareinv;
double w_sharesta, w_sharedup; double w_sharesta, w_sharedup;
double w_sharehi, w_sharerej; double w_sharehi, w_sharerej;
w_hashrate5m = w_hashrate1hr = w_hashrate5m = w_hashrate1hr =
w_hashrate24hr = 0.0; w_hashrate24hr = 0.0;
w_elapsed = -1; w_elapsed = -1;
w_lastshare.tv_sec = 0;
w_lastdiff = w_diffacc = w_diffinv = if (!ws_item) {
w_diffsta = w_diffdup = w_lastshare.tv_sec = 0;
w_diffhi = w_diffrej = w_lastdiff = w_diffacc = w_diffinv =
w_shareacc = w_shareinv = w_diffsta = w_diffdup =
w_sharesta = w_sharedup = w_diffhi = w_diffrej =
w_sharehi = w_sharerej = 0; w_shareacc = w_shareinv =
w_sharesta = w_sharedup =
ws_item = find_workerstatus(users->userid, workers->workername, w_sharehi = w_sharerej = 0;
__FILE__, __func__, __LINE__); } else {
if (ws_item) { DATA_WORKERSTATUS(workerstatus, ws_item);
DATA_WORKERSTATUS(workerstatus, ws_item); // It's bad to read possibly changing data
w_lastshare.tv_sec = workerstatus->last_share.tv_sec; K_RLOCK(workerstatus_free);
w_lastdiff = workerstatus->last_diff; w_lastshare.tv_sec = workerstatus->last_share.tv_sec;
w_diffacc = workerstatus->diffacc; w_lastdiff = workerstatus->last_diff;
w_diffinv = workerstatus->diffinv; w_diffacc = workerstatus->diffacc;
w_diffsta = workerstatus->diffsta; w_diffinv = workerstatus->diffinv;
w_diffdup = workerstatus->diffdup; w_diffsta = workerstatus->diffsta;
w_diffhi = workerstatus->diffhi; w_diffdup = workerstatus->diffdup;
w_diffrej = workerstatus->diffrej; w_diffhi = workerstatus->diffhi;
w_shareacc = workerstatus->shareacc; w_diffrej = workerstatus->diffrej;
w_shareinv = workerstatus->shareinv; w_shareacc = workerstatus->shareacc;
w_sharesta = workerstatus->sharesta; w_shareinv = workerstatus->shareinv;
w_sharedup = workerstatus->sharedup; w_sharesta = workerstatus->sharesta;
w_sharehi = workerstatus->sharehi; w_sharedup = workerstatus->sharedup;
w_sharerej = workerstatus->sharerej; w_sharehi = workerstatus->sharehi;
} w_sharerej = workerstatus->sharerej;
K_RUNLOCK(workerstatus_free);
}
/* TODO: workers_root userid+worker is ordered /* TODO: workers_root userid+worker is ordered
* so no 'find' should be needed - * so no 'find' should be needed -
* just cmp to last 'unused us_item' userid+worker * just cmp to last 'unused us_item' userid+worker
* then step it forward to be the next ready 'unused' */ * then step it forward to be the next ready 'unused' */
K_RLOCK(userstats_free); K_RLOCK(userstats_free);
us_item = find_userstats(users->userid, workers->workername); us_item = find_userstats(users->userid, workers->workername);
if (us_item) { if (us_item) {
DATA_USERSTATS(userstats, us_item); DATA_USERSTATS(userstats, us_item);
if (tvdiff(now, &(userstats->statsdate)) < USERSTATS_PER_S) { if (tvdiff(now, &(userstats->statsdate)) < USERSTATS_PER_S) {
w_hashrate5m += userstats->hashrate5m; w_hashrate5m += userstats->hashrate5m;
w_hashrate1hr += userstats->hashrate1hr; w_hashrate1hr += userstats->hashrate1hr;
w_hashrate24hr += userstats->hashrate24hr; w_hashrate24hr += userstats->hashrate24hr;
if (w_elapsed == -1 || w_elapsed > userstats->elapsed) if (w_elapsed == -1 || w_elapsed > userstats->elapsed)
w_elapsed = userstats->elapsed; w_elapsed = userstats->elapsed;
}
} }
} K_RUNLOCK(userstats_free);
K_RUNLOCK(userstats_free);
double_to_buf(w_hashrate5m, reply, sizeof(reply)); double_to_buf(w_hashrate5m, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_hashrate5m:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_hashrate5m:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_hashrate1hr, reply, sizeof(reply)); double_to_buf(w_hashrate1hr, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_hashrate1hr:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_hashrate1hr:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_hashrate24hr, reply, sizeof(reply)); double_to_buf(w_hashrate24hr, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_hashrate24hr:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_hashrate24hr:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
bigint_to_buf(w_elapsed, reply, sizeof(reply)); bigint_to_buf(w_elapsed, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_elapsed:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_elapsed:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
int_to_buf((int)(w_lastshare.tv_sec), reply, sizeof(reply)); int_to_buf((int)(w_lastshare.tv_sec), reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_lastshare:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_lastshare:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_lastdiff, reply, sizeof(reply)); double_to_buf(w_lastdiff, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_lastdiff:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_lastdiff:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffacc, reply, sizeof(reply)); double_to_buf(w_diffacc, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffacc:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffacc:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffinv, reply, sizeof(reply)); double_to_buf(w_diffinv, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffinv:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffinv:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffsta, reply, sizeof(reply)); double_to_buf(w_diffsta, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffsta:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffsta:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffdup, reply, sizeof(reply)); double_to_buf(w_diffdup, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffdup:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffdup:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffhi, reply, sizeof(reply)); double_to_buf(w_diffhi, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffhi:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffhi:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_diffrej, reply, sizeof(reply)); double_to_buf(w_diffrej, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_diffrej:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_diffrej:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_shareacc, reply, sizeof(reply)); double_to_buf(w_shareacc, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_shareacc:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_shareacc:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_shareinv, reply, sizeof(reply)); double_to_buf(w_shareinv, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_shareinv:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_shareinv:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharesta, reply, sizeof(reply)); double_to_buf(w_sharesta, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharesta:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_sharesta:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharedup, reply, sizeof(reply)); double_to_buf(w_sharedup, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharedup:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_sharedup:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharehi, reply, sizeof(reply)); double_to_buf(w_sharehi, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharehi:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_sharehi:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
double_to_buf(w_sharerej, reply, sizeof(reply)); double_to_buf(w_sharerej, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "w_sharerej:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "w_sharerej:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
}
rows++;
} }
rows++;
} }
w_item = next_in_ktree(w_ctx); w_item = next_in_ktree(w_ctx);
DATA_WORKERS_NULL(workers, w_item); DATA_WORKERS_NULL(workers, w_item);

Loading…
Cancel
Save