A while ago, I thought: „I seem to be less productive than I used to be. Why might that be? Do I spend more and more time with e-Mails? Or is it something else?“ I couldn’t tell, so I needed a time tracking tool. There are a few of those for Linux that allow you, while working, specify what you are doing and then generate statistics about it. This approach has a few disadvantages:
So I created arbtt, the Automatic Rule-Based Time Tracker. It comes with a background program that is started with your desktop session and will, each minute, record what windows are open, which one is active, what their titles and corresponding programs are. It also checks how long the user has been idle. No interaction required, no distraction possible. This information is stored in a log file. A separate tool allows the user to investigate this data. It is called rule-based because the mapping from the raw data to sensible “tags” that give information about the time sample is specified by a simple, but hopefully sufficiently powerful language.
A simple example for a rule that indicates the currently used program would be:
The prefix “Program:” is a category. Arbtt will ensure that for each time sample and category, at most one tag is specified. A more complex rule is
current window $title =~ m!(?:~|home/jojo)/projekte/(?:programming/(?:haskell/)?)?([^/)]*)!
==> tag Project:$1,
which makes use of the fact that both GVim and gnome-terminal display the full path to the currently edited file resp. to the working directory in the window title. This rule will track all my projects separately, and even automatically pick up new projects when they appear! You can see more rules in the example file.
The statistics program then allows you to query the tags with some options:
Usage: arbtt-stats [OPTIONS...]
-h, -? --help show this help
-V --version show the version number
-x TAG --exclude=TAG ignore samples containing this tag
-o TAG --only=TAG only consider samples containing this tag
--also-inactive include samples with the tag "inactive"
-m PERC --min-percentage=PERC do not show tags with a percentage lower than PERC% (default: 1)
-i --information show general statistics about the data
-t --total-time show total time for each tag
-c CATEGORY --category=CATEGORY show statistics about category CATEGORY
For example, if I want to know what folders I have open while using evolution, I can run arbtt-stats -o Program:evolution -c Evo-Folder -m 3 to see this:
Statistics for category Evo-Folder
|| Time Percentage
Evo-Folder:Eingang || 22h20m00s 17.0%
Evo-Folder:Bekannte || 16h40m00s 12.7%
Evo-Folder:d-haskell || 9h40m00s 7.4%
Evo-Folder:Itomig || 8h20m00s 6.4%
Evo-Folder:Verschickt || 7h40m00s 5.8%
Evo-Folder:pkg-fso-maint || 7h00m00s 5.3%
Evo-Folder:Bugs || 6h00m00s 4.6%
Evo-Folder:planet debian || 4h00m00s 3.0%
(60 entries omitted) || 4h49m00s 36.7%
(unmatched time) || 8m00s 1.0%
One big advantage of this approach is that you do not need to know in advance what queries you are interested in. Since the rules are applied when you are evaluating your data, and not when recording it, you can add more tags and forgotten special cases later.
At this point, a big warning is due: This program will record a lot of very sensitive information about you. Be aware of this before you start using arbtt, and make sure you protect your data. You can get rid of all logs by deleting ~/.arbtt/capture.log.
I have published arbtt on hackage. If you have cabal-install installed, you can install it with cabal install arbtt. See the README file for more information about setting it up. Depending on the feedback I get I will also consider packaging it for Debian.
If you want to contribute, you are very welcome. The code is available at the darcs repository http://darcs.nomeata.de/arbtt/ (DarcsWeb). See the README for some ideas what to implement and feel free to come up with new ideas.
Have something to say? You can post a comment by sending an e-Mail to me at <firstname.lastname@example.org>, and I will include it here.