Jõudluse jälgimine ja probleemilahendus käsurea utiliitide abil

From ICO wiki
Jump to navigationJump to search

Autor

Heiki Nooremäe

Sissejuhatus

Käsk "top" unixilistes operatsioonisüsteemides on süsteemi jälgimise utiliit, mis näitab sagedasti uuenevat nimekekirja protsessidest. Vaikimisi on protsessid järjestatud protsessori kasutuse protsentide järgi, näha on ainult suurimad CPU kasutajad". Top-käsk näitab kui palju arvutusvõimsust ja mälu kasutatakse, samuti muud infot jooksvate protsesside kohta. Mõned top-i versioonid võimaldavad kuva ulatuslikku kohandamist, saab valida nt. tulpasid või sortimismoodust. Top-käsk on süsteemiadministraatoritele kasulik, sest näitab, millised kasutajad ja protsessid tarbivad enim süsteemi resursse igal antud ajahetkel. Top-i väljundit on võimalik ka tekstifaili suunata.


Htop on edasiarenenud interaktiivne süsteemijälgija ning protsesside vaatur, mis on kirjutatud Linuxile. See on mõeldud programmi top asendamiseks. Htop näitab sagedasti uuenevat nimekirja arvutis jooksvatest protsessidest, mis on järjestatud protsessorikasutuse järgi. Erinevalt top-ist näitab Htop kõiki jooksvaid protsesse, mitte ainult kõige rohkem ressursse kasutavaid protsesse. Samuti kasutab Htop värve ja annab visuaalset infot protsessori, saalefaili ja mälu oleku kohta.

Htop-i kasutatakse tihti juhtudel, kus Unixi top ei anna piisavalt infot süsteemi protsesside kohta, nt. kui üritada rakendustest väikseid mälulekkeid leida. Top-iga võrreldes on sel mugavam, kursorijuhtimisega liides protsesside peatamiseks. Htop on kirjutatud C-keeles, kasutades ncurses teeki.


Atop om ASCII täisekraani jõudluse jälgija, mis on võimeline näitama kõigi protsesside tegevust (isegi kui protsessid on intervalli jooksul lõppenud) Atop is an ASCII full-screen performance monitor that is capable of reporting the activity of all processes (even if processes have finished during the interval), daily logging of system and process activity for long-term analysis, highlighting overloaded system resources by using colors, etc. At regular intervals, it shows system-level activity related to the CPU, memory, swap, disks, and network layers, and for every active process it shows the CPU utilization, the memory growth, priority, username, state, and exit code.

Ajalugu

The top command was inspired by the monitor process/topcpu command found in the VMS operating system. William LeFebvre wrote the first implementation of top in April 1984 for BSD 4.1 while a graduate student at Rice University. It was released as an Open source project under the BSD license, which allowed it to be included in numerous proprietary BSD and UNIX operating systems.

The top command has been reimplemented several times for different operating systems and under different licenses. In AIX an advanced top version was introduced in AIX 4.3 in 1999 called topas.

The first top for Linux was written by Roger Binns; the most recent and common Linux version is a full-color windowed implementation by James C. Warner that ships with the procps package.

top Keep listing the currently running processes, sorted by cpu usage (top users first). In KDE, you can get GUI-based Ktop from "K"menu under "System"-"Task Manager" (or by executing "ktop" in an X-terminal).

Kasutamine

Top

Top on linuxis vaikimisi installitud. Kasutamiseks kirjutada käsureale top [valik] Some options to top are listed below.

-d: Delay time interval as:  -d ss.tt (seconds. tenths)
	    Specifies the delay between screen updates
-u: Monitor by user as:  -u somebody
	    Monitor only processes with an effective UID or user name matching
	    That given.
-c: RUSER -- Real User Name. The real user name of the task's owner.


-C: color
	    Turn off the use of color in the display.

-I: idle-procs
	    Do  not  display  idle processes.

-S: system-procs
              Show system processes in the  display.

-T: tag-names
              List all available color tags and the current set of tests  used
              for color highlighting, then exit.

-a: all
              Show  all  processes for as long as possible.

-b: batch
              Use  "batch" mode.  In this mode, all input from the terminal is
              ignored.

-c: full-commands
              Show the full command line for each process.

-i: interactive
              Use "interactive" mode.  In this mode, any input is  immediately
              read  for processing.

-q: quick
              Renice  top to -20 so that it will run faster.

-t: threads
              Show individual threads on separate lines.



-v: version
              Write version number information to  stderr  then  exit  immedi-
              ately.


-m mode: mode=mode
              Start  the display in an alternate mode.

-o field: sort-order=field
              Sort the process display area on the specified field.

-s time: delay=time
              Set  the  delay  between  screen  updates  to time seconds.

-U username: user=username
              Show only those processes owned by username.

Htop

Paigaldamine:

sudo apt-get install htop

Käivitamine:

htop

Käivitada saab tavakasutaja alt.

The great thing about htop is that you can kill a process from the application itself. Just arrow down to the offending process and hit F9 to kill it.

It's a lot easier than opening up a new terminal window and using "kill" the old-fashioned way.

I just had to kill Firefox, which was pegging the CPU for some reason, and htop saved me a few steps.

Htop actually has configuration options, which can be accessed with the F2 key while in the application. I'm not at the point yet where I'm ready to mess with this, but I've known for awhile that the output of top can also be screwed with via command-line switches. Haven't done that, either, but it's nice to know that both top and htop have options.

And I really, really like being able to kill processes from within htop.

Atop

Paigaldamine:

sudo apt-get install atop

Käivitamine:

atop

Käivitada saab tavakasutaja alt.

Kasutatud kirjandus

http://en.wikipedia.org/wiki/Top_(Unix)
http://en.wikipedia.org/wiki/Htop_(Unix)
http://freshmeat.net/projects/atop/
http://www.unixguide.net/linux/linuxshortcuts.shtml
http://www.go2linux.org/top-linux-command-line-to-show-running-processes-in-real-time
http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html
http://www.insidesocal.com/click/2009/08/htop-its-like-top-turned-up-to.html