Browse Source

ckdb/php - add a 'sync' value to the page footer - shows how many outstanding socket requests have been queued

master
kanoi 10 years ago
parent
commit
6abe2a418a
  1. 19
      pool/page.php
  2. 2
      src/ckdb.h
  3. 4
      src/ckdb_cmd.c

19
pool/page.php

@ -137,6 +137,8 @@ h1 {margin-top: 20px; float:middle; font-size: 20px;}
.st1 {color:red; font-weight:bold; }
.st2 {color:green; font-weight:bold; }
.st3 {color:blue; font-weight:bold; }
.fthi {color:red; font-size:7px; }
.ftlo {color:green; font-size:7px; }
.ft {color:blue; font-size:7px; }
</style>\n";
@ -420,14 +422,25 @@ function pgbody($info, $page, $menu, $dotop, $user, $douser)
return $body;
}
#
function pgfoot()
function pgfoot($info)
{
$foot = '</div></td></tr>';
$foot .= '</table>';
$foot .= '</center></td></tr>';
$foot .= '</table>';
$foot .= '<div class=push></div></div>';
$foot .= '<div class=foot><br>Copyright &copy; Kano 2014';
$foot .= '<div class=foot><br>';
if (is_array($info) && isset($info['sync']))
{
$sync = $info['sync'];
if ($sync > 1000)
$syc = 'hi';
else
$syc = 'lo';
$syncd = number_format($sync);
$foot .= "<span class=ft$syc>sync: $syncd</span> ";
}
$foot .= 'Copyright &copy; Kano 2014';
$now = date('Y');
if ($now != '2014')
$foot .= "-$now";
@ -466,7 +479,7 @@ function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = tr
$head = pghead($script_marker, $name);
$body = pgbody($info, $page, $menu, $dotop, $user, $douser);
$foot = pgfoot();
$foot = pgfoot($info);
if ($dbg === true)
$pg = str_replace($dbg_marker, cvtdbg(), $pg);

2
src/ckdb.h

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

4
src/ckdb_cmd.c

@ -2618,6 +2618,10 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
APPEND_REALLOC(buf, off, len, tmp);
}
// Don't bother with locking - it's just an FYI web stat
snprintf(tmp, sizeof(tmp), "sync=%d%c", workqueue_store->count, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
u_item = NULL;
if (i_username) {
K_RLOCK(users_free);

Loading…
Cancel
Save