Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mode/process switch time measurements

Status
Not open for further replies.

gotchausa

Programmer
Jan 24, 2002
64
CA
Is there a way of using Unix scripting to measure the time taken to perform the following in Unix:

1. Mode switch
2. Process/Context switch
 


use sar

sar -w

00:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s
01:00:01 0.00 0.0 0.00 0.0 296
02:00:00 0.00 0.0 0.00 0.0 336
03:00:00 0.00 0.0 0.00 0.0 242
04:00:00 0.00 0.0 0.00 0.0 234
05:00:00 0.00 0.0 0.00 0.0 245


Process switches per second is the last column.

 
Sar does not seem to be a Unix command? Can you tell me what OS is it supported on.
 
on Solaris:

NAME
sar - system activity reporter

SYNOPSIS
sar [ -aAbcdgkmpqruvwy ] [ -o filename ] t [ n ]

sar [ -aAbcdgkmpqruvwy ] [ -e time ] [ -f filename ] [
-i sec ] [ -s time ]

DESCRIPTION
In the first instance, sar samples cumulative activity
counters in the operating system at n intervals of t
seconds, where t should be 5 or greater. If t is specified
with more than one option, all headers are printed together
and the output may be difficult to read. (If the sampling
interval is less than 5, the activity of sar itself may
affect the sample.) If the -o option is specified, it saves
the samples in filename in binary format. The default value
of n is 1.
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I got it, thx. Do you know if a process switch is the same thing as a context switch??
 

Not quite.
A process switch is sort of a double context switch.

In a context switch all registers, pointers, etc. are pushed on a stack and the processor stops until it has to work again.
A process switch is a context switch but the processor immediately load another process' registers to service the next process.

(As far as I remember)

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 

Ok, slightly wrong:
In a context switch the processor stops the process because of an interupt (usually). After the interrupt it returns to the process.

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top