summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:02:47 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:02:47 +0800
commit60b3015900838f0afbf3377fc3a75351be510cbe (patch)
tree4488111bc74655ed46406290bd982fa68c38a8d1 /include
parent5fdde9d65d7664bcff62833304144a26b2f74e30 (diff)
downloadpttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar.gz
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar.bz2
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar.lz
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar.xz
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.tar.zst
pttbbs-60b3015900838f0afbf3377fc3a75351be510cbe.zip
statistic
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2651 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include')
-rw-r--r--include/bbs.h1
-rw-r--r--include/pttstruct.h5
-rw-r--r--include/statistic.h36
3 files changed, 41 insertions, 1 deletions
diff --git a/include/bbs.h b/include/bbs.h
index fb65c3e0..34a878b0 100644
--- a/include/bbs.h
+++ b/include/bbs.h
@@ -44,6 +44,7 @@ typedef uint32_t time4_t;
#else
typedef time_t time4_t;
#endif
+#include "statistic.h"
#include "pttstruct.h"
#include "fav.h"
#include "common.h"
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 23fda808..5bcf81f3 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -542,7 +542,7 @@ typedef struct {
/* SHM 中的全域變數, 可用 shmctl 設定或顯示. 供動態調整或測試使用 */
union {
- int v[1024];
+ int v[512];
struct {
int dymaxactive; /* 動態設定最大人數上限 */
int toomanyusers; /* 超過人數上限不給進的個數 */
@@ -551,9 +551,12 @@ typedef struct {
time4_t now;
#endif
int nWelcomes;
+
/* 注意, 應保持 align sizeof(int) */
} e;
} GV2;
+ /* statistic */
+ int statistic[STAT_MAX];
/* 故鄉 fromcache */
unsigned int home_ip[MAX_FROM];
diff --git a/include/statistic.h b/include/statistic.h
new file mode 100644
index 00000000..e2e6b61b
--- /dev/null
+++ b/include/statistic.h
@@ -0,0 +1,36 @@
+#ifndef _STATISTIC_H_
+#define _STATISTIC_H_
+#define STAT(X, OP) do { \
+ if(SHM && SHM->version==SHM_VERSION && 0<=(X) && (X)<STAT_MAX) \
+ SHM->statistic[X] OP; \
+} while(0)
+#define STATINC(X) STAT(X, ++)
+
+enum { // XXX description in shmctl.c
+ STAT_LOGIN,
+ STAT_SHELLLOGIN,
+ STAT_VEDIT,
+ STAT_TALKREQUEST,
+ STAT_WRITEREQUEST,
+ STAT_MORE,
+ STAT_SYSWRITESOCKET,
+ STAT_SYSSELECT,
+ STAT_SYSREADSOCKET,
+ STAT_DOSEND,
+ STAT_SEARCHUSER,
+ STAT_THREAD,
+ STAT_SELECTREAD,
+ STAT_QUERY,
+ STAT_DOTALK,
+ STAT_FRIENDDESC,
+ STAT_FRIENDDESC_FILE,
+ STAT_PICKMYFRIEND,
+ STAT_PICKBFRIEND,
+ STAT_GAMBLE,
+ STAT_DOPOST,
+ STAT_READPOST,
+ STAT_RECOMMEND,
+ STAT_NUM,
+ STAT_MAX=512
+};
+#endif