Conoscere chi usa la memoria con lo script ps_mem.py

 

 

 

 

 

 

Questo script in pyton, ps_mem.py, può risultare molto utile ogni qual volta si ha bisogno di sapere quanta memoria ogni singolo programma occupa. Per chi volesse provarlo:

$ wget https://www.pixelbeat.org/scripts/ps_mem.py

# mv ps_mem.py /usr/local/sbin/

# chmod 755 /usr/local/sbin/ps_mem.py

lo lanciamo con:

# ps_mem.py

il risultato è una lista minuziosa.

root@debianbox:/home/edmond# ps_mem.py
 Private  +   Shared  =  RAM used    Program

112.0 KiB +  30.5 KiB = 142.5 KiB    portmap
128.0 KiB +  22.5 KiB = 150.5 KiB    gnome-pty-helper
140.0 KiB +  12.0 KiB = 152.0 KiB    sh
144.0 KiB +  22.0 KiB = 166.0 KiB    atd
144.0 KiB +  23.0 KiB = 167.0 KiB    acpid
164.0 KiB +  19.5 KiB = 183.5 KiB    init
160.0 KiB +  33.5 KiB = 193.5 KiB    hald-addon-rfkill-killswitch
164.0 KiB +  33.5 KiB = 197.5 KiB    hald-addon-leds
164.0 KiB +  34.5 KiB = 198.5 KiB    hald-addon-input
168.0 KiB +  35.5 KiB = 203.5 KiB    hald-addon-acpi
192.0 KiB +  53.5 KiB = 245.5 KiB    rpc.statd
256.0 KiB +  14.0 KiB = 270.0 KiB    ssh-agent
220.0 KiB +  50.5 KiB = 270.5 KiB    cron
240.0 KiB +  44.5 KiB = 284.5 KiB    hald-addon-usb-csr
268.0 KiB +  30.5 KiB = 298.5 KiB    hald-runner
272.0 KiB +  29.5 KiB = 301.5 KiB    dbus-launch
332.0 KiB +  14.0 KiB = 346.0 KiB    hddtemp
332.0 KiB +  48.5 KiB = 380.5 KiB    kerneloops
364.0 KiB +  48.0 KiB = 412.0 KiB    usbmuxd
336.0 KiB + 103.0 KiB = 439.0 KiB    gvfsd-burn
352.0 KiB + 119.5 KiB = 471.5 KiB    su
448.0 KiB +  43.0 KiB = 491.0 KiB    exim4
444.0 KiB +  65.5 KiB = 509.5 KiB    gvfsd-metadata
516.0 KiB +  17.0 KiB = 533.0 KiB    dhclient
460.0 KiB +  89.0 KiB = 549.0 KiB    gvfs-gphoto2-volume-monitor
468.0 KiB + 108.0 KiB = 576.0 KiB    getty (6)
480.0 KiB + 105.5 KiB = 585.5 KiB    gdm3
472.0 KiB + 126.5 KiB = 598.5 KiB    bluetoothd
464.0 KiB + 156.0 KiB = 620.0 KiB    gvfs-afc-volume-monitor
664.0 KiB +  71.5 KiB = 735.5 KiB    modem-manager
504.0 KiB + 252.0 KiB = 756.0 KiB    avahi-daemon (2)
592.0 KiB + 186.0 KiB = 778.0 KiB    gdm-session-worker
676.0 KiB + 236.0 KiB = 912.0 KiB    wpa_supplicant
792.0 KiB + 156.5 KiB = 948.5 KiB    bonobo-activation-server
820.0 KiB + 169.0 KiB = 989.0 KiB    gvfs-gdu-volume-monitor
968.0 KiB +  52.5 KiB =   1.0 MiB    rsyslogd
868.0 KiB + 206.0 KiB =   1.0 MiB    gdm-simple-slave
352.0 KiB + 741.0 KiB =   1.1 MiB    udevd (3)
904.0 KiB + 225.0 KiB =   1.1 MiB    hald-addon-storage (6)
  1.0 MiB +  94.0 KiB =   1.1 MiB    gvfsd
