mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
feature: new reading 'cpu_model_name'
git-svn-id: https://svn.fhem.de/fhem/trunk@8384 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
381236795d
commit
d9e73d38d2
@ -62,6 +62,7 @@ use constant {
|
|||||||
CPU6_FREQ => "cpu6_freq",
|
CPU6_FREQ => "cpu6_freq",
|
||||||
CPU7_FREQ => "cpu7_freq",
|
CPU7_FREQ => "cpu7_freq",
|
||||||
CPU_BOGOMIPS => "cpu_bogomips",
|
CPU_BOGOMIPS => "cpu_bogomips",
|
||||||
|
CPU_MODEL_NAME=>"cpu_model_name",
|
||||||
CPU_TEMP => "cpu_temp",
|
CPU_TEMP => "cpu_temp",
|
||||||
CPU0_TEMP => "cpu0_temp",
|
CPU0_TEMP => "cpu0_temp",
|
||||||
CPU1_TEMP => "cpu1_temp",
|
CPU1_TEMP => "cpu1_temp",
|
||||||
@ -246,6 +247,7 @@ SYSMON_updateCurrentReadingsMap($) {
|
|||||||
}
|
}
|
||||||
$rMap->{+DATE} = "Date";
|
$rMap->{+DATE} = "Date";
|
||||||
$rMap->{+CPU_BOGOMIPS} = "BogoMIPS";
|
$rMap->{+CPU_BOGOMIPS} = "BogoMIPS";
|
||||||
|
$rMap->{+CPU_MODEL_NAME} = "CPU model name";
|
||||||
if(SYSMON_isCPUFreqRPiBBB($hash)) {
|
if(SYSMON_isCPUFreqRPiBBB($hash)) {
|
||||||
$rMap->{"cpu_freq"} = "CPU frequency";
|
$rMap->{"cpu_freq"} = "CPU frequency";
|
||||||
$rMap->{"cpu0_freq"} = "CPU frequency";
|
$rMap->{"cpu0_freq"} = "CPU frequency";
|
||||||
@ -1087,7 +1089,7 @@ SYSMON_obtainParameters_intern($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(SYSMON_isProcFS($hash)) {
|
if(SYSMON_isProcFS($hash)) {
|
||||||
$map = SYSMON_getCPUBogoMIPS($hash, $map);
|
$map = SYSMON_getCPUInfo($hash, $map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SYSMON_isFB($hash)) {
|
if(SYSMON_isFB($hash)) {
|
||||||
@ -1736,31 +1738,40 @@ SYSMON_getCPUFreq($$;$) {
|
|||||||
#}
|
#}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# leifert CPU Speed in BogoMIPS
|
# leifert CPU Infos (Model name & Speed in BogoMIPS)
|
||||||
|
# TEST: {Dumper(SYSMON_getCPUInfo($defs{sysmon},undef))}
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
sub
|
sub
|
||||||
SYSMON_getCPUBogoMIPS($$) {
|
SYSMON_getCPUInfo($$) {
|
||||||
my ($hash, $map) = @_;
|
my ($hash, $map) = @_;
|
||||||
|
|
||||||
if($hash->{helper}->{excludes}{'bogomips'}) {return $map;}
|
if($hash->{helper}->{excludes}{'cpuinfo'}) {return $map;}
|
||||||
|
|
||||||
my $old_val = ReadingsVal($hash->{NAME},CPU_BOGOMIPS,undef);
|
my $old_val1 = ReadingsVal($hash->{NAME},CPU_BOGOMIPS,undef);
|
||||||
|
my $old_val2 = ReadingsVal($hash->{NAME},CPU_MODEL_NAME,undef);
|
||||||
# nur einmalig ermitteln (wird sich ja nicht aendern
|
# nur einmalig ermitteln (wird sich ja nicht aendern
|
||||||
if(!defined $old_val) {
|
if(!defined($old_val1) || !defined($old_val2)) {
|
||||||
my @aval = SYSMON_execute($hash, "cat /proc/cpuinfo | grep 'BogoMIPS'");
|
#my @aval = SYSMON_execute($hash, "cat /proc/cpuinfo | grep 'BogoMIPS'");
|
||||||
#SYSMON_Log($hash, 5, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ".Dumper(@aval)); # TODO: Delete
|
my @aval = SYSMON_execute($hash, "cat /proc/cpuinfo");
|
||||||
my $val=$aval[0];
|
foreach my $line (@aval) {
|
||||||
#SYSMON_Log($hash, 5, "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ".$val); # TODO: Delete
|
my($key, $val) = split(/\s*:\s+/, $line);
|
||||||
if(defined($val)){
|
if(defined($key)) {
|
||||||
#Log 3,"SYSMON -----------> DEBUG: read BogoMIPS = $val";
|
if($key=~m/Processor/ || $key=~m/model name/) {
|
||||||
my ($dummy, $val_txt) = split(/:\s+/, $val);
|
if($val) {
|
||||||
if($val_txt) {
|
$val = trim($val);
|
||||||
$val_txt = trim($val_txt);
|
$map->{+CPU_MODEL_NAME}=$val;
|
||||||
$map->{+CPU_BOGOMIPS}="$val_txt";
|
}
|
||||||
|
} elsif ($key=~m/BogoMIPS/) {
|
||||||
|
if($val) {
|
||||||
|
$val = trim($val);
|
||||||
|
$map->{+CPU_BOGOMIPS}=$val;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$map->{+CPU_BOGOMIPS}=$old_val;
|
$map->{+CPU_BOGOMIPS}=$old_val1;
|
||||||
|
$map->{+CPU_MODEL_NAME}=$old_val2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map;
|
return $map;
|
||||||
@ -1853,8 +1864,7 @@ SYSMON_getCPUBogoMIPS($$) {
|
|||||||
# This is the total number of sectors requested to be written to
|
# This is the total number of sectors requested to be written to
|
||||||
# this partition.
|
# this partition.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
sub
|
sub SYSMON_getDiskStat($$) {
|
||||||
SYSMON_getDiskStat($$) {
|
|
||||||
my ($hash, $map) = @_;
|
my ($hash, $map) = @_;
|
||||||
|
|
||||||
if($hash->{helper}->{excludes}{'diskstat'}) {return $map;}
|
if($hash->{helper}->{excludes}{'diskstat'}) {return $map;}
|
||||||
@ -3044,7 +3054,7 @@ sub SYSMON_ShowValuesFmt ($$$;@)
|
|||||||
CPU_TEMP.":"."CPU temperature".": ".$deg."C",
|
CPU_TEMP.":"."CPU temperature".": ".$deg."C",
|
||||||
#CPU_FREQ.":".$hash->{helper}{cur_readings_map}->{+CPU_FREQ}.": "."MHz",
|
#CPU_FREQ.":".$hash->{helper}{cur_readings_map}->{+CPU_FREQ}.": "."MHz",
|
||||||
CPU_FREQ.":"."CPU frequency".": "."MHz",
|
CPU_FREQ.":"."CPU frequency".": "."MHz",
|
||||||
CPU_BOGOMIPS,
|
CPU_MODEL_NAME, CPU_BOGOMIPS,
|
||||||
UPTIME_TEXT, FHEMUPTIME_TEXT, LOADAVG, RAM, SWAP,
|
UPTIME_TEXT, FHEMUPTIME_TEXT, LOADAVG, RAM, SWAP,
|
||||||
"power_ac_text", "power_usb_text", "power_battery_text");
|
"power_ac_text", "power_usb_text", "power_battery_text");
|
||||||
|
|
||||||
@ -3992,6 +4002,9 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
|||||||
<li>cpu_core_count<br>
|
<li>cpu_core_count<br>
|
||||||
CPU core count
|
CPU core count
|
||||||
</li>
|
</li>
|
||||||
|
<li>cpu_model_name<br>
|
||||||
|
CPU model name
|
||||||
|
</li>
|
||||||
<li>cpu_bogomips<br>
|
<li>cpu_bogomips<br>
|
||||||
CPU Speed: BogoMIPS
|
CPU Speed: BogoMIPS
|
||||||
</li>
|
</li>
|
||||||
@ -4361,7 +4374,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
|||||||
<li>exclude<br>
|
<li>exclude<br>
|
||||||
Allows to suppress reading certain information. <br>
|
Allows to suppress reading certain information. <br>
|
||||||
supported values: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,
|
supported values: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,
|
||||||
loadavg, cputemp, cpufreq, bogomips, diskstat, cpustat, ramswap, filesystem, network,
|
loadavg, cputemp, cpufreq, cpuinfo, diskstat, cpustat, ramswap, filesystem, network,
|
||||||
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
|
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
@ -4591,6 +4604,9 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
|||||||
<li>cpu_core_count<br>
|
<li>cpu_core_count<br>
|
||||||
Anzahl der CPU Kerne
|
Anzahl der CPU Kerne
|
||||||
</li>
|
</li>
|
||||||
|
<li>cpu_model_name<br>
|
||||||
|
CPU Modellname
|
||||||
|
</li>
|
||||||
<li>cpu_bogomips<br>
|
<li>cpu_bogomips<br>
|
||||||
CPU Speed: BogoMIPS
|
CPU Speed: BogoMIPS
|
||||||
</li>
|
</li>
|
||||||
@ -4974,7 +4990,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
|
|||||||
<li>exclude<br>
|
<li>exclude<br>
|
||||||
Erlaubt das Abfragen bestimmten Informationen zu unterbinden. <br>
|
Erlaubt das Abfragen bestimmten Informationen zu unterbinden. <br>
|
||||||
Mögliche Werte: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,
|
Mögliche Werte: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,
|
||||||
loadavg, cputemp, cpufreq, bogomips, diskstat, cpustat, ramswap, filesystem, network,
|
loadavg, cputemp, cpufreq, cpuinfo, diskstat, cpustat, ramswap, filesystem, network,
|
||||||
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
|
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user