<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/bumpspark_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -44,7 +44,7 @@ version: 2.5.1
 
 /* Styling */
 #tuneup { height: 50px; color: #ddd; background: #000 url(/images/tuneup/head.gif) 0 100% repeat-x; padding: 0 0 0 10px; font-family: &quot;Helvetica Neue&quot;, &quot;Lucida Grande&quot;, Calibri, Helvetica, Verdana, sans-serif; font-size: 12px; }
-#tuneup #tuneup-content { margin-left: 170px; color: #000; height: 50px; vertical-align: middle; text-align: left; }
+#tuneup #tuneup-content { margin-left: 170px; color: #ddd; height: 50px; vertical-align: middle; text-align: left; }
 #tuneup #tuneup-root-bar { float: right; }
 #tuneup a, #tuneup a:visited, #tuneup a:active { color: #fff; text-decoration: underline; font-size: 12px; border: 0; }
 
@@ -176,4 +176,5 @@ version: 2.5.1
 #tuneup #tuneup-data:hover #tuneup-schema { display: block; }
 #tuneup #tuneup-schema table, #tuneup #tuneup-schema tr { background: transparent; }
 #tuneup #tuneup-schema th { background: #111; color: #fff; border: 0 }
-#tuneup #tuneup-schema td { background: #000; font-family: monospace; color: #ddd; padding: 1px; font-size: 11px; }
\ No newline at end of file
+#tuneup #tuneup-schema td { background: #000; font-family: monospace; color: #ddd; padding: 1px; font-size: 11px; }
+#tuneup #tuneup-trend { float: right; width: 100px; }
\ No newline at end of file</diff>
      <filename>assets/stylesheets/tuneup.css</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@ module Fiveruns
       
       attr_writer :collecting
       attr_accessor :running
-      attr_accessor :current_run_id
+      attr_reader :trend
       
       def run(controller, request)
         @running = (!controller.is_a?(TuneupController) &amp;&amp; !request.xhr?)
@@ -41,12 +41,12 @@ module Fiveruns
       def record(controller, request)
         if recording?
           @stack = [Fiveruns::Tuneup::RootStep.new]
+          @trend = nil
           @environment = environment
-          self.current_run_id = generate_run_id(request.url)
           yield
           log :info, &quot;Persisting for #{request.url} using stub #{stub(request.url)}&quot;
-          persist(self.current_run_id, @environment, schemas, @stack.shift)
-          self.current_run_id = nil
+          data = @stack.shift
+          persist(generate_run_id(request.url, data.time), @environment, schemas, data)
         elsif !@running
           # Plugin displaying the data
           # TODO: Support targeted selection (for historical run)
@@ -55,6 +55,7 @@ module Fiveruns
             log :info, &quot;Retrieved last run id of #{last_id} for #{request.parameters['uri']} using stub #{stub(request.parameters['uri'])}&quot;
             if last_id &amp;&amp; (data = retrieve_run(last_id))
               @stack = [data]
+              @trend = trend_for(last_id)
             else
               log :debug, &quot;No stack found&quot;
               clear_stack
@@ -79,7 +80,6 @@ module Fiveruns
       
       def start
         log :info, &quot;Starting...&quot;
-        reset! unless ENV['FIVERUNS_TUNEUP_RETAIN']
         install_instrumentation
         log :debug, &quot;Using collector at #{collector_url}&quot;
         log :debug, &quot;Using frontend at #{frontend_url}&quot;
@@ -92,13 +92,6 @@ module Fiveruns
       #######
       private
       #######
-
-      # Remove all runs from this session
-      def reset!
-        FileUtils.rm_rf run_dir
-      rescue
-        # Nothing to remove, ignore
-      end
       
       def clear_stack
         @stack = []</diff>
      <filename>lib/fiveruns/tuneup.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,10 +21,6 @@ module Fiveruns
         YAML.load(decompressed)
       end
       
-      def run_files
-        Dir[File.join(run_dir, '*.yml.gz')]
-      end
-      
       def last_filename_for_run_uri(uri)
         filename_for(last_run_id_for(uri))
       end
@@ -33,6 +29,12 @@ module Fiveruns
       private
       #######
       
