From WikiChip
Difference between revisions of "Module:benchmarks"
Line 66: | Line 66: | ||
local suboject = "|benchmark type=SPEC CPU2017" | local suboject = "|benchmark type=SPEC CPU2017" | ||
− | suboject = suboject .. "\n|spec chip count=" .. arg('chip_count') | + | suboject = suboject .. "\n|spec/chip count=" .. arg('chip_count') |
− | suboject = suboject .. "\n|spec core count=" .. arg('core_count') | + | suboject = suboject .. "\n|spec/core count=" .. arg('core_count') |
− | suboject = suboject .. "\n|spec copies count=" .. arg('copies_count') | + | suboject = suboject .. "\n|spec/copies count=" .. arg('copies_count') |
single_entry(b, 'SPECspeed2017_int_base') | single_entry(b, 'SPECspeed2017_int_base') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specspeed2017_int_base=" .. arg('SPECspeed2017_int_base') |
single_entry(b, 'SPECspeed2017_int_peak') | single_entry(b, 'SPECspeed2017_int_peak') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specspeed2017_int_peak=" .. arg('SPECspeed2017_int_peak') |
single_entry(b, 'SPECspeed2017_fp_base') | single_entry(b, 'SPECspeed2017_fp_base') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specspeed2017_fp_base=" .. arg('SPECspeed2017_fp_base') |
single_entry(b, 'SPECspeed2017_fp_peak') | single_entry(b, 'SPECspeed2017_fp_peak') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specspeed2017_fp_peak=" .. arg('SPECspeed2017_fp_peak') |
single_entry(b, 'SPECrate2017_int_base') | single_entry(b, 'SPECrate2017_int_base') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specrate2017_int_base=" .. arg('SPECrate2017_int_base') |
single_entry(b, 'SPECrate2017_int_peak') | single_entry(b, 'SPECrate2017_int_peak') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specrate2017_int_peak=" .. arg('SPECrate2017_int_peak') |
single_entry(b, 'SPECrate2017_fp_base') | single_entry(b, 'SPECrate2017_fp_base') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specrate2017_fp_base=" .. arg('SPECrate2017_fp_base') |
single_entry(b, 'SPECrate2017_fp_peak') | single_entry(b, 'SPECrate2017_fp_peak') | ||
− | suboject = suboject .. "\n| | + | suboject = suboject .. "\n|spec/specrate2017_fp_peak=" .. arg('SPECrate2017_fp_peak') |
Revision as of 00:20, 24 November 2017
Documentation for this module may be created at Module:benchmarks/doc
local benchmark = {}
local origArgs
function has_arg(name)
-- The argument can exist and be empty or not exist at all
return string.len(origArgs[name] or '') > 0
end
function arg(name)
return origArgs[name] or ''
end
function single_entry(box, argn)
if has_arg(argn) then
box:tag('div'):attr('style', 'min-width: 250px; display: inline-block;'):wikitext("'''" .. argn .. ":''' " .. arg(argn))
end
end
function benchmark.benchmark(frame)
benchmark.frame = frame
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
local benchmarkbox = mw.html.create('div')
benchmarkbox
:attr('style', 'background:#f9f9f9; margin: 10px 2px 10px 2px; padding: 5px; border: 1px solid #a7d7f9;')
if not has_arg('type') then
return "* ERROR: '''WRONG <code>type</code> parameter!'''"
end
if arg('type') == 'spec' then
return benchmark.spec(benchmarkbox)
end
return benchmarkbox
end
function benchmark.spec(box)
if has_arg('SPECspeed2017_int_base') or has_arg('SPECspeed2017_int_peak')
or has_arg('SPECspeed2017_fp_base') or has_arg('SPECspeed2017_fp_peak')
or has_arg('SPECrate2017_int_base') or has_arg('SPECrate2017_int_peak')
or has_arg('SPECrate2017_fp_base') or has_arg('SPECrate2017_fp_peak') then
box:wikitext('[[Category:microprocessor models with spec cpu2017 benchmarks]]')
box:tag('span'):attr('style', 'float: right;'):wikitext(
"'''Test:''' [[spec/cpu2017|SPEC CPU2017]]<br>" ..
"'''Tested:''' " .. '[' .. arg('test_link') .. ' ' .. arg('test_timestamp') .. ']<br>' ..
"'''Chips:''' " .. arg('chip_count') .. ", " ..
"'''Cores:''' " .. arg('core_count') .. ", " ..
"'''Copies:''' " .. arg('copies_count')
)
box:tag('div'):attr('style', 'vertical-align: middle;')
:wikitext("[[File:benchmarks.svg|64px|link=|left]] '''Vendor:''' " ..
arg('vendor') .. "<br>'''System:''' " .. arg('system'))
b = box:tag('div'):attr('style', 'padding: 10px; margin: 0;')
local suboject = "|benchmark type=SPEC CPU2017"
suboject = suboject .. "\n|spec/chip count=" .. arg('chip_count')
suboject = suboject .. "\n|spec/core count=" .. arg('core_count')
suboject = suboject .. "\n|spec/copies count=" .. arg('copies_count')
single_entry(b, 'SPECspeed2017_int_base')
suboject = suboject .. "\n|spec/specspeed2017_int_base=" .. arg('SPECspeed2017_int_base')
single_entry(b, 'SPECspeed2017_int_peak')
suboject = suboject .. "\n|spec/specspeed2017_int_peak=" .. arg('SPECspeed2017_int_peak')
single_entry(b, 'SPECspeed2017_fp_base')
suboject = suboject .. "\n|spec/specspeed2017_fp_base=" .. arg('SPECspeed2017_fp_base')
single_entry(b, 'SPECspeed2017_fp_peak')
suboject = suboject .. "\n|spec/specspeed2017_fp_peak=" .. arg('SPECspeed2017_fp_peak')
single_entry(b, 'SPECrate2017_int_base')
suboject = suboject .. "\n|spec/specrate2017_int_base=" .. arg('SPECrate2017_int_base')
single_entry(b, 'SPECrate2017_int_peak')
suboject = suboject .. "\n|spec/specrate2017_int_peak=" .. arg('SPECrate2017_int_peak')
single_entry(b, 'SPECrate2017_fp_base')
suboject = suboject .. "\n|spec/specrate2017_fp_base=" .. arg('SPECrate2017_fp_base')
single_entry(b, 'SPECrate2017_fp_peak')
suboject = suboject .. "\n|spec/specrate2017_fp_peak=" .. arg('SPECrate2017_fp_peak')
benchmark.frame:preprocess("{{#subobject:\n" .. suboject .. "\n}}")
end
return box
end
return benchmark