/*
- * $Id: cache_cf.cc,v 1.248 1998/02/19 23:09:47 wessels Exp $
+ * $Id: cache_cf.cc,v 1.249 1998/02/19 23:28:38 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static size_t parseBytesUnits(const char *unit);
static void free_all(void);
static void requirePathnameExists(const char *name, const char *path);
+static OBJH dump_config;
static void
self_destruct(void)
/*
- * $Id: mem.cc,v 1.4 1998/02/19 23:09:54 wessels Exp $
+ * $Id: mem.cc,v 1.5 1998/02/19 23:28:39 wessels Exp $
*
* DEBUG: section 13 Memory Pool Management
* AUTHOR: Harvest Derived
static memData MemData[MEM_MAX];
+static void * stackPop(Stack * s);
+static int stackFull(Stack * s);
+static int stackEmpty(Stack * s);
+static void stackPush(Stack * s, void *p);
+static void memDataInit(mem_type , const char *, size_t , int );
+static OBJH memStats;
+
static int
stackEmpty(Stack * s)
{
}
}
-void
+static void
memStats(StoreEntry * sentry)
{
mem_type t;
/*
- * $Id: neighbors.cc,v 1.175 1998/02/19 23:09:55 wessels Exp $
+ * $Id: neighbors.cc,v 1.176 1998/02/19 23:28:40 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
static void peerCountMcastPeersSchedule(peer * p, time_t when);
static IRCB peerCountHandleIcpReply;
static void neighborIgnoreNonPeer(const struct sockaddr_in *, icp_opcode);
+static OBJH neighborDumpPeers;
+static OBJH neighborDumpNonPeers;
+static void dump_peers(StoreEntry * sentry, peer * peers);
static icp_common_t echo_hdr;
static u_short echo_port;
echo_port = sep ? ntohs((u_short) sep->s_port) : 7;
}
first_ping = Config.peers;
+ cachemgrRegister("server_list",
+ "Peer Cache Statistics",
+ neighborDumpPeers, 0);
cachemgrRegister("non_peers",
"List of Unknown sites sending ICP messages",
neighborDumpNonPeers, 0);
np->stats.ignored_replies, np->host);
}
-void
-neighborDumpNonPeers(StoreEntry * sentry)
-{
- dump_peers(sentry, non_peers);
-}
-
/* ignoreMulticastReply
*
* We want to ignore replies from multicast peers if the
ps_state *psstate = data;
psstate->icp.n_recv++;
}
+
+static void
+neighborDumpPeers(StoreEntry * sentry)
+{
+ dump_peers(sentry, Config.peers);
+}
+
+static void
+neighborDumpNonPeers(StoreEntry * sentry)
+{
+ dump_peers(sentry, non_peers);
+}
+
+static void
+dump_peers(StoreEntry * sentry, peer * peers)
+{
+ peer *e = NULL;
+ struct _domain_ping *d = NULL;
+ icp_opcode op;
+ if (peers == NULL)
+ storeAppendPrintf(sentry, "There are no neighbors installed.\n");
+ for (e = peers; e; e = e->next) {
+ assert(e->host != NULL);
+ storeAppendPrintf(sentry, "\n%-11.11s: %s/%d/%d\n",
+ neighborTypeStr(e),
+ e->host,
+ e->http_port,
+ e->icp_port);
+ storeAppendPrintf(sentry, "Status : %s\n",
+ neighborUp(e) ? "Up" : "Down");
+ storeAppendPrintf(sentry, "AVG RTT : %d msec\n", e->stats.rtt);
+ storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n",
+ (int) (squid_curtime - e->stats.last_query));
+ storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n",
+ (int) (squid_curtime - e->stats.last_reply));
+ storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent);
+ storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n",
+ e->stats.pings_acked,
+ percent(e->stats.pings_acked, e->stats.pings_sent));
+ storeAppendPrintf(sentry, "FETCHES : %8d %3d%%\n",
+ e->stats.fetches,
+ percent(e->stats.fetches, e->stats.pings_acked));
+ storeAppendPrintf(sentry, "IGNORED : %8d %3d%%\n",
+ e->stats.ignored_replies,
+ percent(e->stats.ignored_replies, e->stats.pings_acked));
+ storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
+ for (op = ICP_INVALID; op < ICP_END; op++) {
+ if (e->stats.counts[op] == 0)
+ continue;
+ storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n",
+ icp_opcode_str[op],
+ e->stats.counts[op],
+ percent(e->stats.counts[op], e->stats.pings_acked));
+ }
+ if (e->last_fail_time) {
+ storeAppendPrintf(sentry, "Last failed connect() at: %s\n",
+ mkhttpdlogtime(&(e->last_fail_time)));
+ }
+ if (e->pinglist != NULL)
+ storeAppendPrintf(sentry, "DOMAIN LIST: ");
+ for (d = e->pinglist; d; d = d->next) {
+ if (d->do_ping)
+ storeAppendPrintf(sentry, "%s ", d->domain);
+ else
+ storeAppendPrintf(sentry, "!%s ", d->domain);
+ }
+ storeAppendPrintf(sentry, "Keep-Alive Ratio: %d%%\n",
+ percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
+ }
+}
/*
- * $Id: pconn.cc,v 1.11 1998/02/19 23:09:57 wessels Exp $
+ * $Id: pconn.cc,v 1.12 1998/02/19 23:28:40 wessels Exp $
*
* DEBUG: section 48 Persistent Connections
* AUTHOR: Duane Wessels
int nfds;
};
+#define PCONN_HIST_SZ 256
+int client_pconn_hist[PCONN_HIST_SZ];
+int server_pconn_hist[PCONN_HIST_SZ];
+
static PF pconnRead;
static PF pconnTimeout;
static const char *pconnKey(const char *host, u_short port);
static struct _pconn *pconnNew(const char *key);
static void pconnDelete(struct _pconn *p);
static void pconnRemoveFD(struct _pconn *p, int fd);
-
+static OBJH pconnHistDump;
static const char *
pconnKey(const char *host, u_short port)
void
pconnInit(void)
{
+ int i;
assert(table == NULL);
table = hash_create((HASHCMP *) strcmp, 229, hash_string);
+ for (i = 0; i < PCONN_HIST_SZ; i++) {
+ client_pconn_hist[i] = 0;
+ server_pconn_hist[i] = 0;
+ }
cachemgrRegister("pconn",
"Persistent Connection Utilization Histograms",
pconnHistDump, 0);
}
return fd;
}
+
+void
+pconnHistCount(int what, int i)
+{
+ if (i >= PCONN_HIST_SZ)
+ i = PCONN_HIST_SZ - 1;
+ /* what == 0 for client, 1 for server */
+ if (what == 0)
+ client_pconn_hist[i]++;
+ else if (what == 1)
+ server_pconn_hist[i]++;
+ else
+ assert(0);
+}
+
+static void
+pconnHistDump(StoreEntry * e)
+{
+ int i;
+ storeAppendPrintf(e,
+ "Client-side persistent connection counts:\n"
+ "\n"
+ "\treq/\n"
+ "\tconn count\n"
+ "\t---- ---------\n");
+ for (i = 0; i < PCONN_HIST_SZ; i++) {
+ if (client_pconn_hist[i] == 0)
+ continue;
+ storeAppendPrintf(e, "\t%4d %9d\n", i, client_pconn_hist[i]);
+ }
+ storeAppendPrintf(e,
+ "\n"
+ "Server-side persistent connection counts:\n"
+ "\n"
+ "\treq/\n"
+ "\tconn count\n"
+ "\t---- ---------\n");
+ for (i = 0; i < PCONN_HIST_SZ; i++) {
+ if (server_pconn_hist[i] == 0)
+ continue;
+ storeAppendPrintf(e, "\t%4d %9d\n", i, server_pconn_hist[i]);
+ }
+}
extern void peerDestroy(peer * e);
extern char *neighborTypeStr(const peer * e);
extern void peerCheckConnectStart(peer *);
+extern void dump_peers(StoreEntry *, peer *);
extern void netdbInit(void);
extern void memFree8K(void *);
extern void memFreeDISK(void *);
extern int memInUse(mem_type);
-extern OBJH memStats;
extern int stmemFreeDataUpto(mem_hdr *, int);
extern void stmemAppend(mem_hdr *, const char *, int);
extern int storeDirWriteCleanLogs(int reopen);
extern int storeDirValidFileno(int fn);
extern int storeFilenoBelongsHere(int, int, int, int);
+extern OBJH storeDirStats;
/*
extern void errorFree(void);
extern ErrorState *errorCon(err_type, http_status);
-extern OBJH stat_io_get;
-extern OBJH stat_objects_get;
-extern OBJH stat_vmobjects_get;
-extern OBJH stat_utilization_get;
-extern OBJH statFiledescriptors;
-extern OBJH log_enable;
-extern OBJH info_get;
-extern OBJH server_list;
-extern OBJH neighborDumpNonPeers;
-extern OBJH dump_config;
-extern OBJH storeDirStats;
-extern OBJH pconnHistDump;
-extern void dump_peers(StoreEntry *, peer *);
-extern OBJH statCounters;
-extern OBJH statAvg5min;
-extern OBJH statAvg60min;
-
extern void pconnPush(int, const char *host, u_short port);
extern int pconnPop(const char *host, u_short port);
extern void pconnInit(void);
/*
- * $Id: stat.cc,v 1.201 1998/02/19 23:10:00 wessels Exp $
+ * $Id: stat.cc,v 1.202 1998/02/19 23:28:42 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
static double statLogHistVal(StatLogHist *, double);
static double statLogHistDeltaMedian(StatLogHist * A, StatLogHist * B);
static void statLogHistDump(StoreEntry * sentry, StatLogHist * H);
+static OBJH stat_io_get;
+static OBJH stat_objects_get;
+static OBJH stat_vmobjects_get;
+static OBJH info_get;
+static OBJH statFiledescriptors;
+static OBJH statCounters;
+static OBJH statAvg5min;
+static OBJH statAvg60min;
#ifdef XMALLOC_STATISTICS
static void info_get_mallstat(int, int, StoreEntry *);
#endif
-#define PCONN_HIST_SZ 256
-int client_pconn_hist[PCONN_HIST_SZ];
-int server_pconn_hist[PCONN_HIST_SZ];
-
/*
* An hour's worth, plus the 'current' counter
*/
statObjects(e, 1);
}
-void
-server_list(StoreEntry * sentry)
-{
- dump_peers(sentry, Config.peers);
-}
-
-void
-dump_peers(StoreEntry * sentry, peer * peers)
-{
- peer *e = NULL;
- struct _domain_ping *d = NULL;
- icp_opcode op;
- if (peers == NULL)
- storeAppendPrintf(sentry, "There are no neighbors installed.\n");
- for (e = peers; e; e = e->next) {
- assert(e->host != NULL);
- storeAppendPrintf(sentry, "\n%-11.11s: %s/%d/%d\n",
- neighborTypeStr(e),
- e->host,
- e->http_port,
- e->icp_port);
- storeAppendPrintf(sentry, "Status : %s\n",
- neighborUp(e) ? "Up" : "Down");
- storeAppendPrintf(sentry, "AVG RTT : %d msec\n", e->stats.rtt);
- storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n",
- (int) (squid_curtime - e->stats.last_query));
- storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n",
- (int) (squid_curtime - e->stats.last_reply));
- storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent);
- storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n",
- e->stats.pings_acked,
- percent(e->stats.pings_acked, e->stats.pings_sent));
- storeAppendPrintf(sentry, "FETCHES : %8d %3d%%\n",
- e->stats.fetches,
- percent(e->stats.fetches, e->stats.pings_acked));
- storeAppendPrintf(sentry, "IGNORED : %8d %3d%%\n",
- e->stats.ignored_replies,
- percent(e->stats.ignored_replies, e->stats.pings_acked));
- storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
- for (op = ICP_INVALID; op < ICP_END; op++) {
- if (e->stats.counts[op] == 0)
- continue;
- storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n",
- icp_opcode_str[op],
- e->stats.counts[op],
- percent(e->stats.counts[op], e->stats.pings_acked));
- }
- if (e->last_fail_time) {
- storeAppendPrintf(sentry, "Last failed connect() at: %s\n",
- mkhttpdlogtime(&(e->last_fail_time)));
- }
- if (e->pinglist != NULL)
- storeAppendPrintf(sentry, "DOMAIN LIST: ");
- for (d = e->pinglist; d; d = d->next) {
- if (d->do_ping)
- storeAppendPrintf(sentry, "%s ", d->domain);
- else
- storeAppendPrintf(sentry, "!%s ", d->domain);
- }
- storeAppendPrintf(sentry, "Keep-Alive Ratio: %d%%\n",
- percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
- }
-}
-
#ifdef XMALLOC_STATISTICS
static void
info_get_mallstat(int size, int number, StoreEntry * sentry)
{
int i;
debug(18, 5) ("statInit: Initializing...\n");
- for (i = 0; i < PCONN_HIST_SZ; i++) {
- client_pconn_hist[i] = 0;
- server_pconn_hist[i] = 0;
- }
memset(CountHist, '\0', N_COUNT_HIST * sizeof(StatCounters));
for (i = 0; i < N_COUNT_HIST; i++)
statCounterInit(&CountHist[i]);
cachemgrRegister("60min",
"60 Minute Average of Counters",
statAvg60min, 0);
- cachemgrRegister("server_list",
- "Neighbor Cache Stats",
- server_list, 0);
-}
-
-void
-pconnHistCount(int what, int i)
-{
- if (i >= PCONN_HIST_SZ)
- i = PCONN_HIST_SZ - 1;
- /* what == 0 for client, 1 for server */
- if (what == 0)
- client_pconn_hist[i]++;
- else if (what == 1)
- server_pconn_hist[i]++;
- else
- assert(0);
-}
-
-void
-pconnHistDump(StoreEntry * e)
-{
- int i;
- storeAppendPrintf(e,
- "Client-side persistent connection counts:\n"
- "\n"
- "\treq/\n"
- "\tconn count\n"
- "\t---- ---------\n");
- for (i = 0; i < PCONN_HIST_SZ; i++) {
- if (client_pconn_hist[i] == 0)
- continue;
- storeAppendPrintf(e, "\t%4d %9d\n", i, client_pconn_hist[i]);
- }
- storeAppendPrintf(e,
- "\n"
- "Server-side persistent connection counts:\n"
- "\n"
- "\treq/\n"
- "\tconn count\n"
- "\t---- ---------\n");
- for (i = 0; i < PCONN_HIST_SZ; i++) {
- if (server_pconn_hist[i] == 0)
- continue;
- storeAppendPrintf(e, "\t%4d %9d\n", i, server_pconn_hist[i]);
- }
}
static void