Date: Fri, 17 Mar 1995 14:00:42 -0500 From: Garrett Wollman <wollman@halloran-eldar.lcs.mit.edu> To: Lars Koeller <uphya001@odie.physik2.uni-rostock.de> Cc: questions@freefall.cdrom.com Subject: NFS stats (was: Re: ANNOUNCING: xperfmon++ for FreeBSD-2.X) Message-ID: <9503171900.AA23275@halloran-eldar.lcs.mit.edu> In-Reply-To: <199503170809.JAA01097@odie.physik2.uni-rostock.de> References: <markd@grizzly.com> <199503170809.JAA01097@odie.physik2.uni-rostock.de>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Fri, 17 Mar 1995 09:09:37 +0100, Lars Koeller  <uphya001@odie.physik2.uni-rostock.de> said:
>    Hello!
> |> On FreeBSD 2.0, I don't have NFS configured into the kernel, so I get the 
> |> error:
> |>   vmstat: undefined symbols: _nfsstats 
	
>    Thanks, I try to fix it.
For recent versions of FreeBSD, the correct way to get NFS statistics
is to read the fs.nfs group statistics MIB variable, as the `nfsstats'
program does.
/*
 * Read the nfs stats using sysctl(3) for live kernels, or kvm_read
 * for dead ones.
 */
void
readstats(struct nfsstats *stp)
{
        if(deadkernel) {
                if(kvm_read(kd, (u_long)nl[N_NFSSTAT].n_value, stp,
                            sizeof *stp) < 0) {
                        err(1, "kvm_read");
                }
        } else {
                int name[3];
                size_t buflen = sizeof *stp;
                name[0] = CTL_FS;
                name[1] = MOUNT_NFS;
                name[2] = NFS_NFSSTATS;
                if(sysctl(name, 3, stp, &buflen, (void *)0, (size_t)0) < 0) {
                        err(1, "sysctl");
                }
        }
}
-GAWollman
--
Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
Opinions not those of| It is a bond more powerful than absence.  We like people
MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9503171900.AA23275>
