Universal Stopwatch for UNIX Shell

How to calculate application performance? This is not a brand new question since there’s lots of benchmark software available on each purposes. For example, we can reckon a web based application performance from Firefox add-in named lori (Life of Request Info). This add-in do some basic statistic such as counting downloaded bytes & elapsed time from first click to load the application until it finished rendered to the browser – a simple tool than YSlow (of-course with different purpose), AFAIK. The best is, both of tools above support multi-platform in a Firefox browser. The image below is picture of lori & YSlow inside Firefox running over OpenSolaris 2008.11 on my netbook.



To counting how long process on a non-web based application will take time, perhaps you can try stopwatch application. For some OS, this kit is a build-in feature or at least it’s available on repositories. Below picture explain kind-of stopwatch application on Ubuntu 10.04 downloaded from default repository.



In a meantime you need to perform benchmark on an application but don’t have any internet connection to get those stopwatch (or you have forget to carry-up your watch or cell-phone), you can try to build your own stopwatch kit. The sample below, explain you how to make it from bash scripting shell & absolutely this is a universal kit for multi-platform on UNIX.

#!/bin/bash
BEGIN=$(date +%s)
while true; do
NOW=$(date +%s)
DIFF=$(($NOW - $BEGIN))
MINS=$(($DIFF / 60))
SECS=$(($DIFF % 60))
printf "\rTotal Waktu: %d:%02d" $MINS $SECS
done


Save the script above on text editor and make it executable. Run it from console & do whatever you want to do after doing that.



Have a great day!

Labels: , , ,

Sincerelly,

Eko Wahyudiharto
PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address:

Delivered by FeedBurner

Post a Comment Bookmark and Share

 

Post a Comment

Leave comments here...