code formating

Thursday, June 7, 2012

Monitor windows performance

When a windows box it's behaving strangely and you don't know what to do, log some performance attributes and plot them with R. It's amazing what you can learn from logging stuff on a live environment. On these notes, something I learned the hard way, is the usefulness of plotting. When it comes to system resources, I believe, logging and plotting should go together. The former it's necessary and the later will give you an overview and point you to the things that move out of "normal".

I'm sure there are plenty of ways and applications to do what I just mentioned, but I would like to approach it from Unix way of thinking where raw files are the matter. The R language will then model the matter into nice plots.

So what I did was to to generate a register count using perfmon. You decide which counters to add. The problem I was facing was .NET out of memory exceptions. So I added some counters on memory. In order to plot with R, a convenient way is to save a file using tab separated values. You can do all this using perfmon which comes with the Microsoft operating system.

Ones you have the file populated with enough data, run R and load the file like this:
variable = read.table(file("file_name.tsv",encoding="utf-8"),header=FALSE) 

Because I have not used headers (it was giving me problems), I needed to delete the first line before using the previous command.

Now that the values are in R, You can plot as you wish. One interesting point is to format the date to POSIXct before plotting to make R understand dates:
plot(as.POSIXct(RV1,format="%m/%d/%Y %H:%M:%S", by="time"),R$V4)

Let the logs run for few hours and some interesting patterns will start to emerge.

No comments:

Post a Comment

Programatically walk a CATIA tree in .NET

One of the most basic tasks when automating anything in CATIA, it's usually to walk the whole tree and apply some changes to objects in ...