autocore: show cpubench score
This commit is contained in:
parent
10da1d9fc0
commit
fcc82e37ba
@ -12,6 +12,11 @@ var callSystemInfo = rpc.declare({
|
||||
method: 'info'
|
||||
});
|
||||
|
||||
var callCPUBench = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getCPUBench'
|
||||
});
|
||||
|
||||
var callCPUInfo = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getCPUInfo'
|
||||
@ -29,6 +34,7 @@ return L.Class.extend({
|
||||
return Promise.all([
|
||||
L.resolveDefault(callSystemBoard(), {}),
|
||||
L.resolveDefault(callSystemInfo(), {}),
|
||||
L.resolveDefault(callCPUBench(), {}),
|
||||
L.resolveDefault(callCPUInfo(), {}),
|
||||
L.resolveDefault(callCPUUsage(), {}),
|
||||
fs.lines('/usr/lib/lua/luci/version.lua')
|
||||
@ -38,9 +44,10 @@ return L.Class.extend({
|
||||
render: function(data) {
|
||||
var boardinfo = data[0],
|
||||
systeminfo = data[1],
|
||||
cpuinfo = data[2],
|
||||
cpuusage = data[3],
|
||||
luciversion = data[4];
|
||||
cpubench = data[2],
|
||||
cpuinfo = data[3],
|
||||
cpuusage = data[4],
|
||||
luciversion = data[5];
|
||||
|
||||
luciversion = luciversion.filter(function(l) {
|
||||
return l.match(/^\s*(luciname|luciversion)\s*=/);
|
||||
@ -65,7 +72,7 @@ return L.Class.extend({
|
||||
|
||||
var fields = [
|
||||
_('Hostname'), boardinfo.hostname,
|
||||
_('Model'), boardinfo.model,
|
||||
_('Model'), boardinfo.model + cpubench.cpubench,
|
||||
_('CPU Info'), cpuinfo.cpuinfo,
|
||||
_('Architecture'), boardinfo.system,
|
||||
_('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''),
|
||||
|
||||
@ -629,6 +629,16 @@ local methods = {
|
||||
end
|
||||
},
|
||||
|
||||
getCPUBench = {
|
||||
call = function()
|
||||
local sys = require "luci.sys"
|
||||
local cpubench = {}
|
||||
|
||||
cpubench.cpubench = sys.exec("cat /etc/bench.log 2>/dev/null")
|
||||
return cpubench
|
||||
end
|
||||
},
|
||||
|
||||
getOnlineUsers = {
|
||||
call = function()
|
||||
local sys = require "luci.sys"
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
"ubus": {
|
||||
"file": [ "list", "read", "stat" ],
|
||||
"iwinfo": [ "assoclist", "freqlist", "txpowerlist", "countrylist" ],
|
||||
"luci": [ "getConntrackList", "getInitList", "getLocaltime", "getProcessList", "getRealtimeStats", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints", "getCPUUsage", "getOnlineUsers", "getETHInfo" ],
|
||||
"luci": [ "getConntrackList", "getInitList", "getLocaltime", "getProcessList", "getRealtimeStats", "getTimezones", "getLEDs", "getUSBDevices", "getSwconfigFeatures", "getSwconfigPortState", "getBlockDevices", "getMountPoints", "getCPUBench", "getCPUUsage", "getOnlineUsers", "getETHInfo" ],
|
||||
"luci-rpc": [ "getBoardJSON", "getDHCPLeases", "getDSLStatus", "getDUIDHints", "getHostHints", "getNetworkDevices", "getWirelessDevices" ],
|
||||
"network.interface": [ "dump" ],
|
||||
"network.rrdns": [ "lookup" ],
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
/bin/coremark > /tmp/coremark.log
|
||||
|
||||
cat /tmp/coremark.log | grep "CoreMark 1.0" | cut -d "/" -f 1 > /etc/bench.log
|
||||
sed -i 's/CoreMark 1.0/(CpuMark/g' /etc/bench.log
|
||||
sed -i 's/CoreMark 1.0/ (CpuMark/g' /etc/bench.log
|
||||
echo " Scores)" >> /etc/bench.log
|
||||
|
||||
if [ -f "/etc/bench.log" ]; then
|
||||
sed -i '/coremark/d' /etc/crontabs/root
|
||||
crontab /etc/crontabs/root
|
||||
fi
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user