diff --git a/notatki/top-kill-monitoring/README.md b/notatki/top-kill-monitoring/README.md new file mode 100644 index 0000000..dd8dcf4 --- /dev/null +++ b/notatki/top-kill-monitoring/README.md @@ -0,0 +1,35 @@ +### RESEARCH +cgroups.txt - WYNIK researchu, ograniczanie zasobów (CPU,pamięć) dla grup procesów już zawczasu + +top.txt - przedmiot researchu + +glances.txt - alternatywa top napisana w pythonie, być może bardziej nadaje się do analizy w ramach zajęć + +kill important tip (https://docs.oracle.com/cd/E19120-01/open.solaris/819-2380/eoizf/index.html): +"When using the kill command to stop a process, first try using the command by itself, without including a signal option. Wait a few minutes to see if the process terminates before using the kill command with the -9 signal." + +### kto ? co ?po co ? dlaczego? +Top jest jednym z programów zawartych w zestawie w procps ( https://www.systutorials.com/where-is-the-source-code-for-the-free-command-on-linux/ ) + +The following programs are found in procps: + +free - Report the amount of free and used memory in the system +kill - Send a signal to a process based on PID +pgrep - List processes based on name or other attributes +pkill - Send a signal to a process based on name or other attributes +pmap - Report memory map of a process +ps - Report information of processes +pwdx - Report current directory of a process +skill - Obsolete version of pgrep/pkill +slabtop - Display kernel slab cache information in real time +snice - Renice a process +sysctl - Read or Write kernel parameters at run-time +tload - Graphical representation of system load average +top - Dynamic real-time view of running processes +uptime - Display how long the system has been running +vmstat - Report virtual memory statistics +w - Report logged in users and what they are doing +watch - Execute a program periodically, showing output fullscreen + + + diff --git a/notatki/top-kill-monitoring/cgroups.txt b/notatki/top-kill-monitoring/cgroups.txt new file mode 100644 index 0000000..3cb0940 --- /dev/null +++ b/notatki/top-kill-monitoring/cgroups.txt @@ -0,0 +1,4 @@ +### cgroups research cgroups.txt + + +https://scoutapm.com/blog/restricting-process-cpu-usage-using-nice-cpulimit-and-cgroups \ No newline at end of file diff --git a/notatki/top-kill-monitoring/glances.txt b/notatki/top-kill-monitoring/glances.txt new file mode 100644 index 0000000..781f242 --- /dev/null +++ b/notatki/top-kill-monitoring/glances.txt @@ -0,0 +1,9 @@ +### glances reserch glances.txt + +Opis co i jak +https://www.tecmint.com/glances-an-advanced-real-time-system-monitoring-tool-for-linux/ + +kod źródłowy +https://github.com/nicolargo/glances +analizę możnaby zacząc najlepiej od np pierwszej wersji +https://github.com/nicolargo/glances/tree/v1.0 diff --git a/notatki/top-kill-monitoring/top.txt b/notatki/top-kill-monitoring/top.txt new file mode 100644 index 0000000..41c3931 --- /dev/null +++ b/notatki/top-kill-monitoring/top.txt @@ -0,0 +1,39 @@ +# TOP reserch top.txt +# alternatywnie glances.txt - alternatywa top napisana w pythonie + +### UZYCIE +przykłady +https://www.geeksforgeeks.org/top-command-in-linux-with-examples/ + +strace - podgląd jakie pliki otwiera dany proces czyli np interesujący nas top +https://stackoverflow.com/questions/3371131/need-the-source-code-for-top-and-find-the-connection-between-top-and-proc-dire + +procps - np podejrzenie w top konkretnego procesu +https://opensource.com/article/21/8/linux-procps-ng +https://www.mankier.com/1/top +ciekawa komenda +top -p $(pgrep -d ',' process_name) +użycie naprzykład: +top -p $(pgrep -d ',' nginx) + +Nie wiem czy jest sens brnąć w dalszy research w tym kierunku ale +przykładowe komendy które można kolejno puścić w terminalu poniżej, z programów wychodzimy naciskając q: +sudo su +top -d 1 +top -d 5 +top -d 5 >> toptxt.txt +ll +nano toptxt.txt +strace -e open top +strace -e open top >> starce.txt +ll +nano strace.txt +strace top | grep open + +### CIEKAWOSTKI + +źródła kodu top - napisane w C raczej jako ciekawostka +z repo trovaldsa +https://github.com/torvalds/linux/blob/master/tools/perf/builtin-top.c +interaktywne +https://elixir.bootlin.com/linux/latest/source/tools/perf/builtin-top.c \ No newline at end of file