From: katsu@sran14.sra.co.jp (WATANABE katsuhiro)
Newsgroups: fj.unix,fj.sys.news
Subject: Re: Q. about /etc/pstat
Date: 17 Nov 92 07:23:23 GMT
	<KATSU.92Sep15184100@sran14.sra.co.jp>
	<IMAGE.92Oct6142309@anavrin.cs.titech.ac.jp>
Followup-To: fj.unix
Distribution: fj
Organization: Software Research Associates, Inc.,Japan
In-reply-to: image@cs.titech.ac.jp's message of 6 Oct 92 05:23:08 GMT

$B!J(BNewsgroups: $B$KCm0U!K(B
$B%U%)%m!<$NCY$5$J$i(B jp $B$G==;X$K$O$$$k$G$"$m$&EOn4!w#S#R#A$G$9!#(B

$B5-;v(B <IMAGE.92Oct6142309@anavrin.cs.titech.ac.jp> $B$G(B
image@cs.titech.ac.jp (Takashi Imaizumi) $B$5$s$$$O$/(B
>    > $B!J#4!K$^$H(B$B$a!J(Bpstat -x $B$N8+J}$K4X$9$k(B tips$B!K(B
>
> 	$B$H$$$&$3$H$G!"(B/etc/pstat$B$N=PNO$N8+J}$K4X$7$F$O$3$N5-;v$G8=;~E@(B
> 	$B$G==J,$JCN<1$rF@$k$3$H$,$G$-$^$7$?!#(B

$B!!@^3Q$G$9$+$i!"(Bvmstat -s $B$H$N4X78$d%U%i%0$K$D$$$F$N5DO@$b$7(B$B$^$7$g$&$h!#(B
4.3BSD $B$KM3Mh$9$k(B OS $B$K$D$$$F!"%=!<%9$r8+$:$K$o$+$C$?HO0O$G=q$-$^$9!#(B

[1] $B%F%-%9%H9=B$BN(B$B$N%U%i%0$H(B pstat -x $B$K$D$$$F(B
$B!!(Bpstat -x $B$GIaCJD>@\8+$($k%U%i%0$O(B P $B$H(B W $B$@$H;W$$$^$9!#(BP $B$O(B
XPAGV $B$r!"(BW $B$O(B XWRIT $B$r(B (cf. <sys/text.h>) $B<($7$F$$$^$9!#(B

$B!!(BXPAGV $B$O!"IaDL$N(B BSD $B$G$O(B magic number $B$,(B ZMAGIC (cf. <sys/exec.h>)
$B$+$I$&$+$rH?1G$7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D$$(B$B$F(B
$B!!$5$F!"%F%-%9%H9=B$BN$N%U%i%0$N0UL#$rM}2r$9$k$3$H$G$O$8$a$F(B
vmstat -s $B$N0UL#$b$o$+$k$h$&$K$J$j$^$9(B$B!#(B

$B!!(Bvmstat -s $B$O(B sum $B9=B$BN(B (cf. vmstat(8), <sys/vmmeter.h>) $B$K2C$($F!"(B
xstats $B9=B$BN(B (cf.<sys/text.h>) $B$NFbMF$bI=<($7$F$/$l$^$9!#:G8e$N(B
$B#39T$0$i$$$G!"(B
      AAAA total calls to xalloc (cache hits BB%)
          sticky CCCC flushed DDDD unused EEEE
      FFFF total calls to xfree (sticky GGGG cached HHHH swapped IIII)
$B$N$h$&$K=PNO$5$l$k$N$,$=$l$G$9$,!"FI$_J}$,%^%K%e%"%k$K$O=q$$$F$$$J$$(B
$B$h$&$J$N$G!"$3(B$B$3$K>R2p$7$^$9!#(B
$B!!Bg$-$/J,$1$F!"(BAAAA $B$+$i(B EEEE $B$O%F%-%9%H%(%s%H%j!<$r3d$jEv$F$h$&$H(B
$B$7$?$H$-$NE}7W!"(B$B;D$j$O2rJ|$7$h$&$H$7$?$H$-$NE}7W$K$J$C$F$$$^$9!#(B

(1) AAAA : xstats $B9=B$BN$NCf$N%a%s%P!<(B alloc
$B!!%F%-(B$B%9%H%(%s%H%j!<$r3d$jEv$F$h$&$H$7$?!"$b$7$/$OA\$7$@$=$&$H$7$?(B
$B2s?t!#(BNMAGIC $B$b$7$/$O(B ZMAGIC $B$N%3%^%s%I$K(B$BBP$7$F(B execve(2) $B$,8F$P$l$?(B
$B2s?t$KEy$7$$$H;W$o$l$k!#(B

(2) BB : 100 * xstats.alloc_cachehit / xstats.alloc
$B!!%F%-%9%H%(%s%H%j!<$r3d$jEv$F$k!"$b$7$/$OA\$9$H$-$K!"5a$a$k(B
$B%F%-%9%H$,%F!<%V%kCf$K%-%c%C%7%e$H$7(B$B$FB8:_$7$F$$$?3d9g!#(B

(3) CCCC : xstats.alloc_inuse
$B!!5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?J,$O%-%c%C%7%e$KF~$i$:(B not used $B$J%(%s%H%j!<(B
$B$K$J$k!#$3$&$7$?>l9g$b(B free_cache $B$OA}$($J$$!#(B
$B!!(B_maxtextcache $B$,==J,Bg$-$/!"$^$?<B(B$B9T%U%!%$%k$,(B unlink $B$5$l$J$$(B
$B>u672<$G$O!"(Bxstats.free_inuse + xstats.free_cache = xstats.free $B$H(B
$B$J$k$O(B$B$:$G$"$k!#(B

(9) IIII : xstats.free_cacheswap
$B!!(B(8) $B$N>l9g$N$h$&$K%F%-%9%H%(%s%H%j!<$,%-%c%C%7%e$K$J$k(B$B$H$-!"(B
$B$=$N%(%s%H%j!<$N(B XWRIT $B$,%;%C%H$5$l$F$$$?$?$a$K%F%-%9%H%$%a!<%8$,(B
swap out $B$5$l$?2s?t!#(B
$B!!Nc$((B$B$P$$$^!"%3%^%s%I(B ct $B$N%F%-%9%H$,:#$^$G<B9T$5$l$?$3$H$,$J$/$F(B
$B%-%c%C%7%e$KF~$C$F$$$J$+$C$?$H$9$k!#$3$N(B$B$H$-(B ct $B$r#12s5/F0$7$F(B
swap out $B$,#1EY$b5/$-$J$$$&$A$K=*N;$9$k$H!"(Bct $B$N%F%-%9%H%$%a!<%8$,(B
swap out $B$5(B$B$l$k$N$G!"(Bxstats.free_cacheswap $B$OA}2C$9$k$3$H$K$J$k!#(B
$B$7$+$7!"0z$-B3$$$F!J$"$^$j4V3V$rCV$+$:$K!K:FEY(B ct $B$r5/F0$7$F(B
$B=*N;$7$F$b!"$3$N%+%&%s%?!<$OA}2C$7$J$$!#(B


[3] NEWS-OS 4.2 $B$NFC<l@-(B
$B!!(BNEWS-OS $B$N(B 4.1 $B$^(B$B$G$K$O(B [1][2] $B$NCN<1$,$h$/$"$F$O$^$j$^$9$,!"(B
4.2 $B$G$O;v>p$,>/$70c$$$^$9!#$o$+$C$F$$$kHO0O$G0c$$$r%a%b(B$B$7$F(B
$B$*$-$^$9!#!J;d$OIaCJ(B NEWS-830 $B$G(B NEWS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