Average memory utilization of httpd process

I drew a graph showing the average memory utilization of a httpd process. I am not claiming that this is a rigorous approach but I get average figures over a period of time. I don’t have time in the axes because it was not needed.

library(stringr)

this.dir setwd(this.dir)
png(file="httpdaveragememory.png",width=900,height=350,res=72)

input 6.2 httpd (18)
 4.0 httpd (11)
 4.0 httpd (11)
 3.3 httpd (9)
 4.2 httpd (12)
 4.2 httpd (12)
 4.2 httpd (12)
 4.2 httpd (12)
 4.2 httpd (12)
"))

data colnames(data) data["Average"] <- "NA"
data$Average plot(row(data)[,1], data$Average,xlim=c(0,nrow(data)),col="green",pch=16,type="b", ylab="MBytes", xlab="Hours",las=2,lwd=2.5,cex.axis=1)

print(data)
dev.off()

Steps followed to parse the data

> data <- read.table(text=gsub(“[()]”,””,str_trim(input[input!=””])),sep=””,header=FALSE,stringsAsFactors=FALSE)
> data
V1 V2 V3
1 6.2 httpd 18
2 4.0 httpd 11
3 4.0 httpd 11
4 3.3 httpd 9
5 4.2 httpd 12
6 4.2 httpd 12
7 4.2 httpd 12
8 4.2 httpd 12
9 4.2 httpd 12
> colnames(data) <- c(“MB”,”Process”,”Count”)
> data
MB Process Count
1 6.2 httpd 18
2 4.0 httpd 11
3 4.0 httpd 11
4 3.3 httpd 9
5 4.2 httpd 12
6 4.2 httpd 12
7 4.2 httpd 12
8 4.2 httpd 12
9 4.2 httpd 12
> data[“Average”] <- “NA”
> data
MB Process Count Average
1 6.2 httpd 18 NA
2 4.0 httpd 11 NA
3 4.0 httpd 11 NA
4 3.3 httpd 9 NA
5 4.2 httpd 12 NA
6 4.2 httpd 12 NA
7 4.2 httpd 12 NA
8 4.2 httpd 12 NA
9 4.2 httpd 12 NA
> data$Average <- data$MB / data$Count
> data
MB Process Count Average
1 6.2 httpd 18 0.3444444
2 4.0 httpd 11 0.3636364
3 4.0 httpd 11 0.3636364
4 3.3 httpd 9 0.3666667
5 4.2 httpd 12 0.3500000
6 4.2 httpd 12 0.3500000
7 4.2 httpd 12 0.3500000
8 4.2 httpd 12 0.3500000
9 4.2 httpd 12 0.3500000
> row(data)
[,1] [,2] [,3] [,4]
[1,] 1 1 1 1
[2,] 2 2 2 2
[3,] 3 3 3 3
[4,] 4 4 4 4
[5,] 5 5 5 5
[6,] 6 6 6 6
[7,] 7 7 7 7
[8,] 8 8 8 8
[9,] 9 9 9 9
> row(data)[,1]
[1] 1 2 3 4 5 6 7 8 9

Graph

httpdaveragememory

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: