diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-10-18 00:19:00 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-10-18 00:19:00 +0800 |
commit | 720ae25981607a50cbcb127c47d8663c4403785b (patch) | |
tree | 2b8ccd47421e49144ef88487e05aeba1a20e155e /mbbsd | |
parent | 5dd1b69630a1614dd3cf7705c254e3f68d2a498d (diff) | |
download | pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar.gz pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar.bz2 pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar.lz pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar.xz pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.tar.zst pttbbs-720ae25981607a50cbcb127c47d8663c4403785b.zip |
Add data and stack size display for linux
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3225 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/cal.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 30e02166..4cab90f9 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -460,15 +460,35 @@ p_sysinfo(void) compile_time, ctime4(&start_time)); if (HasUserPerm(PERM_SYSOP)) { struct rusage ru; +#ifdef __linux__ + int vmdata=0, vmstk=0; + { + FILE * fp; + char buf[128]; + if ((fp = fopen("/proc/self/status", "r"))) { + while (fgets(buf, 128, fp) && vmdata==0 && vmstk==0) { + sscanf(buf, "VmData: %d", &vmdata); + sscanf(buf, "VmStk: %d", &vmstk); + } + fclose(fp); + } + } +#endif getrusage(RUSAGE_SELF, &ru); prints("記憶體用量: " #ifdef IA32 "sbrk: %d KB, " #endif +#ifdef __linux__ + "VmData: %d KB, VmStk: %d KB, " +#endif "idrss: %d KB, isrss: %d KB\n", #ifdef IA32 ((int)sbrk(0) - 0x8048000) / 1024, #endif +#ifdef __linux__ + vmdata, vmstk, +#endif (int)ru.ru_idrss, (int)ru.ru_isrss); prints("CPU 用量: %ld.%06ldu %ld.%06lds", ru.ru_utime.tv_sec, ru.ru_utime.tv_usec, |