-
Notifications
You must be signed in to change notification settings - Fork 0
/
coretemp.rb
49 lines (38 loc) · 846 Bytes
/
coretemp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require "open-uri"
# change to your core temp's directory
csv = Dir.glob("c:/program files/core temp/*.csv").last
$content = open(csv) do |file|
$content = file.read
end
def _parse index
$content.split("\n")[-2].split(",")[index]
end
# $dll(cgi,1,coretemp.rb,temp)
def temp
_parse(1).to_i
end
# $dll(cgi,1,coretemp.rb,low_temp)
def low_temp
_parse(4).to_i
end
# $dll(cgi,1,coretemp.rb,high_temp)
def high_temp
_parse(5).to_i
end
# $dll(cgi,1,coretemp.rb,core_load)
def core_load
_parse(6).to_i
end
# $dll(cgi,1,coretemp.rb,speed)
def speed
_parse(7).to_i
end
# $dll(cgi,1,coretemp.rb,speed_pct#$CPUSpeed)
def speed_pct cpu_speed
((speed().to_f / cpu_speed.to_f) * 100).to_f.round(0)
end
# $dll(cgi,1,coretemp.rb,processor)
def processor
$content.match(/Processor:,(.*)/).to_a.last
end
main()