The last time Hackerfall tried to access this page, it returned a not found error.
A cached version of the page is below, or click here
to continue anyway
Thyme: a simple CLI to measure human time andfocus
Its like a CPU profiler, but for your productivity rather than your machines
Do you ever think about how to make yourself a more productive programmer? At Sourcegraph, this is a question we think about every day. Our entire mission is to make your life as a developer easier and more efficient.
Thyme is a sampling profiler for your productivity.
Programmers seek out and use tools that we think will help us squeeze the most out of every minute of every hour of every daybut how well do these tools actually work? We need answers to questions like:
- Which applications do I have open the most? Which do I actually use the most?
- How often am I context-switching?
- Whats distracting me from my main focus?
- Where does all my time go?
Time-tracking programs are a dime a dozen, but when we looked around, we didnt find any that wed want to use day-to-day as developers. Existing trackers made you manually enter information, use a clunky GUI, or didnt let you drill down into the data. We wanted a time-tracking utility that had all the things youd expect from a great developer tool: a simple and easy CLI, full control and access to the raw data, and source code thats hackable and open.
So we wrote Thyme, an open-source command-line tool that lets you easily track and analyze the time you spend on your computer. Think of it as a sampling profiler, but for You instead of your machine.
Finding actionable productivity insights withThyme
Thyme tracks which applications you use over time and then helps you explore the data to find actionable insights to boost your productivity. Heres how I used it for this very purposeas I was writing it.
Thyme was written in 2 parts. Part 1, which tracks application usage, was written first. Part 2 displays pretty charts, and was written the day after. Because I had the tracking code working before I wrote the charting logic, I was able to use Thyme to track my app usage as I wrote part 2. Heres what I found.
Chart 1: Application usagetimeline
This first chart shows application usage over the course of the afternoon, from 4pm to 8pm. On the chart, you can see that I had open 3 distinct applications: Google Chrome, Slack, and [email protected]~. The last one is my terminal where I run Emacs (my computers name is claudelong story). Thyme splits the timeline into 3 rows:
- Active: which application has the focus
- Visible: which applications are currently visible on-screen
- All: all applications which currently have open windows
Thymes timeline of application usage
- Both my terminal and Chrome were visible nearly the whole time. This is consistent with what youd expectI was using the terminal to write code in my editor and I was frequently referencing Chrome to look up documentation and usage examples.
- The Active row makes it crystal clear where I was context-switching frequently. You can see that the afternoon see-sawed between periods where I was mainly writing code in my editor and periods where I was actively switching between my editor and Chrome.
- I had Slack open in the background the whole time, but I barely used it.
Chart 2: Detailed application usage breakdown
This second chart breaks down the timeline of application usage by window name. You can see what I was viewing in each application.
Thyme-line of application windows
- In the Active row, you can see that the first 30 minutes of the afternoon was a period of high-frequency context switches. This was when I was deciding which charting library to use, so I was opening a new browser tab every minute and quickly scanning through docs.
- You can see where I became frustrated in the middle of looking for charting libraries. Its the purple chunk of 510 minutes labeled michael phelpsGoogle Search . The number of charting libraries to consider was overwhelming, so I temporarily gave up and started reading some news about the Olympics. (As a side note, holy cow Michael Phelps. What an athlete!)
- Theres a solid 45-minute block of blue in the Active row between 16:30 and 17:30. I remember this period. It was when I wrote 70% of the code and it felt amazing. I was mainly referencing Sourcegraph (template.Mustgolang/go) and the Google charts documentation. Everything I needed was in the Chrome window next to my editor so I was in the zone.
- The remainder of the afternoon shows more frequent context switches and felt less productive. I was mainly tweaking the UI and scanning through documentation for the charting library I was using. You can see frequent switches to out.html, which was the browser window that displayed the work-in-progress Thyme charts UI.
Chart 3: Which apps do you rely onoverall?
This third chart shows an aggregate overview of which applications I used during my afternoon coding session. The interesting thing to note here is the differences in relative order between open, visible, and active applications. I had Slack open the whole time, but I basically never used it. Chrome was by far the most visible, because I was using it frequently to look up documentation and usage examples and test out the Thyme dashboard. But the application that I actually used the most was my terminal, which contained my editor.
Here are some concrete, actionable takeaways I took from diving into this data:
- Frustration leads to distraction. Googling around for different charting libraries and evaluating each on the relative strengths of their API, community, and documentation was an onerous process. Situations like this are dangerous, because you may throw your hands in the air and distract yourself with something that provides a quick hit of dopamine. But doing so often takes you further off the rails. Being generally aware of this fallacy is one thing, but actually seeing it in my Thyme timeline means Ill be more likely to catch myself next time and stay focused.
- UI tweaks eat up a lot of time. After finishing up work, Id felt that the UI tweaks had taken up more time than they should have. But with Thyme, I can confirm that they took more than 2.5 hours! Did it really have to take that long? Probably not. Like a runner who slows down as he nears the finish line, I knew I was basically done and let myself spend too much time playing around with parameters in the charting API. Next time, Ill keep my eyes on the prize and work relentlessly toward it until Im actually done.
- Sourcegraph is pretty handy. This is shameless self-promotion, but the evidence bears it out. The period of least context-switching and highest productivity occurred while I was using Sourcegraph to look up documentation and usage examples for the Go API I was using. That was a satisfying piece of validation, because the reason we created Sourcegraph was to cut down on wasteful context switches and save ourselves time when coding.
If youre interested in using Thyme to investigate your own productivity, you can install Thyme here. Its a single command line tool with 2 simple parts: a time tracker and a data visualizer.
The Thyme tracker snapshots all open windows on your computer at a a given point in time. You can have it output this information to a file. Its like a sampling profiler, but instead of CPU time and processes, it looks at human time and open application windows. You can make it run every 30 seconds like this:
$ watch -n 30 thyme track -o thyme.json
The Thyme data explorer reads data from the tracker output file and shows a single page with interactive charts. You run it with a single command, too:
$ thyme show -i thyme.json -w stats > thyme.html
Then just open thyme.html in your favorite web browser and voila, you get the pretty charts you see above.
All the information Thyme collects is kept safely on your local disk so you have full control over your data. It never sends any information over the Internet.
Thyme currently supports Linux (with X-Windows) and macOS support is on the way soon. Its built with simplicity and hackability in mind. The code is open-source, well-documented, and easily extensible. Try it out and let us know what you think!
Continue reading on text.sourcegraph.com