Trace Event Profiling with chrome://tracing and SPDR

March 14, 2013 by nicolas, tagged programming, filed under tools

Knowing more about my code has been a part-time obsession for a couple of years now both at work and outside. Can you really improve what you cannot measure or even visualize?

After some months I had settled with monitoring a certain number of variables in a HTML/Javascript page hosted inside my programs, using the mongoose http server.

However this article from August 2012 made me reconsider writing my own visualization console.

Furthermore, I value very much reusing APIs / protocols (when reusing implementations is not necessary or even needed) and so the trace event profiling API outlined there gave me the needed push to start my own implementation, whose first version I am releasing today: uu.spdr-v0.1.0

It is called SPDR, and allow you to label sections of your code, track the evolution of values with minimum overhead, and importantly in a format compatible with Google’s trace viewer, which almost every one has at their desk in the form of chrome.

The SPDR library is lightweight, compiles for Windows, OS X and POSIX platforms. It is designed to not allocate more memory than you want to use, and supports concurrent traces.

Google’s trace viewer code is also available standalone, which should make it easy to embed in your app.

PHPException (2)

count(): Parameter must be an array or an object that implements Countable

in /home/neq/nicolas.uucidl.com/gitblog/themes/uucidl/post.php:24

  </div>
  <!-- =========================== comments =========================== -->
  <? if ($post->commentsOpen || count($post->comments)): ?>
  <div id="comments">
    <hr/>
::require(1) called in gitblog/themes/uucidl/index.php:101
    }
    elseif (gb::$is_post || gb::$is_page) {
      require gb::$theme_dir.'/post.php';
    }
    elseif (gb::$is_posts || gb::$is_tags || gb::$is_categories) {