+      def trend_for(run_id)
+        Dir[File.join(run_dir, File.dirname(run_id), &quot;*.gz&quot;)].map do |filename|
+          Integer(File.basename(filename, '.yml.gz').split('_').last)
+        end
+      end
+      
       def last_run_id_for(url)
         last_file = Dir[File.join(run_dir, stub(url), '*.gz')].last
         if last_file
@@ -40,9 +42,10 @@ module Fiveruns
         end
       end
       
-      def generate_run_id(url)
+      # Use Run ID, current timestamp, and total time (in microseconds)
+      def generate_run_id(url, time)
         timestamp = '%d' % (Time.now.to_f * 1000)
-        File.join(stub(url), timestamp.to_s)
+        File.join(stub(url), timestamp.to_s &lt;&lt; &quot;_#{(time * 1000).to_i}&quot;)
       end
       
       def persist(run_id, environment, schemas, data)</diff>
      <filename>lib/fiveruns/tuneup/runs.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
 module TuneupHelper #:nodoc:
+  
+  include BumpsparkHelper
 
   def tuneup_signin_url
     &quot;#{Fiveruns::Tuneup.collector_url}/users&quot;
@@ -39,6 +41,18 @@ module TuneupHelper #:nodoc:
     Fiveruns::Tuneup.stack.first['schemas']
   end
   
+  def trend
+    numbers= if Fiveruns::Tuneup.trend.size &gt; 50
+      Fiveruns::Tuneup.trend[-50..-1]
+    else
+      Fiveruns::Tuneup.trend
+    end
+    return unless numbers.size &gt; 1
+    tag(:img,
+      :src =&gt; build_data_url(&quot;image/png&quot;,bumpspark(numbers)), :alt =&gt; '',
+      :title =&gt; &quot;Trend over last #{pluralize(numbers.size, 'run')}&quot;)
+  end
+  
   def tuneup_step_link(step)
     name = tuneup_style_step_name(tuneup_truncate_step_name(step))
     link = if step.children.any?</diff>
      <filename>lib/tuneup_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,15 @@ namespace :fiveruns do
   
   namespace :tuneup do
     
+    namespace :tmp do
+      
+      desc &quot;Clear tempory data (runs, etc)&quot;
+      task :clear =&gt; :environment do
+        rm_rf File.join(RAILS_ROOT, 'tmp', 'tuneup')
+      end
+      
+    end
+    
     namespace :assets do
           
       desc &quot;Install assets&quot;</diff>
      <filename>tasks/assets.rake</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
   &lt;div id='tuneup-top'&gt;
     &lt;div id='tuneup-summary'&gt;
       &lt;%= tuneup_bar(tuneup_data, :id =&gt; 'tuneup-root-bar') %&gt;
-      &lt;%= pluralize(tuneup_data.size, 'step') %&gt; / &lt;%= tuneup_data.time.to_i %&gt; ms
+      &lt;%= trend %&gt; &lt;%= tuneup_data.time.to_i %&gt; ms 
     &lt;/div&gt;
     &lt;%= link_to_remote &quot;Upload this Run&quot;, :url =&gt; &quot;/tuneup/upload?uri=#{CGI.escape(params[:uri])}&quot;, :html =&gt; {:id =&gt; 'tuneup-save-link'} %&gt;
   &lt;/div&gt;</diff>
      <filename>views/tuneup/_data.html.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ded4b3df3a16d2ffc7cefc2af62f56b8a5e599b8</id>
    </parent>
  </parents>
  <author>
    <name>Bruce Williams</name>
    <email>bruce@codefluency.com</email>
  </author>
  <url>http://github.com/fiveruns/fiveruns_tuneup/commit/7aa130b7c3921fb8beb7132413b8d5c3bfe0ec00</url>
  <id>7aa130b7c3921fb8beb7132413b8d5c3bfe0ec00</id>
  <committed-date>2008-05-23T23:50:06-07:00</committed-date>
  <authored-date>2008-05-23T23:50:06-07:00</authored-date>
  <message>Remove steps (took too much explanation, anyhow), add trending sparkline (pure Ruby, inline img data implementation)</message>
  <tree>a14fc5f06403f6acc1d2792f71b556c623b38b14</tree>
  <committer>
    <name>Bruce Williams</name>
    <email>bruce@codefluency.com</email>
  </committer>
</commit>
