mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-07-02 09:39:24 +09:00
add(SlaveLogParser): test for full file (log)
- also added a test case (364_88_longrun)
This commit is contained in:
parent
3d4865c18f
commit
5ca921bcfc
4 changed files with 30366 additions and 12 deletions
|
@ -109,14 +109,14 @@ function parse_qspip_section!(lines::Base.Iterators.Stateful)
|
|||
end
|
||||
|
||||
"""
|
||||
parse_power_section(lines::Base.Iterators.Stateful)
|
||||
parse_power_section!(lines::Base.Iterators.Stateful)::PowerResult
|
||||
|
||||
Parse Power section of given stateful iterator of log.
|
||||
|
||||
# Args
|
||||
- `lines`: Stateful iterator of slave log file lines
|
||||
"""
|
||||
function parse_power_section!(lines::Base.Iterators.Stateful)
|
||||
function parse_power_section!(lines::Base.Iterators.Stateful)::PowerResult
|
||||
line = popfirst!(lines)
|
||||
result_3v3d = let
|
||||
m = match(r"^3V3D \[V\] = ([\d|\.]+)$", line)
|
||||
|
@ -142,9 +142,7 @@ function parse_power_section!(lines::Base.Iterators.Stateful)
|
|||
channelvals =
|
||||
Iterators.map(1:16) do ch
|
||||
ch_s = @sprintf "%x" (ch - 1)
|
||||
re = Regex(
|
||||
"channel $(ch_s): DAC \\[mV\\] = (\\d+), ADC \\[mV\\] = (\\d+)\$",
|
||||
)
|
||||
re = Regex("channel $(ch_s): DAC \\[mV\\] = (\\d+), ADC \\[mV\\] = (\\d+)\$")
|
||||
line = popfirst!(lines) # I'm not sure this mutating operation is called in sequence
|
||||
m = match(re, line)
|
||||
(dac = parse(Int64, m[1]), adc = parse(Int64, m[2]))
|
||||
|
@ -200,14 +198,14 @@ end
|
|||
end
|
||||
|
||||
"""
|
||||
parse_asdtp_section(lines::Base.Iterators.Stateful)
|
||||
parse_asdtp_section!(lines::Base.Iterators.Stateful)::AsdtpResult
|
||||
|
||||
Parse ASDTP section of given stateful iterator of log.
|
||||
|
||||
# Args
|
||||
- `lines`: Stateful iterator of slave log file lines
|
||||
"""
|
||||
function parse_asdtp_section!(lines::Base.Iterators.Stateful)
|
||||
function parse_asdtp_section!(lines::Base.Iterators.Stateful)::AsdtpResult
|
||||
line = popfirst!(lines)
|
||||
result_reconfig_done = let
|
||||
m = match(r"^reconfig_done = (\d+)$", line)
|
||||
|
@ -363,11 +361,13 @@ Main function to parse slave log file.
|
|||
function parse_slavelog_file(filename::AbstractString)
|
||||
lines_iter = Iterators.Stateful(eachline(filename))
|
||||
|
||||
asdtp_results = Any[]
|
||||
asdtp_results = AsdtpResult[]
|
||||
power_results = PowerResult[]
|
||||
|
||||
mode::SlaveLogSection = MODE_NONE
|
||||
# main loop
|
||||
while !isempty(lines_iter)
|
||||
# @info "section" mode
|
||||
# each sections
|
||||
if mode == MODE_NONE
|
||||
line = popfirst!(lines_iter)
|
||||
|
@ -376,7 +376,8 @@ function parse_slavelog_file(filename::AbstractString)
|
|||
parse_qspip_section!(lines_iter)
|
||||
mode = MODE_NONE
|
||||
elseif mode == MODE_POWER
|
||||
parse_power_section!(lines_iter)
|
||||
result = parse_power_section!(lines_iter)
|
||||
push!(power_results, result)
|
||||
mode = MODE_NONE
|
||||
elseif mode == MODE_ASDTP
|
||||
result = parse_asdtp_section!(lines_iter)
|
||||
|
@ -388,8 +389,7 @@ function parse_slavelog_file(filename::AbstractString)
|
|||
end
|
||||
end
|
||||
|
||||
@info "Finished"
|
||||
return asdtp_results
|
||||
return (asdtp = asdtp_results, power = power_results)
|
||||
end
|
||||
|
||||
function eff99_count_map(asdtp_results)
|
||||
|
@ -406,4 +406,4 @@ function eff99_count_map(asdtp_results)
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end # module SlaveLogParser
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue