Skip to content

Commit

Permalink
Added Busy+Idle Workers, cleaned up counter behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
itsderek23 committed Feb 21, 2012
1 parent 0da6c79 commit 6f4a54b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions apache_load/apache_load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ def build_report
values[k] = v
end
total_accesses = values['Total Accesses'].to_i
if (memory(:last_run_total_accesses) && memory(:last_run_time))
accesses_since_last_run = total_accesses - memory(:last_run_total_accesses)
seconds_since_last_run = Time.now - memory(:last_run_time)
else
accesses_since_last_run = total_accesses
seconds_since_last_run = values['Uptime'].to_i
end

current_accesses_per_second = accesses_since_last_run / seconds_since_last_run

report(:current_load => current_accesses_per_second)
remember(:last_run_time => Time.now)
remember(:last_run_total_accesses => total_accesses)
counter(:current_load, total_accesses, :per => :second)
report(:busy_workers => values['BusyWorkers'].to_i, :idle_workers => values['IdleWorkers'].to_i)
end
end

0 comments on commit 6f4a54b

Please sign in to comment.