[R] Memory usage bar plot
arun
smartpink111 at yahoo.com
Wed Sep 4 15:52:56 CEST 2013
HI,
May be this helps.
input<- readLines(textConnection("
Private + Shared = RAM used Program
84.0 KiB + 14.5 KiB = 98.5 KiB sleep
108.0 KiB + 11.5 KiB = 119.5 KiB klogd
124.0 KiB + 15.0 KiB = 139.0 KiB hidd
128.0 KiB + 12.5 KiB = 140.5 KiB gpm
116.0 KiB + 28.5 KiB = 144.5 KiB hald-addon-storage
120.0 KiB + 28.0 KiB = 148.0 KiB acpid
128.0 KiB + 25.0 KiB = 153.0 KiB dbus-launch
128.0 KiB + 31.5 KiB = 159.5 KiB hald-addon-acpi
144.0 KiB + 19.0 KiB = 163.0 KiB sdpd
152.0 KiB + 16.5 KiB = 168.5 KiB irqbalance
140.0 KiB + 28.5 KiB = 168.5 KiB pam_timestamp_check
152.0 KiB + 20.0 KiB = 172.0 KiB init
148.0 KiB + 26.0 KiB = 174.0 KiB mapping-daemon
152.0 KiB + 25.5 KiB = 177.5 KiB gnome-keyring-daemon
152.0 KiB + 26.5 KiB = 178.5 KiB portmap
164.0 KiB + 16.0 KiB = 180.0 KiB syslogd
168.0 KiB + 24.5 KiB = 192.5 KiB atd
180.0 KiB + 18.5 KiB = 198.5 KiB brcm_iscsiuio
188.0 KiB + 37.0 KiB = 225.0 KiB rpc.statd
208.0 KiB + 26.0 KiB = 234.0 KiB audispd
208.0 KiB + 39.5 KiB = 247.5 KiB hald-runner
244.0 KiB + 23.5 KiB = 267.5 KiB smartd
240.0 KiB + 35.5 KiB = 275.5 KiB hpiod
244.0 KiB + 35.0 KiB = 279.0 KiB hcid
228.0 KiB + 73.0 KiB = 301.0 KiB hald-addon-keyboard (2)
328.0 KiB + 32.5 KiB = 360.5 KiB gam_server
336.0 KiB + 31.5 KiB = 367.5 KiB xinetd
364.0 KiB + 28.5 KiB = 392.5 KiB auditd
420.0 KiB + 78.0 KiB = 498.0 KiB mingetty (6)
552.0 KiB + 19.5 KiB = 571.5 KiB udevd
532.0 KiB + 56.0 KiB = 588.0 KiB rpc.idmapd
544.0 KiB + 51.5 KiB = 595.5 KiB ssh-agent
372.0 KiB + 225.0 KiB = 597.0 KiB sh (2)
612.0 KiB + 28.0 KiB = 640.0 KiB crond
484.0 KiB + 175.0 KiB = 659.0 KiB avahi-daemon (2)
744.0 KiB + 74.5 KiB = 818.5 KiB automount
756.0 KiB + 186.5 KiB = 942.5 KiB gnome-vfs-daemon
736.0 KiB + 295.0 KiB = 1.0 MiB dbus-daemon (2)
988.0 KiB + 61.5 KiB = 1.0 MiB pcscd
824.0 KiB + 231.5 KiB = 1.0 MiB pam-panel-icon
1.0 MiB + 26.0 KiB = 1.1 MiB nmon
864.0 KiB + 229.5 KiB = 1.1 MiB bt-applet
712.0 KiB + 402.0 KiB = 1.1 MiB nm-system-settings
1.0 MiB + 63.0 KiB = 1.1 MiB nmbd
996.0 KiB + 131.0 KiB = 1.1 MiB bonobo-activation-server
740.0 KiB + 398.5 KiB = 1.1 MiB escd
868.0 KiB + 375.0 KiB = 1.2 MiB bash (2)
1.1 MiB + 212.5 KiB = 1.3 MiB gnome-screensaver
796.0 KiB + 621.5 KiB = 1.4 MiB gdm-rh-security-token-helper
1.2 MiB + 387.5 KiB = 1.6 MiB gnome-session
916.0 KiB + 749.5 KiB = 1.6 MiB gdm-binary (2)
1.4 MiB + 225.0 KiB = 1.6 MiB cupsd
1.3 MiB + 443.5 KiB = 1.8 MiB notification-area-applet
2.1 MiB + 68.0 KiB = 2.2 MiB xfs
1.8 MiB + 545.5 KiB = 2.3 MiB eggcups
2.2 MiB + 86.5 KiB = 2.3 MiB gconfd-2
1.9 MiB + 492.5 KiB = 2.4 MiB gnome-settings-daemon
2.0 MiB + 421.5 KiB = 2.4 MiB gnome-power-manager
1.9 MiB + 570.0 KiB = 2.5 MiB trashapplet
1.7 MiB + 1.0 MiB = 2.7 MiB smbd (2)
2.6 MiB + 422.0 KiB = 3.0 MiB iscsid (2)
2.7 MiB + 350.0 KiB = 3.0 MiB sendmail.sendmail (2)
3.2 MiB + 72.0 KiB = 3.2 MiB hald
2.0 MiB + 1.3 MiB = 3.3 MiB sshd (3)
2.7 MiB + 651.0 KiB = 3.4 MiB clock-applet
2.5 MiB + 1.4 MiB = 3.9 MiB nm-applet
3.4 MiB + 728.5 KiB = 4.1 MiB metacity
3.4 MiB + 853.0 KiB = 4.3 MiB wnck-applet
4.4 MiB + 376.5 KiB = 4.8 MiB Xorg
4.3 MiB + 718.5 KiB = 5.0 MiB mixer_applet2
4.5 MiB + 809.5 KiB = 5.3 MiB gnome-panel
5.3 MiB + 251.5 KiB = 5.6 MiB hpssd.py
6.2 MiB + 4.1 MiB = 10.3 MiB httpd (18)
10.5 MiB + 869.0 KiB = 11.3 MiB gdmgreeter
12.8 MiB + 1.1 MiB = 13.8 MiB Xvnc
13.7 MiB + 515.5 KiB = 14.2 MiB yum-updatesd
16.3 MiB + 1.6 MiB = 17.9 MiB nautilus
20.8 MiB + 1.4 MiB = 22.2 MiB puplet
1.5 GiB + 441.0 KiB = 1.5 GiB java
---------------------------------
1.7 GiB
=================================
Private + Shared = RAM used Program
108.0 KiB + 11.5 KiB = 119.5 KiB klogd
124.0 KiB + 15.0 KiB = 139.0 KiB hidd
128.0 KiB + 12.5 KiB = 140.5 KiB gpm
116.0 KiB + 29.5 KiB = 145.5 KiB hald-addon-storage
120.0 KiB + 28.0 KiB = 148.0 KiB acpid
128.0 KiB + 25.0 KiB = 153.0 KiB dbus-launch
128.0 KiB + 31.5 KiB = 159.5 KiB hald-addon-acpi
144.0 KiB + 20.0 KiB = 164.0 KiB sdpd
140.0 KiB + 26.5 KiB = 166.5 KiB pam_timestamp_check
152.0 KiB + 16.5 KiB = 168.5 KiB irqbalance
152.0 KiB + 20.0 KiB = 172.0 KiB init
148.0 KiB + 26.0 KiB = 174.0 KiB mapping-daemon
152.0 KiB + 25.5 KiB = 177.5 KiB gnome-keyring-daemon
152.0 KiB + 27.5 KiB = 179.5 KiB portmap
164.0 KiB + 18.0 KiB = 182.0 KiB syslogd
168.0 KiB + 24.5 KiB = 192.5 KiB atd
180.0 KiB + 18.5 KiB = 198.5 KiB brcm_iscsiuio
188.0 KiB + 37.0 KiB = 225.0 KiB rpc.statd
208.0 KiB + 24.0 KiB = 232.0 KiB audispd
208.0 KiB + 40.5 KiB = 248.5 KiB hald-runner
244.0 KiB + 23.5 KiB = 267.5 KiB smartd
240.0 KiB + 35.5 KiB = 275.5 KiB hpiod
244.0 KiB + 35.0 KiB = 279.0 KiB hcid
228.0 KiB + 75.0 KiB = 303.0 KiB hald-addon-keyboard (2)
196.0 KiB + 144.0 KiB = 340.0 KiB sh
328.0 KiB + 32.5 KiB = 360.5 KiB gam_server
336.0 KiB + 32.5 KiB = 368.5 KiB xinetd
364.0 KiB + 28.5 KiB = 392.5 KiB auditd
420.0 KiB + 84.0 KiB = 504.0 KiB mingetty (6)
552.0 KiB + 19.5 KiB = 571.5 KiB udevd
532.0 KiB + 56.0 KiB = 588.0 KiB rpc.idmapd
544.0 KiB + 50.5 KiB = 594.5 KiB ssh-agent
612.0 KiB + 29.0 KiB = 641.0 KiB crond
484.0 KiB + 176.0 KiB = 660.0 KiB avahi-daemon (2)
576.0 KiB + 164.0 KiB = 740.0 KiB sftp-server
744.0 KiB + 74.5 KiB = 818.5 KiB automount
756.0 KiB + 186.5 KiB = 942.5 KiB gnome-vfs-daemon
736.0 KiB + 296.0 KiB = 1.0 MiB dbus-daemon (2)
988.0 KiB + 61.5 KiB = 1.0 MiB pcscd
824.0 KiB + 231.5 KiB = 1.0 MiB pam-panel-icon
1.0 MiB + 26.0 KiB = 1.1 MiB nmon
864.0 KiB + 229.5 KiB = 1.1 MiB bt-applet
712.0 KiB + 398.0 KiB = 1.1 MiB nm-system-settings
1.0 MiB + 63.0 KiB = 1.1 MiB nmbd
996.0 KiB + 131.0 KiB = 1.1 MiB bonobo-activation-server
740.0 KiB + 395.5 KiB = 1.1 MiB escd
880.0 KiB + 432.0 KiB = 1.3 MiB bash (2)
1.1 MiB + 212.5 KiB = 1.3 MiB gnome-screensaver
796.0 KiB + 617.5 KiB = 1.4 MiB gdm-rh-security-token-helper
916.0 KiB + 739.5 KiB = 1.6 MiB gdm-binary (2)
1.2 MiB + 387.5 KiB = 1.6 MiB gnome-session
1.4 MiB + 221.0 KiB = 1.6 MiB cupsd
1.3 MiB + 443.5 KiB = 1.8 MiB notification-area-applet
2.1 MiB + 69.0 KiB = 2.2 MiB xfs
1.8 MiB + 545.5 KiB = 2.3 MiB eggcups
2.2 MiB + 86.5 KiB = 2.3 MiB gconfd-2
1.9 MiB + 492.5 KiB = 2.4 MiB gnome-settings-daemon
2.0 MiB + 421.5 KiB = 2.4 MiB gnome-power-manager
1.9 MiB + 569.0 KiB = 2.5 MiB trashapplet
1.7 MiB + 1.0 MiB = 2.7 MiB smbd (2)
2.6 MiB + 365.0 KiB = 2.9 MiB iscsid (2)
2.7 MiB + 349.0 KiB = 3.0 MiB sendmail.sendmail (2)
3.2 MiB + 73.0 KiB = 3.2 MiB hald
2.7 MiB + 649.0 KiB = 3.4 MiB clock-applet
2.5 MiB + 1.4 MiB = 3.9 MiB nm-applet
3.4 MiB + 729.5 KiB = 4.1 MiB metacity
2.8 MiB + 1.4 MiB = 4.2 MiB sshd (4)
3.4 MiB + 853.0 KiB = 4.3 MiB wnck-applet
4.4 MiB + 377.5 KiB = 4.8 MiB Xorg
4.3 MiB + 717.5 KiB = 5.0 MiB mixer_applet2
4.5 MiB + 809.5 KiB = 5.3 MiB gnome-panel
5.3 MiB + 251.5 KiB = 5.6 MiB hpssd.py
4.0 MiB + 3.3 MiB = 7.2 MiB httpd (11)
10.5 MiB + 870.0 KiB = 11.3 MiB gdmgreeter
12.8 MiB + 1.1 MiB = 13.8 MiB Xvnc
13.7 MiB + 515.5 KiB = 14.2 MiB yum-updatesd
16.3 MiB + 1.6 MiB = 17.9 MiB nautilus
20.8 MiB + 1.4 MiB = 22.2 MiB puplet
1.5 GiB + 438.0 KiB = 1.5 GiB java
---------------------------------
1.7 GiB
================================="))
input1<- input
input2<- str_trim(gsub("[=+]","",input1))
input3<- input2[input2!=""]
dat1<-read.table(text=gsub("\\,+",",",gsub("\\s{2}",",",input3)),sep=",",header=FALSE,stringsAsFactors=FALSE,fill=TRUE)
dat2<- dat1[,3:4]
dat3<- dat2[dat2[,1]!="",][-1,]
lst1<-lapply(split(dat3,cumsum(1*grepl("RAM",dat3[,1]))),function(x) {x1<-if(length(grep("RAM",x[,1]))>0) x[-grep("RAM",x[,1]),] else x; x2<- data.frame(read.table(text=x1[,1],sep="",header=FALSE,stringsAsFactors=FALSE),x1[,2],stringsAsFactors=FALSE); colnames(x2)<- c("RAM", "used", "Program");x2})
str(lst1)
#List of 2
# $ 0:'data.frame': 79 obs. of 3 variables:
# ..$ RAM : num [1:79] 98.5 119.5 139 140.5 144.5 ...
# ..$ used : chr [1:79] "KiB" "KiB" "KiB" "KiB" ...
# ..$ Program: chr [1:79] "sleep" "klogd" "hidd" "gpm" ...
# $ 1:'data.frame': 79 obs. of 3 variables:
# ..$ RAM : num [1:79] 120 139 140 146 148 ...
# ..$ used : chr [1:79] "KiB" "KiB" "KiB" "KiB" ...
# ..$ Program: chr [1:79] "klogd" "hidd" "gpm" "hald-addon-storage" ...
lapply(lst1,head)
#$`0`
# RAM used Program
#1 98.5 KiB sleep
#2 119.5 KiB klogd
#3 139.0 KiB hidd
#4 140.5 KiB gpm
#5 144.5 KiB hald-addon-storage
#6 148.0 KiB acpid
#
#$`1`
# RAM used Program
#1 119.5 KiB klogd
#2 139.0 KiB hidd
#3 140.5 KiB gpm
#4 145.5 KiB hald-addon-storage
#5 148.0 KiB acpid
#6 153.0 KiB dbus-launch
A.K.
----- Original Message -----
From: "mohan.radhakrishnan at polarisft.com" <mohan.radhakrishnan at polarisft.com>
To: jim holtman <jholtman at gmail.com>
Cc: R mailing list <r-help at r-project.org>
Sent: Wednesday, September 4, 2013 6:43 AM
Subject: Re: [R] Memory usage bar plot
Hi,
I have tried the ideas with an actual data set but couldn't
pass the parsing phase. The name of the 'Program' varies. MiB and KiB are
both included.
I should have shown the real-time data set.
Private + Shared = RAM used Program
84.0 KiB + 14.5 KiB = 98.5 KiB sleep
108.0 KiB + 11.5 KiB = 119.5 KiB klogd
124.0 KiB + 15.0 KiB = 139.0 KiB hidd
128.0 KiB + 12.5 KiB = 140.5 KiB gpm
116.0 KiB + 28.5 KiB = 144.5 KiB hald-addon-storage
120.0 KiB + 28.0 KiB = 148.0 KiB acpid
128.0 KiB + 25.0 KiB = 153.0 KiB dbus-launch
128.0 KiB + 31.5 KiB = 159.5 KiB hald-addon-acpi
144.0 KiB + 19.0 KiB = 163.0 KiB sdpd
152.0 KiB + 16.5 KiB = 168.5 KiB irqbalance
140.0 KiB + 28.5 KiB = 168.5 KiB pam_timestamp_check
152.0 KiB + 20.0 KiB = 172.0 KiB init
148.0 KiB + 26.0 KiB = 174.0 KiB mapping-daemon
152.0 KiB + 25.5 KiB = 177.5 KiB gnome-keyring-daemon
152.0 KiB + 26.5 KiB = 178.5 KiB portmap
164.0 KiB + 16.0 KiB = 180.0 KiB syslogd
168.0 KiB + 24.5 KiB = 192.5 KiB atd
180.0 KiB + 18.5 KiB = 198.5 KiB brcm_iscsiuio
188.0 KiB + 37.0 KiB = 225.0 KiB rpc.statd
208.0 KiB + 26.0 KiB = 234.0 KiB audispd
208.0 KiB + 39.5 KiB = 247.5 KiB hald-runner
244.0 KiB + 23.5 KiB = 267.5 KiB smartd
240.0 KiB + 35.5 KiB = 275.5 KiB hpiod
244.0 KiB + 35.0 KiB = 279.0 KiB hcid
228.0 KiB + 73.0 KiB = 301.0 KiB hald-addon-keyboard (2)
328.0 KiB + 32.5 KiB = 360.5 KiB gam_server
336.0 KiB + 31.5 KiB = 367.5 KiB xinetd
364.0 KiB + 28.5 KiB = 392.5 KiB auditd
420.0 KiB + 78.0 KiB = 498.0 KiB mingetty (6)
552.0 KiB + 19.5 KiB = 571.5 KiB udevd
532.0 KiB + 56.0 KiB = 588.0 KiB rpc.idmapd
544.0 KiB + 51.5 KiB = 595.5 KiB ssh-agent
372.0 KiB + 225.0 KiB = 597.0 KiB sh (2)
612.0 KiB + 28.0 KiB = 640.0 KiB crond
484.0 KiB + 175.0 KiB = 659.0 KiB avahi-daemon (2)
744.0 KiB + 74.5 KiB = 818.5 KiB automount
756.0 KiB + 186.5 KiB = 942.5 KiB gnome-vfs-daemon
736.0 KiB + 295.0 KiB = 1.0 MiB dbus-daemon (2)
988.0 KiB + 61.5 KiB = 1.0 MiB pcscd
824.0 KiB + 231.5 KiB = 1.0 MiB pam-panel-icon
1.0 MiB + 26.0 KiB = 1.1 MiB nmon
864.0 KiB + 229.5 KiB = 1.1 MiB bt-applet
712.0 KiB + 402.0 KiB = 1.1 MiB nm-system-settings
1.0 MiB + 63.0 KiB = 1.1 MiB nmbd
996.0 KiB + 131.0 KiB = 1.1 MiB bonobo-activation-server
740.0 KiB + 398.5 KiB = 1.1 MiB escd
868.0 KiB + 375.0 KiB = 1.2 MiB bash (2)
1.1 MiB + 212.5 KiB = 1.3 MiB gnome-screensaver
796.0 KiB + 621.5 KiB = 1.4 MiB gdm-rh-security-token-helper
1.2 MiB + 387.5 KiB = 1.6 MiB gnome-session
916.0 KiB + 749.5 KiB = 1.6 MiB gdm-binary (2)
1.4 MiB + 225.0 KiB = 1.6 MiB cupsd
1.3 MiB + 443.5 KiB = 1.8 MiB notification-area-applet
2.1 MiB + 68.0 KiB = 2.2 MiB xfs
1.8 MiB + 545.5 KiB = 2.3 MiB eggcups
2.2 MiB + 86.5 KiB = 2.3 MiB gconfd-2
1.9 MiB + 492.5 KiB = 2.4 MiB gnome-settings-daemon
2.0 MiB + 421.5 KiB = 2.4 MiB gnome-power-manager
1.9 MiB + 570.0 KiB = 2.5 MiB trashapplet
1.7 MiB + 1.0 MiB = 2.7 MiB smbd (2)
2.6 MiB + 422.0 KiB = 3.0 MiB iscsid (2)
2.7 MiB + 350.0 KiB = 3.0 MiB sendmail.sendmail (2)
3.2 MiB + 72.0 KiB = 3.2 MiB hald
2.0 MiB + 1.3 MiB = 3.3 MiB sshd (3)
2.7 MiB + 651.0 KiB = 3.4 MiB clock-applet
2.5 MiB + 1.4 MiB = 3.9 MiB nm-applet
3.4 MiB + 728.5 KiB = 4.1 MiB metacity
3.4 MiB + 853.0 KiB = 4.3 MiB wnck-applet
4.4 MiB + 376.5 KiB = 4.8 MiB Xorg
4.3 MiB + 718.5 KiB = 5.0 MiB mixer_applet2
4.5 MiB + 809.5 KiB = 5.3 MiB gnome-panel
5.3 MiB + 251.5 KiB = 5.6 MiB hpssd.py
6.2 MiB + 4.1 MiB = 10.3 MiB httpd (18)
10.5 MiB + 869.0 KiB = 11.3 MiB gdmgreeter
12.8 MiB + 1.1 MiB = 13.8 MiB Xvnc
13.7 MiB + 515.5 KiB = 14.2 MiB yum-updatesd
16.3 MiB + 1.6 MiB = 17.9 MiB nautilus
20.8 MiB + 1.4 MiB = 22.2 MiB puplet
1.5 GiB + 441.0 KiB = 1.5 GiB java
---------------------------------
1.7 GiB
=================================
Private + Shared = RAM used Program
108.0 KiB + 11.5 KiB = 119.5 KiB klogd
124.0 KiB + 15.0 KiB = 139.0 KiB hidd
128.0 KiB + 12.5 KiB = 140.5 KiB gpm
116.0 KiB + 29.5 KiB = 145.5 KiB hald-addon-storage
120.0 KiB + 28.0 KiB = 148.0 KiB acpid
128.0 KiB + 25.0 KiB = 153.0 KiB dbus-launch
128.0 KiB + 31.5 KiB = 159.5 KiB hald-addon-acpi
144.0 KiB + 20.0 KiB = 164.0 KiB sdpd
140.0 KiB + 26.5 KiB = 166.5 KiB pam_timestamp_check
152.0 KiB + 16.5 KiB = 168.5 KiB irqbalance
152.0 KiB + 20.0 KiB = 172.0 KiB init
148.0 KiB + 26.0 KiB = 174.0 KiB mapping-daemon
152.0 KiB + 25.5 KiB = 177.5 KiB gnome-keyring-daemon
152.0 KiB + 27.5 KiB = 179.5 KiB portmap
164.0 KiB + 18.0 KiB = 182.0 KiB syslogd
168.0 KiB + 24.5 KiB = 192.5 KiB atd
180.0 KiB + 18.5 KiB = 198.5 KiB brcm_iscsiuio
188.0 KiB + 37.0 KiB = 225.0 KiB rpc.statd
208.0 KiB + 24.0 KiB = 232.0 KiB audispd
208.0 KiB + 40.5 KiB = 248.5 KiB hald-runner
244.0 KiB + 23.5 KiB = 267.5 KiB smartd
240.0 KiB + 35.5 KiB = 275.5 KiB hpiod
244.0 KiB + 35.0 KiB = 279.0 KiB hcid
228.0 KiB + 75.0 KiB = 303.0 KiB hald-addon-keyboard (2)
196.0 KiB + 144.0 KiB = 340.0 KiB sh
328.0 KiB + 32.5 KiB = 360.5 KiB gam_server
336.0 KiB + 32.5 KiB = 368.5 KiB xinetd
364.0 KiB + 28.5 KiB = 392.5 KiB auditd
420.0 KiB + 84.0 KiB = 504.0 KiB mingetty (6)
552.0 KiB + 19.5 KiB = 571.5 KiB udevd
532.0 KiB + 56.0 KiB = 588.0 KiB rpc.idmapd
544.0 KiB + 50.5 KiB = 594.5 KiB ssh-agent
612.0 KiB + 29.0 KiB = 641.0 KiB crond
484.0 KiB + 176.0 KiB = 660.0 KiB avahi-daemon (2)
576.0 KiB + 164.0 KiB = 740.0 KiB sftp-server
744.0 KiB + 74.5 KiB = 818.5 KiB automount
756.0 KiB + 186.5 KiB = 942.5 KiB gnome-vfs-daemon
736.0 KiB + 296.0 KiB = 1.0 MiB dbus-daemon (2)
988.0 KiB + 61.5 KiB = 1.0 MiB pcscd
824.0 KiB + 231.5 KiB = 1.0 MiB pam-panel-icon
1.0 MiB + 26.0 KiB = 1.1 MiB nmon
864.0 KiB + 229.5 KiB = 1.1 MiB bt-applet
712.0 KiB + 398.0 KiB = 1.1 MiB nm-system-settings
1.0 MiB + 63.0 KiB = 1.1 MiB nmbd
996.0 KiB + 131.0 KiB = 1.1 MiB bonobo-activation-server
740.0 KiB + 395.5 KiB = 1.1 MiB escd
880.0 KiB + 432.0 KiB = 1.3 MiB bash (2)
1.1 MiB + 212.5 KiB = 1.3 MiB gnome-screensaver
796.0 KiB + 617.5 KiB = 1.4 MiB gdm-rh-security-token-helper
916.0 KiB + 739.5 KiB = 1.6 MiB gdm-binary (2)
1.2 MiB + 387.5 KiB = 1.6 MiB gnome-session
1.4 MiB + 221.0 KiB = 1.6 MiB cupsd
1.3 MiB + 443.5 KiB = 1.8 MiB notification-area-applet
2.1 MiB + 69.0 KiB = 2.2 MiB xfs
1.8 MiB + 545.5 KiB = 2.3 MiB eggcups
2.2 MiB + 86.5 KiB = 2.3 MiB gconfd-2
1.9 MiB + 492.5 KiB = 2.4 MiB gnome-settings-daemon
2.0 MiB + 421.5 KiB = 2.4 MiB gnome-power-manager
1.9 MiB + 569.0 KiB = 2.5 MiB trashapplet
1.7 MiB + 1.0 MiB = 2.7 MiB smbd (2)
2.6 MiB + 365.0 KiB = 2.9 MiB iscsid (2)
2.7 MiB + 349.0 KiB = 3.0 MiB sendmail.sendmail (2)
3.2 MiB + 73.0 KiB = 3.2 MiB hald
2.7 MiB + 649.0 KiB = 3.4 MiB clock-applet
2.5 MiB + 1.4 MiB = 3.9 MiB nm-applet
3.4 MiB + 729.5 KiB = 4.1 MiB metacity
2.8 MiB + 1.4 MiB = 4.2 MiB sshd (4)
3.4 MiB + 853.0 KiB = 4.3 MiB wnck-applet
4.4 MiB + 377.5 KiB = 4.8 MiB Xorg
4.3 MiB + 717.5 KiB = 5.0 MiB mixer_applet2
4.5 MiB + 809.5 KiB = 5.3 MiB gnome-panel
5.3 MiB + 251.5 KiB = 5.6 MiB hpssd.py
4.0 MiB + 3.3 MiB = 7.2 MiB httpd (11)
10.5 MiB + 870.0 KiB = 11.3 MiB gdmgreeter
12.8 MiB + 1.1 MiB = 13.8 MiB Xvnc
13.7 MiB + 515.5 KiB = 14.2 MiB yum-updatesd
16.3 MiB + 1.6 MiB = 17.9 MiB nautilus
20.8 MiB + 1.4 MiB = 22.2 MiB puplet
1.5 GiB + 438.0 KiB = 1.5 GiB java
---------------------------------
1.7 GiB
=================================
Thanks,
Mohan
From: jim holtman <jholtman at gmail.com>
To: mohan.radhakrishnan at polarisft.com
Cc: R mailing list <r-help at r-project.org>
Date: 08/30/2013 07:14 PM
Subject: Re: [R] Memory usage bar plot
Here is how to parse the data and put it into groups. Not sure what
the 'timing' of each group is since not time information was given.
Also not sure is there is an 'MiB' qualifier on the data, but you have
the matrix of data which is easy to do with as you want.
> input <- readLines(textConnection("
+ Private + Shared = RAM used Program
+
+ 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd
+ 108.0 KiB + 12.5 KiB = 120.5 KiB klogd
+ 124.0 KiB + 17.0 KiB = 141.0 KiB hidd
+ 116.0 KiB + 30.0 KiB = 146.0 KiB acpid
+ 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage
+ 144.0 KiB + 15.0 KiB = 159.0 KiB gpm
+ 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check
+ ---------------------------------------------------------
+ 453.9 MiB
+
+ =================================
+ Private + Shared = RAM used Program
+
+ 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd
+ 108.0 KiB + 12.5 KiB = 120.5 KiB klogd
+ 124.0 KiB + 17.0 KiB = 141.0 KiB hidd
+ 116.0 KiB + 30.0 KiB = 146.0 KiB acpid
+ 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage
+ 144.0 KiB + 15.0 KiB = 159.0 KiB gpm
+ 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check
+ ----------------------------------------------------------
+ 453.9 MiB
+ ================================="))
>
> # keep only the data
> input <- input[grepl('=', input)]
>
> # separate into groups
> grps <- split(input, cumsum(grepl("= RAM", input)))
>
> # parse the data (not sure if there is also 'MiB')
> parsed <- lapply(grps, function(.grp){
+ # parse ignoring first and last lines
+ .data <- sub(".*= ([^ ]+) ([^ ]+)\\s+(.*)", "\\1 \\2 \\3"
+ , .grp[2:(length(.grp) - 1L)]
+ )
+ # return matrix
+ do.call(rbind, strsplit(.data, ' '))
+ })
>
>
>
> parsed
$`1`
[,1] [,2] [,3]
[1,] "107.5" "KiB" "uuidd"
[2,] "120.5" "KiB" "klogd"
[3,] "141.0" "KiB" "hidd"
[4,] "146.0" "KiB" "acpid"
[5,] "153.5" "KiB" "hald-addon-storage"
[6,] "159.0" "KiB" "gpm"
[7,] "162.5" "KiB" "pam_timestamp_check"
$`2`
[,1] [,2] [,3]
[1,] "107.5" "KiB" "uuidd"
[2,] "120.5" "KiB" "klogd"
[3,] "141.0" "KiB" "hidd"
[4,] "146.0" "KiB" "acpid"
[5,] "153.5" "KiB" "hald-addon-storage"
[6,] "159.0" "KiB" "gpm"
[7,] "162.5" "KiB" "pam_timestamp_check"
>
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Fri, Aug 30, 2013 at 7:24 AM, <mohan.radhakrishnan at polarisft.com>
wrote:
> Hi,
> I haven't tried the code yet. Is there a way to parse this
data
> using R and create bar plots so that each program's 'RAM used' figures
are
> grouped together.
> So 'uuidd' bars will be together. The data will have about 50 sets. So
if
> there are 100 processes each will have about 50 bars.
>
> What is the recommended way to graph these big barplots ? I am looking
for
> only 'RAM used' figures.
>
>
> Thanks,
> Mohan
>
>
> Private + Shared = RAM used Program
>
> 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd
> 108.0 KiB + 12.5 KiB = 120.5 KiB klogd
> 124.0 KiB + 17.0 KiB = 141.0 KiB hidd
> 116.0 KiB + 30.0 KiB = 146.0 KiB acpid
> 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage
> 144.0 KiB + 15.0 KiB = 159.0 KiB gpm
> 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check
> ---------------------------------------------------------
> 453.9 MiB
>
> =================================
> Private + Shared = RAM used Program
>
> 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd
> 108.0 KiB + 12.5 KiB = 120.5 KiB klogd
> 124.0 KiB + 17.0 KiB = 141.0 KiB hidd
> 116.0 KiB + 30.0 KiB = 146.0 KiB acpid
> 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage
> 144.0 KiB + 15.0 KiB = 159.0 KiB gpm
> 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check
> ----------------------------------------------------------
> 453.9 MiB
> =================================
>
>
> This e-Mail may contain proprietary and confidential information and is
sent for the intended recipient(s) only. If by an addressing or
transmission error this mail has been misdirected to you, you are
requested to delete this mail immediately. You are also hereby notified
that any use, any form of reproduction, dissemination, copying,
disclosure, modification, distribution and/or publication of this e-mail
message, contents or its attachment other than by its intended recipient/s
is strictly prohibited.
>
> Visit us at http://www.polarisFT.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit us at http://www.polarisFT.com
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list