This is a mirror of official site: http://jasper-net.blogspot.com/

The little gem that is BusyBox (for Windows)

| Sunday, April 10, 2011
As a Windows user (no shame) I have, for years searched for a simple GNU-like toolkit - grep, awk, tail and other such goodies enjoyed by Linux users. Yes, there's Cygwin but it's a beast - too big and a pain to install. Sometimes, I've even resorted to starting a Linux VMWare image just to run a simple awk script to munge some log files.

But today...today I found BusyBox and there's a compact 600KB BusyBox exe for Windows! What does it have? Well.. what does it not have?! It has all the essentials:
[, [[, ar, ash, awk, base64, basename, bash, bbconfig, bunzip2, bzcat,
bzip2, cal, cat, catv, cksum, cmp, comm, cp, cpio, cut, date, dc, dd,
diff, dirname, dos2unix, echo, ed, egrep, env, expand, expr, false,
fgrep, find, fold, getopt, grep, gunzip, gzip, hd, head, hexdump, kill,
killall, length, ls, lzcat, lzma, lzop, lzopcat, md5sum, mkdir, mv, od,
pgrep, pidof, printenv, printf, ps, pwd, rm, rmdir, rpm2cpio, sed, seq,
sh, sha1sum, sha256sum, sha512sum, sleep, sort, split, strings, sum,
tac, tail, tar, tee, test, touch, tr, true, uncompress, unexpand, uniq,
unix2dos, unlzma, unlzop, unxz, unzip, usleep, uudecode, uuencode, vi,
wc, wget, which, whoami, xargs, xz, xzcat, yes, zcat
This is where I'd use it the most - to compress and summarize JVM thread dumps for quick analysis. It's based on JPMP, but here's my version of it. First, download BusyBox for Windows and then use the simple script below to munge your JVM thread dump. 

This is the first part of the script: 
This is the awk pattern that is used by the script above. 
All you have to do now is run it against your thread dump file: 
jpmp.bat ..\jstack.out > ..\jstack.out.log

And it converts a huge file like this... 
2011-04-07 20:44:06
Full thread dump Java HotSpot(TM) 64-Bit Server VM (16.2-b04 mixed mode):

"TimerQueue" daemon prio=6 tid=0x000000004ec33000 nid=0x1268 in Object.wait() [0x000000004a3cf000]
   java.lang.Thread.State: WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000034004608> (a javax.swing.TimerQueue)
 at javax.swing.TimerQueue.run(TimerQueue.java:232)
 - locked <0x0000000034004608> (a javax.swing.TimerQueue)
 at java.lang.Thread.run(Thread.java:619)

"D3D Screen Updater" daemon prio=8 tid=0x000000004af1e000 nid=0x186c in Object.wait() [0x000000004f40f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
 at java.lang.Object.wait(Native Method)
 - waiting on <0x0000000034e16ba8> (a java.lang.Object)

Read more: BusyBox

Posted via email from Jasper-net

0 comments: