⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2.t

📁 早期freebsd实现
💻 T
字号:
.\" Copyright (c) 1985 The Regents of the University of California..\" All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)2.t	5.1 (Berkeley) 4/17/91.\".ds RH Observation techniques.NHObservation techniques.PPThere are many tools available for monitoring the performanceof the system.Those that we found most useful are described below..NH 2System maintenance tools.PPSeveral standard maintenance programs are invaluable inobserving the basic actions of the system.  The \fIvmstat\fP(1)program is designed to be an aid to monitoringsystemwide activity.  Together with the\fIps\fP\|(1)command (as in ``ps av''), it can be used to investigate systemwidevirtual memory activity.By running \fIvmstat\fPwhen the system is active you can judge the system activity in severaldimensions: job distribution, virtual memory load, paging and swappingactivity, disk and cpu utilization.Ideally, to have a balanced system in activity,there should be few blocked (b) jobs,there should be little paging or swapping activity, there shouldbe available bandwidth on the disk devices (most single arms peakout at 25-35 tps in practice), and the user cpu utilization (us) shouldbe high (above 50%)..PPIf the system is busy, then the count of active jobs may be large,and several of these jobs may often be blocked (b).  If the virtualmemory is active, then the paging demon will be running (sr willbe non-zero).  It is healthy for the paging demon to free pages whenthe virtual memory gets active; it is triggered by the amount of freememory dropping below a threshold and increases its pace as free memorygoes to zero..PPIf you run \fIvmstat\fPwhen the system is busy (a ``vmstat 5'' gives all thenumbers computed by the system), you can findimbalances by noting abnormal job distributions.  If manyprocesses are blocked (b), then the disk subsystemis overloaded or imbalanced.  If you have several non-dmadevices or open teletype lines that are ``ringing'', or user programsthat are doing high-speed non-buffered input/output, then the systemtime may go high (60-80% or higher).It is often possible to pin down the cause of high system time bylooking to see if there is excessive context switching (cs), interruptactivity (in) or system call activity (sy).  Long term measurementson one ofour large machines showan average of 60 context switches and interruptsper second and an average of 90 system calls per second..PPIf the system is heavily loaded, or if you have little memoryfor your load (1 megabyte is little in our environment), then the systemmay be forced to swap.  This is likely to be accompanied by a noticeablereduction in the system responsiveness and long pauses when interactivejobs such as editors swap out..PPA second important program is \fIiostat\fP\|(1).\fIIostat\fPiteratively reports the number of characters read and written to terminals,and, for each disk, the number of transfers per second, kilobytestransferred per second,and the milliseconds per average seek.It also gives the percentage of time the system hasspent in user mode, in user mode running low priority (niced) processes,in system mode, and idling..PPTo compute this information, for each disk, seeks and data transfer completionsand the number of words transferred are counted;for terminals collectively, the numberof input and output characters are counted.Also, every 100 ms,the state of each disk is examinedand a tally is made if the disk is active.From these numbers and the transfer ratesof the devices it is possible to determineaverage seek times for each device..PPWhen filesystems are poorly placed on the availabledisks, figures reported by \fIiostat\fP can be usedto pinpoint bottlenecks.  Under heavy system load, disktraffic should be spread out among the drives withhigher traffic expected to the devices where the root, swap, and/tmp filesystems are located.  When multiple disk drives areattached to the same controller, the system willattempt to overlap seek operations with I/O transfers.  Whenseeks are performed, \fIiostat\fP will shownon-zero average seek times.  Most modern disk drives shouldexhibit an average seek time of 25-35 ms..PPTerminal traffic reported by \fIiostat\fP should be heavilyoutput oriented unless terminal lines are being used fordata transfer by programs such as \fIuucp\fP.  Input andoutput rates are system specific.  Screen editorssuch as \fIvi\fP and \fIemacs\fP tend to exhibit output/inputratios of anywhere from 5/1 to 8/1.  On one of our largestsystems, 88 terminal lines plus 32 pseudo terminals, we observedan average of 180 characters/second input and 450 characters/secondoutput over 4 days of operation..NH 2Kernel profiling.PPIt is simple to build a 4.2BSD kernel that will automaticallycollect profiling information as it operates simply by specifying the.B \-poption to \fIconfig\fP\|(8) when configuring a kernel.The program counter sampling can be driven by the system clock,or by an alternate real time clock.The latter is highly recommended as use of the system clock resultsin statistical anomalies in accounting forthe time spent in the kernel clock routine..PPOnce a profiling system has been booted statistic gathering ishandled by \fIkgmon\fP\|(8).\fIKgmon\fP allows profiling to be started and stoppedand the internal state of the profiling buffers to be dumped.\fIKgmon\fP can also be used to reset the state of the internalbuffers to allow multiple experiments to be run withoutrebooting the machine..PPThe profiling data is processed with \fIgprof\fP\|(1)to obtain information regarding the system's operation.Profiled systems maintain histograms of the kernel program counter,the number of invocations of each routine,and a dynamic call graph of the executing system.The postprocessing propagates the time spent in eachroutine along the arcs of the call graph.\fIGprof\fP then generates a listing for each routine in the kernel,sorted according to the time it usesincluding the time of its call graph descendents.Below each routine entry is shown its (direct) call graph children,and how their times are propagated to this routine.A similar display above the routine shows how this routine's time and thetime of its descendents is propagated to its (direct) call graph parents..PPA profiled system is about 5-10% larger in its text space because ofthe calls to count the subroutine invocations.When the system executes,the profiling data is stored in a buffer that is 1.2times the size of the text space.All the information is summarized in memory,it is not necessary to have a trace filebeing continuously dumped to disk.The overhead for running a profiled system varies;under normal load we see anywhere from 5-25%of the system time spent in the profiling code.Thus the system is noticeably slower than an unprofiled system,yet is not so bad that it cannot be used in a production environment.This is important since it allows us to gather datain a real environment rather than trying todevise synthetic work loads..NH 2Kernel tracing.PPThe kernel can be configured to trace certain operations byspecifying ``options TRACE'' in the configuration file.  Thisforces the inclusion of code that records the occurrence ofevents in \fItrace records\fP in a circular buffer in kernelmemory.  Events may be enabled/disabled selectively while thesystem is operating.  Each trace record contains a time stamp(taken from the VAX hardware time of day clock register), anevent identifier, and additional information that is interpretedaccording to the event type.  Buffer cache operations, such asinitiating a read, include the disk drive, block number, and transfer size in the trace record.Virtual memory operations, such as a pagein completing, includethe virtual address and process id in the trace record.  The circularbuffer is normally configured to hold 256 16-byte trace records.\**.FS\** The standard trace facilities distributed with 4.2differ slightly from those described here.  The time stamp in thedistributed system is calculated from the kernel's time of dayvariable instead of the VAX hardware register, and the buffer cachetrace points do not record the transfer size..FE.PPSeveral user programs were written to sample and interpret thetracing information.  One program runs in the background andperiodically reads the circular buffer of trace records.  Thetrace information is compressed, in some instances interpretedto generate additional information, and a summary is written to afile.  In addition, the sampling program can also recordinformation from other kernel data structures, such as thoseinterpreted by the \fIvmstat\fP program.  Data written out toa file is further buffered to minimize I/O load. .PPOnce a trace log has been created, programs that compressand interpret the data may be run to generate graphs showing thedata and relationships between traced events andsystem load..PPThe trace package was used mainly to investigate the operation ofthe file system buffer cache.  The sampling program maintained ahistory of read-ahead blocks and used the trace information tocalculate, for example, percentage of read-ahead blocks used..NH 2Benchmark programs.PPBenchmark programs were used in two ways.  First, a suite ofprograms was constructed to calculate the cost of certain basicsystem operations.  Operations such as system call overhead andcontext switching time are critically important in evaluating theoverall performance of a system.  Because of the drastic changes inthe system between 4.1BSD and 4.2BSD, it was important to verifythe overhead of these low level operations had not changed appreciably..PPThe second use of benchmarks was in exercisingsuspected bottlenecks.When we suspected a specific problem with the system,a small benchmark program was written to repeatedly usethe facility.While these benchmarks are not useful as a general toolthey can give quick feedback on whether a hypothesizedimprovement is really having an effect.It is important to realize that the only real assurancethat a change has a beneficial effect is throughlong term measurements of general timesharing.We have numerous examples where a benchmark programsuggests vast improvements while the changein the long term system performance is negligible,and conversely examples in which the benchmark program run more slowly, but the long term system performance improves significantly.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -