title: Linux CPU Usage Tools
body: <p><strong>Background</strong>
  I've written a tool to capture CPU usage on a per/thread basis. The output of the tools is a binary file, that I can pump into my parsing utility that I wrote. And the output of the parsing utility is a CSV file that I can import into Excel to chart pretty graphs of process/thread CPU usage.</p>
  
  <p>This CPU usage capture tool is running on an embedded ARM platform running a Linux kernel based on 2.6.35.3. That being said, I was concerned about making the tool light weight. I didn't want it to store directly to a CSV file, in order to minimize the processing time and the file size of the captured data.</p>
  
  <p><strong>Question</strong>
  The tool works, but I'm wondering if I took the long way around the problem? Is there already a tool out there that does this (or something like it)?</p>
  
  <p>You're probably wondering why I care if I already made a tool that works. Well, it's not as light weight as I'd like. It's taking up about 10% of CPU usage. As a benchmark, <code>top</code> only takes up about 1% (max). </p>
  
  <p><strong>Update</strong>
  I've decided to continue using my tool for now. At least until a better solution becomes available. I was able to shave off a couple percentage points by using <code>open()</code> instead of <code>fopen()</code> on <code>/proc/stat</code>. I'm also using <code>read()</code> instead of <code>fgets()</code>.</p>