Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Sep 2000 22:18:04 +0100
From:      Ben Smithurst <ben@FreeBSD.org>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Questions (context switch, X, processes)
Message-ID:  <20000902221804.Q72445@strontium.scientia.demon.co.uk>
In-Reply-To: <Pine.SOL.4.21.0009021558120.19770-100000@sol.cs.binghamton.edu>
References:  <Pine.SOL.4.21.0009021558120.19770-100000@sol.cs.binghamton.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Zhihui Zhang wrote:

> (1) How to display the number of context switches the system have
> performed so far?

vmstat -s | grep context

> (2) How to display the number of processes the sysem have created so far?

I don't think you can.  If you really need this, it would be trivial to
add a counter incremented after the line "p2 = newproc" in fork1() in
kern_fork.c, which you can then set up to be accessed via a sysctl call.
Perhaps this would be an interesting thing to add to the standard vmstat
-s output.

Alfred Perlstein recently added a sysctl to access the current number of
open files:

SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD, &nfiles, 0,
"System-wide number of open files");

This shows how simple adding a new sysctl is.  So I'm guessing you'd
just need to add something like

static int fork_count = 0;
SYSCTL_INT(_kern, OID_AUTO, fork_count, CTLFLAG_RD, &fork_count, 0,
  "Number of forks since boot time");

in kern_fork.c, and increment fork_count where I suggested above.  I'd
be interested in knowing if this works. :-)

> (3) I want to use exceed on a laptop in windows. The laptop running exceed
> will be X server. How to configure a FreeBSD box to open a X on it? I
> assume that there is no need to install X server on FreeBSD box, but only
> X client is needed.

correct, you should just be able to set
DISPLAY=laptop-hostname.whatever:0.0 or something like that.

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000902221804.Q72445>