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

📄 top.1

📁 linux下获取一些环境信息的代码
💻 1
📖 第 1 页 / 共 5 页
字号:
.TP 3b:\fB PPID\fR \*(EM Parent Process Pid\fRThe process ID of a task's parent..TP 3c:\fB RUSER\fR \*(EM Real User Name\fRThe real user name of the task's owner..TP 3d:\fB UID\fR \*(EM User Id\fRThe effective user ID of the task's owner..TP 3e:\fB USER\fR \*(EM User Name\fRThe effective user name of the task's owner..TP 3f:\fB GROUP\fR \*(EM Group Name\fRThe effective group name of the task's owner..TP 3g:\fB TTY\fR \*(EM Controlling TtyThe name of the controlling terminal.This is usually the device (serial port, pty, etc.) from which theprocess was started, and which it uses for input or output.However, a task need not be associated with a terminal, in which caseyou'll see '?' displayed..TP 3h:\fB PR\fR \*(EM PriorityThe priority of the task..TP 3i:\fB NI\fR \*(EM Nice valueThe nice value of the task.A negative nice value means higher priority, whereas a positive nice valuemeans lower priority.Zero in this field simply means priority will not be adjusted in determining atask's dispatchability..TP 3j:\fB P\fR \*(EM Last used \*(PU (SMP)A number representing the last used processor.In a true SMP environment this will likely change frequently since the kernelintentionally uses weak affinity.Also, the very act of running \*(Me may break this weak affinity and cause moreprocesses to change \*(PUs more often (because of the extra demand for\*(Pu time)..TP 3k:\fB %CPU\fR \*(EM \*(PU usageThe task's share of the elapsed \*(PU time since the last screen update,expressed as a percentage of total \*(PU time.In a true SMP environment, if 'Irix mode' is \*F, \*(Me will operatein 'Solaris mode' where a task's \*(Pu usage will be divided by the totalnumber of \*(PUs.You toggle 'Irix/Solaris' modes with the 'I' \*(CI..TP 3l:\fB TIME\fR \*(EM \*(PU TimeTotal \*(PU time the task has used since it started.When 'Cumulative mode' is \*O, each process is listed with the \*(Putime that it and its dead children has used.You toggle 'Cumulative mode' with 'S', which is a \*(CO and an \*(CI.\*(XC 'S' \*(CI for additional information regarding this mode..TP 3m:\fB TIME+\fR \*(EM \*(PU Time, hundredthsThe same as 'TIME', but reflecting more granularity through hundredths ofa second..TP 3n:\fB %MEM\fR \*(EM Memory usage (RES)A task's currently used share of available \*(MP..TP 3o:\fB VIRT\fR \*(EM Virtual Image (kb)The total amount of \*(MV used by the task.It includes all code, data and shared libraries plus pages that have beenswapped out.VIRT = SWAP + RES..TP 3p:\fB SWAP\fR \*(EM Swapped size (kb)The swapped out portion of a task's total \*(MV image..TP 3q:\fB RES\fR \*(EM Resident size (kb)The non-swapped \*(MP a task has used.RES = CODE + DATA..TP 3r:\fB CODE\fR \*(EM Code size (kb)The amount of \*(MP devoted to executable code, also known asthe 'text resident set' size or TRS..TP 3s:\fB DATA\fR \*(EM Data+Stack size (kb)The amount of \*(MP devoted to other than executable code, also known asthe 'data resident set' size or DRS..TP 3t:\fB SHR\fR \*(EM Shared Mem size (kb)The amount of \*(MS used by a task.It simply reflects memory that could be potentially shared withother processes..TP 3u:\fB nFLT\fR \*(EM Page Fault countThe number of\fB major\fR page faults that have occurred for a task.A page fault occurs when a process attempts to read from or write to a virtualpage that is not currently present in its address space.A major page fault is when disk access is involved in making thatpage available..TP 3v:\fB nDRT\fR \*(EM Dirty Pages countThe number of pages that have been modified since they were lastwritten to disk.Dirty pages must be written to disk before the corresponding physical memorylocation can be used for some other virtual page..TP 3w:\fB S\fR \*(EM Process StatusThe status of the task which can be one of:   '\fBD\fR' = uninterruptible sleep   '\fBR\fR' = running   '\fBS\fR' = sleeping   '\fBT\fR' = traced or stopped   '\fBZ\fR' = zombieTasks shown as running should be more properly thought of as 'ready to run'\*(EM their task_struct is simply represented on the Linux run-queue.Even without a true SMP machine, you may see numerous tasks in this statedepending on \*(Me's delay interval and nice value..TP 3x:\fB Command\fR \*(EM Command\fB line\fR or Program\fB name\fRDisplay the command line used to start a task or the name of the associatedprogram.You toggle between command\fI line\fR and\fI name\fR with 'c', which is botha \*(CO and an \*(CI.When you've chosen to display command lines, processes without a commandline (like kernel threads) will be shown with only the program name inparentheses, as in this example:      \fR( mdrecoveryd )Either form of display is subject to potential truncation if it's too long tofit in this field's current width.That width depends upon other fields selected, their order and the currentscreen width.\*(NT The 'Command' field/column is unique, in that it is not fixed-width.When displayed, this column will be allocated all remaining screen width (upto the maximum 512 characters) to provide for the potential growth of programnames into command lines..TP 3y:\fB WCHAN\fR \*(EM Sleeping in FunctionDepending on the availability of the kernel link map ('System.map'), this fieldwill show the name or the address of the kernel function in which the task iscurrently sleeping.Running tasks will display a dash ('-') in this column.\*(NT By displaying this field, \*(Me's own working set will be increased byover 700Kb.Your only means of reducing that overhead will be to stop and restart \*(Me..TP 3z:\fB Flags\fR \*(EM Task FlagsThis column represents the task's current scheduling flags which areexpressed in hexadecimal notation and with zeros suppressed.These flags are officially documented in <linux/sched.h>.Less formal documentation can also be found on the 'Fields select'and 'Order fields' screens..\" .......................................................................SS 2b. SELECTING and ORDERING Columns.\" ----------------------------------------------------------------------After pressing the \*(CIs 'f' (Fields select) or \'o' (Order fields) you willbe shown a screen containing the current \fBfields string\fR followed by namesand descriptions for all fields.Here is a sample\fB fields string\fR from one of \*(Me's four windows/fieldgroups and an explanation of the conventions used:.JbuSample fields string:   \fIANOPQRSTUVXbcdefgjlmyzWHIK\fR.JbuThe order of displayed fields corresponds to the order of the lettersin that string..JbuIf the letter is\fI upper case\fR the corresponding field itself willthen be shown as part of the \*(TD (screen width permitting).This will also be indicated by a leading \*(AS, as in this excerpt:    \fR...    \fB* K: %CPU       = CPU usage    \fR  l: TIME       = CPU Time    \fR  m: TIME+      = CPU Time, hundredths    \fB* N: %MEM       = Memory usage (RES)    \fB* O: VIRT       = Virtual Image (kb)    \fR....TP.B Fields select\fR screen \*(EM the 'f' \*(CIYou\fI toggle\fR the\fB display\fR of a field by simply pressing thecorresponding letter..TP.B Order fields\fR screen \*(EM the 'o' \*(CIYou\fI move\fR a field to the\fB left\fR by pressing the corresponding\fBupper case\fR letter and to the\fB right\fR with the\fB lower case\fRletter..\" ----------------------------------------------------------------------.SH 3. INTERACTIVE Commands.\" ----------------------------------------------------------------------Listed below is a brief index of commands within categories.Some commands appear more than once \*(EM their meaning or scope may varydepending on the context in which they are issued.  3a.\fI GLOBAL_Commands\fR        <Ret/Sp> ?, =, A, B, d, G, h, I, k, q, r, s, W, Z  3b.\fI SUMMARY_Area_Commands\fR        l, m, t, 1  3c.\fI TASK_Area_Commands\fR        Appearance:  b, x, y, z        Content:     c, f, H, o, S, u        Size:        #, i, n        Sorting:     <, >, F, O, R  3d.\fI COLOR_Mapping\fR        <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7  4b.\fI COMMANDS_for_Windows\fR        -, _, =, +, A, a, G, g, w.\" .......................................................................SS 3a. GLOBAL CommandsThe global \*(CIs are\fB always\fR available\fR in both \*(FM and \*(AM.However, some of these \*(CIs are\fB not available\fR when runningin 'Secure mode'.If you wish to know in advance whether or not your \*(Me has been secured,simply ask for help and view the system summary on the second line..TP 7\ \ \<\fBEnter\fR> or <\fBSpace\fR> :\fIRefresh_Display\fRThese commands do nothing, they are simply ignored.However, they will awaken \*(Me and following receipt of any inputthe entire display will be repainted.Use either of these keys if you have a large delay interval and wish tosee current status,.TP 7\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fRThere are two help levels available.The first will provide a reminder of all the basic \*(CIs.If \*(Me is\fI secured\fR, that screen will be abbreviated.Typing 'h' or '?' on that help screen will take you to help for those \*(CIsapplicable to \*(AM..TP 7\ \ \'\fB=\fR\' :\fIExit_Task_Limits\fRRemoves restrictions on which tasks are shown.This command will reverse any 'i' (idle tasks) and 'n' (max tasks) commandsthat might be active.It also provides for an 'exit' from PID monitoring.See the '-p' \*(CO for a discussion of PID monitoring.When operating in \*(AM this command has a slightly broader meaning..TP 7\ \ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fRThis command will switch between \*(FM and \*(AM.\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into\*(CWs and field groups..TP 7\ \ \'\fBB\fR\' :\fIBold_Disable/Enable_toggle\fRThis command will influence use of the 'bold' terminfo capability andalters\fB both\fR the \*(SA and \*(TA for the \*(CW.While it is intended primarily for use with dumb terminals, it can beapplied anytime.\*(NT When this toggle is \*O and \*(Me is operating in monochrome mode,the\fB entire display\fR will appear as normal text.Thus, unless the 'x' and/or 'y' toggles are using reverse for emphasis,there will be no visual confirmation that they are even on..TP 7*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fRYou will be prompted to enter the delay time, in seconds, betweendisplay updates.Fractional seconds are honored, but a negative number is not allowed.Entering 0 causes (nearly) continuous updates, with an unsatisfactorydisplay as the system and tty driver try to keep up with \*(Me's demands.The delay value is inversely proportional to system loading,so set it with care.If at any time you wish to know the current delay time, simply ask for helpand view the system summary on the second line..TP 7\ \ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fRYou will be prompted to enter a number between 1 and 4 designating thewindow/field group which should be made the \*(CW.You will soon grow comfortable with these 4 windows, especially afterexperimenting with \*(AM..TP 7\ \ \'\fBI\fR\' :\fIIrix/Solaris_Mode_toggle\fRWhen operating in 'Solaris mode' ('I' toggled \*F), a task's \*(Pu usagewill be divided by the total number of \*(PUs.After issuing this command, you'll be informed of the new state of this toggle..TP 7\ \ \'\fBu\fR\' :\fIselect a user\fRYou will be prompted for a UID or username. Only processes

⌨️ 快捷键说明

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