Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 May 1998 14:37:36 +0930
From:      Greg Lehey <grog@lemis.com>
To:        John-Mark Gurney <gurney_j@resnet.uoregon.edu>, Robert Watson <robert@cyrus.watson.org>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Context switch time
Message-ID:  <19980504143736.L4777@freebie.lemis.com>
In-Reply-To: <19980425034313.55993@hydrogen.nike.efn.org>; from John-Mark Gurney on Sat, Apr 25, 1998 at 03:43:13AM -0700
References:  <Pine.BSF.3.96.980425041329.28708A-100000@fledge.watson.org> <19980425034313.55993@hydrogen.nike.efn.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 25 April 1998 at  3:43:13 -0700, John-Mark Gurney wrote:
> Robert Watson scribbled this message on Apr 25:
>> I was wondering what the average context switch time across a syscall
>> invocation is, also, how long it takes to switch in a different process.
>> Presumably just on a Pentium 100ish processor.  Is this data I can
>> retrieve from the kernel profiler?  mi_switch and tsleep both appear in
>> the profiling data, but it is not clear to me that this includes the time
>> for the switch to kernel context, etc.
>
> one thing you might try is to run something like a process that just
> does a yield syscall (-current box) repeatedly...  I was getting about
> 111k syscalls/sec from a program on my k6/225...  (systat couldn't display
> numbers greater than 5 sig figs, so I had to use vmstat :) )

Strange.  This is what I get from a program that repeatedly calls
getpid() on my K6/233:

 procs      memory     page                         faults      cpu
 r b w     avm   fre  flt  re  pi  po  fr  sr w0   in   sy  cs us sy id
 2 0 0 3770984  4632    7   0   0   0   8  34  1  302  429  73  4  2 94
 1 0 0 3770992  4372   56   1   2   0  11   0  0  307 719494  35 34 66  0
 1 0 0 3771688  4220  134   4   3  12  22 2372  6  375 687120  67 34 66  0
 1 0 0 3769920  4784  132  16   0  13 119 4308 12  500 659404  93 33 67  0
 1 0 0 3762592  4944  103   8   0   0 118   0  4  466 684348  71 40 60  0
 1 0 0 3761616  5520   97   0   0   0 156   0  0  324 694288  66 40 60  0
 1 0 0 3761616  5520    1   0   0   0   0   0  0  235 712159  24 36 64  0
 1 0 0 3761616  5520    1   0   0   0   0   0  0  235 730958  26 31 69  0
 1 0 0 3750512  5780    9   0   0   0  36   0  0  256 729640  27 39 61  0
 1 0 0 3749768  6024    9   2   0   0  36   0  0  266 729086  28 38 62  0
 2 0 0 3746464  6304    9   0   0   0  38   0  0  256 727910  24 33 67  0
 1 0 0 3746464  6304    1   0   0   0   0   0  3  236 729221  25 34 66  0
 1 0 0 3746464  6304    1   0   0   0   0   0  0  232 731855  25 36 64  0
 1 0 0 3746740  6304    1   0   0   0   0   0  0  233 731497  27 34 66  0
 1 0 0 3748076  6304    1   0   0   0   0   0  0  264 723896  82 36 64  0
 1 0 0 3748648  6300    2   0   0   0   0   0  0  267 725709  75 37 63  0
 1 0 0 3757944  4352  320  42  14   8  14 2210 17  256 434830 241 48 52  0
 1 0 0 3759064  4352    1   0   0   0   0   0  0  279 706062 208 36 64  0

As you can see from the second-to-last line (where I started this
message), the system is doing other things too, so I suspect the
correct idle value would be round 730,000 syscalls per second.  This
suggests that yield() is doing quite a bit of processing itself.

Greg
--
See complete headers for address and phone numbers
finger grog@lemis.com for PGP public key

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



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