Saturday, January 2, 2010

Bazylum -- a tool to track x11 windows activity

I was always wondering how much time per day I spend in firefox or, say, pidgin. So I finally managed to implement a tool which would track that. I called it bazylum - "lazy bum" joined together and first chars swapped. Funny, but after such a transformation it still has quite sensible meaning. :-) According to urbandict, bazy means being doing nothing. Lum is more ambiguous word, check it if interested as well.

Getting back to the tool itself. It basically reports how much time a certain window was active, here's the sample:


(20:50) novel@dirtyvegas:~/code/bazylum[master] %> ./bazylum stat
urxvt: 9952 sec
Navigator: 3934 sec
gvim: 1818 sec
xv: 1515 sec
pidgin: 121 sec
desktop: 10 sec
Dialog: 6 sec

avg window active time: 25 sec
longest active time: 658 sec
(20:50) novel@dirtyvegas:~/code/bazylum[master] %>


So, from that report I can see that the majority of time I've spent in urxvt (that is good), the second popular window is firefox (aka Navigator) and I spent only 2 minutes chatting in pidgin (also good). Also, it says that average time before window change is just 25 seconds and the longest time when window was active is only about 11 minutes. It means that my concentration is not very good, probably a sign that I suffer from AD/HD.

If you like the idea, you might want to take a look at the project's github page. The tool is written in C and requires sqlite3 and x11 (you will need -dev packages or something like that on binary based distros). To build it, simply type 'make'. Then collector should be started using './bazylumd' -- it will fork into background and start collecting window activity information. You might pass '-f' arg to it and it will stay in the foreground. And use './bazylum stat' to view the report. The tool is obviously on its early stage of development but works alright on my desktop and laptop.

No comments:

Post a Comment