summaryrefslogtreecommitdiff
path: root/munin/cpufreq
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-07-21 14:23:00 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-07-21 14:23:00 +0000
commit5b82f1c40dae6947feeff05e68913a6a053384c3 (patch)
treeb1ea0a052361b534b2f88d7071b913707c879197 /munin/cpufreq
parent3643c94ea91b3e029140e6c77274c049619f8cf5 (diff)
Rename it
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@154 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'munin/cpufreq')
-rwxr-xr-xmunin/cpufreq69
1 files changed, 0 insertions, 69 deletions
diff --git a/munin/cpufreq b/munin/cpufreq
deleted file mode 100755
index 316ceac..0000000
--- a/munin/cpufreq
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/ruby
-
-# Copyright (c) 2006 Peter Palfrader
-#
-#%# family=auto
-#%# capabilities=autoconf
-
-def bail_out(m)
- STDERR.puts "#{$0}: #{m}"
- exit 1
-end
-
-def autoconf
- if FileTest.directory? "/sys/devices/system/cpu/cpu0/cpufreq/"
- puts "yes"
- else
- puts "no (no /sys/devices/system/cpu/cpu0/cpufreq/)"
- end
-end
-
-def findmasters
- cpudirs = Dir.glob("/sys/devices/system/cpu/cpu*/").map{ |b| File.basename b }
- cpus = cpudirs.map{ |d| /^cpu([0-9]+)$/.match(d)[1].to_i }.sort{|a,b| a<=>b }
- masters = []
- cpus.each do |cpunum|
- affected = IO.read("/sys/devices/system/cpu/cpu#{cpunum}/cpufreq/affected_cpus").split.map{|s| s.to_i}.sort{|a,b| a<=>b }
- bail_out "huh? /sys/devices/system/cpu/cpu#{cpunum}/cpufreq/affected_cpus says it does not affect #{cpunum}!?" unless affected.include? cpunum
- h = {}
- h['cpunum'] = affected[0]
- h['fieldname'] = "cpu#{affected[0]}"
- h['label'] = affected.map{|c| "cpu#{c}"}.join(", ")
- masters.push(h)
- affected.each{ |a| cpus.delete(a) }
- end
- masters
-end
-
-def config
- puts 'graph_title CPU frequency'
- puts 'graph_args --base 1000'
- puts 'graph_vlabel Hz'
- puts 'graph_category cpu'
- puts 'graph_period second'
- puts 'graph_info Shows the CPU frequency of all installed CPUs'
- findmasters.each do |m|
- puts "#{m['fieldname']}.label #{m['label']}"
- puts "#{m['fieldname']}.info Hz"
- puts "#{m['fieldname']}.type GAUGE"
- end
-end
-
-def report
- m = findmasters
- sleep(5) # we are interested how it does without us poking it,
- # so maybe sleeping a bit will help
- m.each do |m|
- value = IO.read("/sys/devices/system/cpu/cpu#{m['cpunum']}/cpufreq/scaling_cur_freq").to_i
- puts "#{m['fieldname']}.value #{value}"
- end
-end
-
-case ARGV[0]
- when "autoconf"
- autoconf
- when "config"
- config
- else
- report
-end