980.0 KiB + 176.5 KiB =   1.1 MiB    console-kit-daemon
728.0 KiB + 436.5 KiB =   1.1 MiB    upowerd
  1.1 MiB + 105.0 KiB =   1.2 MiB    gnome-keyring-daemon
  1.0 MiB + 203.0 KiB =   1.2 MiB    gvfsd-trash
  1.0 MiB + 162.5 KiB =   1.2 MiB    polkitd
944.0 KiB + 303.5 KiB =   1.2 MiB    udisks-daemon (2)
904.0 KiB + 439.5 KiB =   1.3 MiB    gvfsd-afc
  1.0 MiB + 322.0 KiB =   1.3 MiB    kerneloops-applet
  1.2 MiB + 281.5 KiB =   1.5 MiB    NetworkManager
  1.5 MiB + 210.0 KiB =   1.7 MiB    cupsd
  1.3 MiB + 457.5 KiB =   1.8 MiB    gdu-notification-daemon
  1.4 MiB + 368.0 KiB =   1.8 MiB    seahorse-agent
  1.5 MiB + 324.0 KiB =   1.8 MiB    dbus-daemon (2)
  1.5 MiB + 425.5 KiB =   1.9 MiB    gnome-screensaver
  1.8 MiB + 748.0 KiB =   2.6 MiB    multiload-applet-2
  1.9 MiB + 804.5 KiB =   2.7 MiB    trashapplet
  1.9 MiB + 796.5 KiB =   2.7 MiB    polkit-gnome-authentication-agent-1
  2.3 MiB + 721.0 KiB =   3.0 MiB    nm-applet
  2.2 MiB + 866.0 KiB =   3.0 MiB    update-notifier
  2.3 MiB + 803.5 KiB =   3.0 MiB    gtk-window-decorator
  2.3 MiB + 806.0 KiB =   3.1 MiB    x-session-manag
  3.1 MiB +  65.5 KiB =   3.2 MiB    hald
  3.3 MiB +  96.0 KiB =   3.4 MiB    gconfd-2
  3.0 MiB + 722.0 KiB =   3.7 MiB    bash (2)
  3.3 MiB + 805.0 KiB =   4.1 MiB    gnome-terminal
  3.5 MiB + 936.5 KiB =   4.4 MiB    gnome-settings-daemon
  4.4 MiB +   1.1 MiB =   5.5 MiB    mixer_applet2
 11.9 MiB + 847.0 KiB =  12.7 MiB    coherence
 17.3 MiB +   2.1 MiB =  19.4 MiB    rhythmbox
 17.4 MiB +   2.5 MiB =  19.9 MiB    gnome-panel
 34.2 MiB +   5.5 MiB =  39.7 MiB    nautilus
 47.1 MiB +   2.5 MiB =  49.6 MiB    compiz
 46.3 MiB +   4.8 MiB =  51.0 MiB    Xorg
244.8 MiB +   2.6 MiB = 247.4 MiB    firefox-bin

———————————
                        524.4 MiB
=================================

 Private  +   Shared  =  RAM used    Program

Autore: Franco Conidi aka edmond

Senior System Integrator, Network Administrator, Sys Admin Linux, Linux User, Consulente Informatico.

8 pensieri riguardo “Conoscere chi usa la memoria con lo script ps_mem.py”

  1. Lo script sembra interessante, son curioso di capire come calcoli la RAM
    condivisa, domani mi leggo lo script con calma (sperando di capirci
    qualcosa). Grazie per averlo segnalato 🙂

  2. @ idl3

    direi che è molto interessante dato che la RAM condivisa non è facile da calcolare.

  3. grazie
    ma sarebbe interessante avere un programma che stampi a video il contenuto dello swap

Lascia un commento

Il tuo indirizzo email non sarà pubblicato.