📄 proc.txt
字号:
> cat /proc/interrupts CPU0 0: 8728810 XT-PIC timer 1: 895 XT-PIC keyboard 2: 0 XT-PIC cascade 3: 531695 XT-PIC aha152x 4: 2014133 XT-PIC serial 5: 44401 XT-PIC pcnet_cs 8: 2 XT-PIC rtc 11: 8 XT-PIC i82365 12: 182918 XT-PIC PS/2 Mouse 13: 1 XT-PIC fpu 14: 1232265 XT-PIC ide0 15: 7 XT-PIC ide1 NMI: 0 In 2.4.* a couple of lines where added to this file LOC & ERR (this time is theoutput of a SMP machine): > cat /proc/interrupts CPU0 CPU1 0: 1243498 1214548 IO-APIC-edge timer 1: 8949 8958 IO-APIC-edge keyboard 2: 0 0 XT-PIC cascade 5: 11286 10161 IO-APIC-edge soundblaster 8: 1 0 IO-APIC-edge rtc 9: 27422 27407 IO-APIC-edge 3c503 12: 113645 113873 IO-APIC-edge PS/2 Mouse 13: 0 0 XT-PIC fpu 14: 22491 24012 IO-APIC-edge ide0 15: 2183 2415 IO-APIC-edge ide1 17: 30564 30414 IO-APIC-level eth0 18: 177 164 IO-APIC-level bttv NMI: 2457961 2457959 LOC: 2457882 2457881 ERR: 2155NMI is incremented in this case because every timer interrupt generates a NMI(Non Maskable Interrupt) which is used by the NMI Watchdog to detect lockups.LOC is the local interrupt counter of the internal APIC of every CPU.ERR is incremented in the case of errors in the IO-APIC bus (the bus thatconnects the CPUs in a SMP system. This means that an error has been detected,the IO-APIC automatically retry the transmission, so it should not be a bigproblem, but you should read the SMP-FAQ.In 2.6.2* /proc/interrupts was expanded again. This time the goal was for/proc/interrupts to display every IRQ vector in use by the system, notjust those considered 'most important'. The new vectors are: THR -- interrupt raised when a machine check threshold counter (typically counting ECC corrected errors of memory or cache) exceeds a configurable threshold. Only available on some systems. TRM -- a thermal event interrupt occurs when a temperature threshold has been exceeded for the CPU. This interrupt may also be generated when the temperature drops back to normal. SPU -- a spurious interrupt is some interrupt that was raised then lowered by some IO device before it could be fully processed by the APIC. Hence the APIC sees the interrupt but does not know what device it came from. For this case the APIC will generate the interrupt with a IRQ vector of 0xff. This might also be generated by chipset bugs. RES, CAL, TLB -- rescheduling, call and TLB flush interrupts are sent from one CPU to another per the needs of the OS. Typically, their statistics are used by kernel developers and interested users to determine the occurance of interrupt of the given type.The above IRQ vectors are displayed only when relevent. For example,the threshold vector does not exist on x86_64 platforms. Others aresuppressed when the system is a uniprocessor. As of this writing, onlyi386 and x86_64 platforms support the new IRQ vector displays.Of some interest is the introduction of the /proc/irq directory to 2.4.It could be used to set IRQ to CPU affinity, this means that you can "hook" anIRQ to only one CPU, or to exclude a CPU of handling IRQs. The contents of theirq subdir is one subdir for each IRQ, and one file; prof_cpu_maskFor example > ls /proc/irq/ 0 10 12 14 16 18 2 4 6 8 prof_cpu_mask 1 11 13 15 17 19 3 5 7 9 > ls /proc/irq/0/ smp_affinityThe contents of the prof_cpu_mask file and each smp_affinity file for each IRQis the same by default: > cat /proc/irq/0/smp_affinity ffffffffIt's a bitmask, in which you can specify which CPUs can handle the IRQ, you canset it by doing: > echo 1 > /proc/irq/prof_cpu_maskThis means that only the first CPU will handle the IRQ, but you can also echo 5which means that only the first and fourth CPU can handle the IRQ.The way IRQs are routed is handled by the IO-APIC, and it's Round Robinbetween all the CPUs which are allowed to handle it. As usual the kernel hasmore info than you and does a better job than you, so the defaults are thebest choice for almost everyone.There are three more important subdirectories in /proc: net, scsi, and sys.The general rule is that the contents, or even the existence of thesedirectories, depend on your kernel configuration. If SCSI is not enabled, thedirectory scsi may not exist. The same is true with the net, which is thereonly when networking support is present in the running kernel.The slabinfo file gives information about memory usage at the slab level.Linux uses slab pools for memory management above page level in version 2.2.Commonly used objects have their own slab pool (such as network buffers,directory cache, and so on)...............................................................................> cat /proc/buddyinfoNode 0, zone DMA 0 4 5 4 4 3 ...Node 0, zone Normal 1 0 0 1 101 8 ...Node 0, zone HighMem 2 0 0 1 1 0 ...Memory fragmentation is a problem under some workloads, and buddyinfo is a useful tool for helping diagnose these problems. Buddyinfo will give you a clue as to how big an area you can safely allocate, or why a previousallocation failed.Each column represents the number of pages of a certain order which are available. In this case, there are 0 chunks of 2^0*PAGE_SIZE available in ZONE_DMA, 4 chunks of 2^1*PAGE_SIZE in ZONE_DMA, 101 chunks of 2^4*PAGE_SIZE available in ZONE_NORMAL, etc... ..............................................................................meminfo:Provides information about distribution and utilization of memory. Thisvaries by architecture and compile options. The following is from a16GB PIII, which has highmem enabled. You may not have all of these fields.> cat /proc/meminfoMemTotal: 16344972 kBMemFree: 13634064 kBBuffers: 3656 kBCached: 1195708 kBSwapCached: 0 kBActive: 891636 kBInactive: 1077224 kBHighTotal: 15597528 kBHighFree: 13629632 kBLowTotal: 747444 kBLowFree: 4432 kBSwapTotal: 0 kBSwapFree: 0 kBDirty: 968 kBWriteback: 0 kBMapped: 280372 kBSlab: 684068 kBCommitLimit: 7669796 kBCommitted_AS: 100056 kBPageTables: 24448 kBVmallocTotal: 112216 kBVmallocUsed: 428 kBVmallocChunk: 111088 kB MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code) MemFree: The sum of LowFree+HighFree Buffers: Relatively temporary storage for raw disk blocks shouldn't get tremendously large (20MB or so) Cached: in-memory cache for files read from the disk (the pagecache). Doesn't include SwapCached SwapCached: Memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn't need to be swapped out AGAIN because it is already in the swapfile. This saves I/O) Active: Memory that has been used more recently and usually not reclaimed unless absolutely necessary. Inactive: Memory which has been less recently used. It is more eligible to be reclaimed for other purposes HighTotal: HighFree: Highmem is all memory above ~860MB of physical memory Highmem areas are for use by userspace programs, or for the pagecache. The kernel must use tricks to access this memory, making it slower to access than lowmem. LowTotal: LowFree: Lowmem is memory which can be used for everything that highmem can be used for, but it is also available for the kernel's use for its own data structures. Among many other things, it is where everything from the Slab is allocated. Bad things happen when you're out of lowmem. SwapTotal: total amount of swap space available SwapFree: Memory which has been evicted from RAM, and is temporarily on the disk Dirty: Memory which is waiting to get written back to the disk Writeback: Memory which is actively being written back to the disk Mapped: files which have been mmaped, such as libraries Slab: in-kernel data structures cache CommitLimit: Based on the overcommit ratio ('vm.overcommit_ratio'), this is the total amount of memory currently available to be allocated on the system. This limit is only adhered to if strict overcommit accounting is enabled (mode 2 in 'vm.overcommit_memory'). The CommitLimit is calculated with the following formula: CommitLimit = ('vm.overcommit_ratio' * Physical RAM) + Swap For example, on a system with 1G of physical RAM and 7G of swap with a `vm.overcommit_ratio` of 30 it would yield a CommitLimit of 7.3G. For more details, see the memory overcommit documentation in vm/overcommit-accounting.Committed_AS: The amount of memory presently allocated on the system. The committed memory is a sum of all of the memory which has been allocated by processes, even if it has not been "used" by them as of yet. A process which malloc()'s 1G of memory, but only touches 300M of it will only show up as using 300M of memory even if it has the address space allocated for the entire 1G. This 1G is memory which has been "committed" to by the VM and can be used at any time by the allocating application. With strict overcommit enabled on the system (mode 2 in 'vm.overcommit_memory'), allocations which would exceed the CommitLimit (detailed above) will not be permitted. This is useful if one needs to guarantee that processes will not fail due to lack of memory once that memory has been successfully allocated. PageTables: amount of memory dedicated to the lowest level of page tables.VmallocTotal: total size of vmalloc memory area VmallocUsed: amount of vmalloc area which is usedVmallocChunk: largest contigious block of vmalloc area which is free1.3 IDE devices in /proc/ide----------------------------The subdirectory /proc/ide contains information about all IDE devices of whichthe kernel is aware. There is one subdirectory for each IDE controller, thefile drivers and a link for each IDE device, pointing to the device directoryin the controller specific subtree.The file drivers contains general information about the drivers used for theIDE devices: > cat /proc/ide/drivers ide-cdrom version 4.53 ide-disk version 1.08More detailed information can be found in the controller specificsubdirectories. These are named ide0, ide1 and so on. Each of thesedirectories contains the files shown in table 1-5.Table 1-5: IDE controller info in /proc/ide/ide?.............................................................................. File Content channel IDE channel (0 or 1) config Configuration (only for PCI/IDE bridge) mate Mate name model Type/Chipset of IDE controller ..............................................................................Each device connected to a controller has a separate subdirectory in thecontrollers directory. The files listed in table 1-6 are contained in thesedirectories.Table 1-6: IDE device information.............................................................................. File Content cache The cache capacity Capacity of the medium (in 512Byte blocks) driver driver and version geometry physical and logical geometry identify device identify block media media type model device identifier settings device setup smart_thresholds IDE disk management thresholds smart_values IDE disk management values ..............................................................................The most interesting file is settings. This file contains a nice overview ofthe drive parameters: # cat /proc/ide/ide0/hda/settings name value min max mode ---- ----- --- --- ---- bios_cyl 526 0 65535 rw bios_head 255 0 255 rw bios_sect 63 0 63 rw breada_readahead 4 0 127 rw bswap 0 0 1 r file_readahead 72 0 2097151 rw io_32bit 0 0 3 rw keepsettings 0 0 1 rw max_kb_per_request 122 1 127 rw
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -