Merge branch 'feature-clock-parse' into 'main'

Add Slave Log parser

See merge request wotsubo/PSBoardDataBase!1407
This commit is contained in:
Wataru Otsubo 2024-11-03 21:37:19 +01:00
commit 446dc4c90d
19 changed files with 41880 additions and 54 deletions

View file

@ -4,6 +4,7 @@ authors = ["Wataru Otsubo <wotsubo@icepp.s.u-tokyo.ac.jp>"]
version = "0.2.0-DEV"
[deps]
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
@ -12,6 +13,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
[weakdeps]
@ -21,16 +23,25 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
PSBoardDataBaseInteractiveUtilsExt = "InteractiveUtils"
[compat]
julia = "1.10"
Aqua = "0.8"
AutoHashEquals = "2.2"
CSV = "0.10"
DBInterface = "2"
DataFrames = "1"
Documenter = "1"
Dates = "1.10"
Documenter = "1.7"
Downloads = "1"
InteractiveUtils = "1.10"
Printf = "1.10"
SQLite = "1"
StaticArrays = "1.9"
Tables = "1"
Test = "1.10"
[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
test = ["Test"]
test = ["Aqua", "Test"]

View file

@ -1,8 +1,8 @@
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.5"
julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "7a44705ce6faa370eeecb49dce927460b0d7fd20"
project_hash = "0c756de6376fd167a1756a34f8c071b8d2746ea3"
[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
@ -16,19 +16,26 @@ version = "0.4.5"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
version = "1.1.2"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
[[deps.AutoHashEquals]]
git-tree-sha1 = "4ec6b48702dacc5994a835c1189831755e4e76ef"
uuid = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
version = "2.2.0"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.CSV]]
deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"]
git-tree-sha1 = "6c834533dc1fabd820c1db03c839bf97e45a3fab"
git-tree-sha1 = "deddd8725e5e1cc49ee205a1964256043720a6c3"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.10.14"
version = "0.10.15"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
@ -86,6 +93,7 @@ version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
version = "1.11.0"
[[deps.DocInventories]]
deps = ["CodecZlib", "Downloads", "TOML"]
@ -141,10 +149,12 @@ weakdeps = ["Mmap", "Test"]
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
version = "1.11.0"
[[deps.Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
version = "1.11.0"
[[deps.Git]]
deps = ["Git_jll"]
@ -180,6 +190,7 @@ version = "1.4.2"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
version = "1.11.0"
[[deps.InvertedIndices]]
git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038"
@ -193,9 +204,9 @@ version = "1.0.0"
[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "f389674c99bfcde17dc57454011aa44d5a260a40"
git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.6.0"
version = "1.6.1"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@ -204,9 +215,9 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.4"
[[deps.LaTeXStrings]]
git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.1"
version = "1.4.0"
[[deps.LazilyInitializedFields]]
git-tree-sha1 = "8f7f3cabab0fd1800699663533b6d5cb3fc0e612"
@ -221,16 +232,17 @@ version = "0.6.4"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "8.4.0+0"
version = "8.6.0+0"
[[deps.LibGit2]]
deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
version = "1.11.0"
[[deps.LibGit2_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
version = "1.6.4+0"
version = "1.7.2+0"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
@ -239,23 +251,27 @@ version = "1.11.0+1"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
version = "1.11.0"
[[deps.Libiconv_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175"
git-tree-sha1 = "61dfdba58e585066d8bce214c5a51eaa0539f269"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.17.0+0"
version = "1.17.0+1"
[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
version = "1.11.0"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
version = "1.11.0"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
version = "1.11.0"
[[deps.MarkdownAST]]
deps = ["AbstractTrees", "Markdown"]
@ -266,7 +282,7 @@ version = "0.1.2"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+1"
version = "2.28.6+0"
[[deps.Missings]]
deps = ["DataAPI"]
@ -276,10 +292,11 @@ version = "1.2.0"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
version = "1.11.0"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.1.10"
version = "2023.12.12"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
@ -288,7 +305,7 @@ version = "1.2.0"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.23+4"
version = "0.3.27+1"
[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
@ -307,10 +324,10 @@ uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
version = "10.42.0+1"
[[deps.PSBoardDataBase]]
deps = ["CSV", "DBInterface", "DataFrames", "Dates", "Documenter", "Downloads", "SQLite", "Tables"]
deps = ["AutoHashEquals", "CSV", "DBInterface", "DataFrames", "Dates", "Documenter", "Downloads", "Printf", "SQLite", "StaticArrays", "Tables"]
path = "/home/qwjyh/Documents/school/lab/PSBoard_QAQC/PSBoardDataBase"
uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
version = "0.1.0"
version = "0.2.0"
weakdeps = ["InteractiveUtils"]
[deps.PSBoardDataBase.extensions]
@ -323,9 +340,13 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.8.1"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.10.0"
version = "1.11.0"
weakdeps = ["REPL"]
[deps.Pkg.extensions]
REPLExt = "REPL"
[[deps.PooledArrays]]
deps = ["DataAPI", "Future"]
@ -354,14 +375,17 @@ version = "2.4.0"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
version = "1.11.0"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
version = "1.11.0"
[[deps.Random]]
deps = ["SHA"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
version = "1.11.0"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
@ -392,15 +416,17 @@ version = "3.45.3+0"
[[deps.SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "ff11acffdb082493657550959d4feb4b6149e73a"
git-tree-sha1 = "305becf8af67eae1dbc912ee9097f00aeeabb8d5"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.4.5"
version = "1.4.6"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
version = "1.11.0"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
version = "1.11.0"
[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
@ -408,15 +434,36 @@ git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.2.1"
[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
version = "1.10.0"
[[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
git-tree-sha1 = "777657803913ffc7e8cc20f0fd04b634f871af8f"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.8"
[deps.StaticArrays.extensions]
StaticArraysChainRulesCoreExt = "ChainRulesCore"
StaticArraysStatisticsExt = "Statistics"
[deps.StaticArrays.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[deps.StaticArraysCore]]
git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682"
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
version = "1.4.3"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
deps = ["LinearAlgebra"]
git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0"
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
version = "1.10.0"
version = "1.11.1"
[deps.Statistics.extensions]
SparseArraysExt = ["SparseArrays"]
[deps.Statistics.weakdeps]
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.StringManipulation]]
deps = ["PrecompileTools"]
@ -424,10 +471,9 @@ git-tree-sha1 = "a6b1675a536c5ad1a60e5a5153e1fee12eb146e3"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.4.0"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.2.1+1"
[[deps.StyledStrings]]
uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
version = "1.11.0"
[[deps.TOML]]
deps = ["Dates"]
@ -454,18 +500,21 @@ version = "1.10.0"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
version = "1.11.0"
[[deps.TranscodingStreams]]
git-tree-sha1 = "e84b3a11b9bece70d14cce63406bbc79ed3464d2"
git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.11.2"
version = "0.11.3"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
version = "1.11.0"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
version = "1.11.0"
[[deps.WeakRefStrings]]
deps = ["DataAPI", "InlineStrings", "Parsers"]
@ -491,7 +540,7 @@ version = "5.11.0+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.52.0+1"
version = "1.59.0+0"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]

View file

@ -5,3 +5,6 @@ DocInventories = "43dc2714-ed3b-44b5-b226-857eda1aa7de"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
PSBoardDataBase = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
[compat]
Documenter = "1.7"

View file

@ -136,6 +136,12 @@ Modules = [DownloadCSVs]
Modules = [ClockParser]
```
## `SlaveLogParser`
```@autodocs
Modules = [SlaveLogParser]
```
## `DispatchChecker`
```@autodocs

File diff suppressed because one or more lines are too long

1850
examples/power_stats.jl Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.46
# v0.20.3
using Markdown
using InteractiveUtils

View file

@ -9,6 +9,7 @@ using Dates
include("parse_qaqc_master_log.jl")
include("parse_clock.jl")
include("SlaveLogParser.jl")
include("create_table.jl")
include("download_csv.jl")
@ -73,6 +74,7 @@ function create_database_from_exported_csvs(
add_qaqc_runlist_from_masterlogs(db, masterlog_dir)
add_qaqc_100test_result(db, extra_100test_result_df)
add_skew_from_slave_clk_logs(db, slavelog_dir)
add_slavelog_result(db, slavelog_dir)
db
end

438
src/SlaveLogParser.jl Normal file
View file

@ -0,0 +1,438 @@
"""
Parse QAQC JATHub slave log.
"""
module SlaveLogParser
using StaticArrays
using Printf
using AutoHashEquals
const HEADER_QSPIP_START = "=============== Test QAPIp Start ==============="
const HEADER_POWER_START = "=============== Test Power Start ==============="
const HEADER_ASDTP_START = "=============== Test ASDTP Start ==============="
const HEADER_RECOV_START = "=============== Test Recov Start ==============="
HEADER_STARTS =
SVector(HEADER_QSPIP_START, HEADER_POWER_START, HEADER_ASDTP_START, HEADER_RECOV_START)
"""
Indicate parser state.
Default is `MODE_NONE`.
In `MODE_NONE`, each line is feeded into parser to detect the start of each section.
"""
@enum SlaveLogSection begin
MODE_NONE
MODE_QSPIP
MODE_POWER
MODE_ASDTP
MODE_RECOV
end
struct SlaveLogResult end
"""
get_psbid_runid_from_filename(filename::AbstractString)::Tuple{Int64,Int64,Bool}
Extract info from slave log filename.
Returns a tuple of `psbid`, `runid`, `islongrun`.
"""
function get_psbid_runid_from_filename(filename::AbstractString)::Tuple{Int64, Int64, Bool}
main, _ext = splitext(filename)
parts = split(main, '_')
psbid = parse(Int64, parts[1])
runid = parse(Int64, parts[2])
islongrun = if length(parts) == 3
true
else
false
end
(psbid, runid, islongrun)
end
function is_valid_slavelog(filename::AbstractString)::Bool
error("not yet implemented")
end
"""
detect_mode_start(line::AbstractString)
Detect [`SlaveLogSection`](@ref) from section starting header line.
If the line doesn't match any section, returns `nothing`.
"""
function detect_mode_start(line::AbstractString)
if line == HEADER_QSPIP_START
MODE_QSPIP
elseif line == HEADER_POWER_START
MODE_POWER
elseif line == HEADER_ASDTP_START
MODE_ASDTP
elseif line == HEADER_RECOV_START
MODE_RECOV
else
nothing
end
end
"""
detect_mode_start!(mode::SlaveLogSection, line::AbstractString)
Detect mode from the `line` and update `mode`.
"""
function detect_mode_start(mode::SlaveLogSection, line::AbstractString)
newmode = detect_mode_start(line)
if !isnothing(newmode)
mode = newmode
end
mode
end
"""
parse_qspip_section(lines::Base.Iterators.Stateful)
Parse QSPIp section of given stateful iterator of log.
# Args
- `lines`: Stateful iterator of slave log file lines
"""
function parse_qspip_section!(lines::Base.Iterators.Stateful)
# TODO
nothing
end
# ==================================
# Power
"""
Results from power test
# Fields
- result_3v3d::Float64
- result_3v3a::Float64
- result_n3va::Float64
- fpga_temp::Float64
- channelvals::SVector{16, @NamedTuple{dac::Int64, adc::Int64}}
- result::Bool
"""
struct PowerResult
result_3v3d::Float64
result_3v3a::Float64
result_n3va::Float64
fpga_temp::Float64
channelvals::SVector{16, @NamedTuple{dac::Int64, adc::Int64}}
result::Bool
end
"""
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)::PowerResult
line = popfirst!(lines)
result_3v3d = let
m = match(r"^3V3D \[V\] = ([\d|\.]+)$", line)
parse(Float64, m[1])
end
line = popfirst!(lines)
result_3v3a = let
m = match(r"^3V3A \[V\] = ([\d|\.]+)$", line)
parse(Float64, m[1])
end
line = popfirst!(lines)
result_n3va = let
m = match(r"^-3VA \[V\] = ([-|\d|\.]+)$", line)
parse(Float64, m[1])
end
line = popfirst!(lines)
fpga_temp = let
# can be minus (see 127_172.txt)
m = match(r"^FPGA Temprature \[C\] = (-?[\d|\.]+)$", line)
parse(Float64, m[1])
end
line = popfirst!(lines)
line = popfirst!(lines)
channelvals =
Iterators.map(1:16) do ch
ch_s = @sprintf "%x" (ch - 1)
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]))
end |>
Tuple |>
SVector{16, @NamedTuple{dac::Int64, adc::Int64}}
line = popfirst!(lines)
result = let
m = match(r"^Test Power Reseult = (\d)$", line)
if m[1] == "1"
true
else
false
end
end
PowerResult(result_3v3d, result_3v3a, result_n3va, fpga_temp, channelvals, result)
end
# ==================================
# Asdtp
"""
Measurement result for asic in asdtp test.
"""
@auto_hash_equals struct AsdtpMeasurement
before::Float64
current::Float64
next::Float64
end
AsdtpMeasurement(x::NTuple{3, <:Real}) = AsdtpMeasurement(x...)
function Base.parse(::Type{AsdtpMeasurement}, s::AbstractString)
v = split(s, ':')
@assert length(v) == 3
AsdtpMeasurement(parse(Float64, v[1]), parse(Float64, v[2]), parse(Float64, v[3]))
end
@auto_hash_equals struct AsdtpResult
reconfig_done::Int64
always_hit_flag::Int64
autoreconfig::Union{Bool, Missing}
asdtp_main::Union{Vector{Vector{AsdtpMeasurement}}, Missing}
asdtp_reset::Int64
asdtp_total::Int64
reconfig_done_2::Int64
always_hit_flag_2::Int64
si_done::UInt64
lolb_in::UInt64
ppconfig_done::UInt64
ppconfig_error::UInt64
pllld_fail_counter::UInt64
ppconfig_fail_counter::UInt64
pp_pllds::MVector{8, UInt32}
end
"""
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)::AsdtpResult
line = popfirst!(lines)
result_reconfig_done = let
m = match(r"^reconfig_done = (\d+)$", line)
parse(Int64, m[1])
end
line = popfirst!(lines)
result_always_hit_flag = let
m = match(r"^always_hit_flag = (\d+)$", line)
parse(Int64, m[1])
end
line = popfirst!(lines)
result_autoreconfig = if line == "Autoreconfig done"
true
elseif line == "Autoreconfig fail"
false
else
missing
end
result_asdtp_main = if !ismissing(result_autoreconfig) && result_autoreconfig
line_count = 0
line_count += 1
results = map(_ -> AsdtpMeasurement[], 1:8)
for asic_id in 1:8
header_line = "----PP$(asic_id)----"
while line != header_line
line = popfirst!(lines)
line_count += 1
end
for _ in 1:32
line = popfirst!(lines)
line_count += 1
mes = parse(AsdtpMeasurement, line)
push!(results[asic_id], mes)
end
end
@assert length(results[1]) == 32 "unexpected length: $(length(results[1]))"
line = popfirst!(lines)
@assert line == "100"
results
else
missing
end
line = popfirst!(lines)
result_asdtp_reset, result_asdtp_total = let
m = match(r"^ASDTP : (\d+) times reset : result = (\d+)$", line)
parse(Int64, m[1]), parse(Int64, m[2])
end
line = popfirst!(lines)
result_reconfig_done_2 = let
m = match(r"^reconfig_done = (\d+)$", line)
parse(Int64, m[1])
end
line = popfirst!(lines)
result_always_hit_flag_2 = let
m = match(r"^always_hit_flag = (\d+)$", line)
parse(Int64, m[1])
end
line = popfirst!(lines)
@assert line == ""
line = popfirst!(lines)
@assert line == "------- Done check -------" "actual line: $line"
line = popfirst!(lines)
result_si_done = let
m = match(r"^Si_done = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
line = popfirst!(lines)
result_lolb_in = let
m = match(r"^LOLB_in = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
line = popfirst!(lines)
result_ppconfig_done = let
m = match(r"^PPconfig_done = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
line = popfirst!(lines)
result_ppconfig_error = let
m = match(r"^PPconfig_error = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
line = popfirst!(lines)
result_pllld_fail_counter = let
m = match(r"^PLLLD_fail_counter = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
line = popfirst!(lines)
result_ppconfig_fail_counter = let
m = match(r"^PPconfig_fail_counter = (0x[[:xdigit:]]+)$", line)
parse(UInt64, m[1])
end
result_pp_pllds = MVector{8, UInt32}(undef)
for ppid in 1:8
line = popfirst!(lines)
m = match(Regex("^PP$(ppid)_PLLLD = (0x[[:xdigit:]]+)\$"), line)
result_pp_pllds[ppid] = parse(UInt32, m[1])
end
AsdtpResult(
result_reconfig_done,
result_always_hit_flag,
result_autoreconfig,
result_asdtp_main,
result_asdtp_reset,
result_asdtp_total,
result_reconfig_done_2,
result_always_hit_flag_2,
result_si_done,
result_lolb_in,
result_ppconfig_done,
result_ppconfig_error,
result_pllld_fail_counter,
result_ppconfig_fail_counter,
result_pp_pllds,
)
end
# ==================================
# Recov
"""
parse_recov_section!(lines::Base.Iterators.Stateful)
Parse Recov section of given stateful iterator of log.
# Args
- `lines`: Stateful iterator of slave log file lines
# Return
- `missing`: if failed to parse
- `true`: if successed
- `false`
"""
function parse_recov_section!(lines::Base.Iterators.Stateful)::Union{Bool, Missing}
line = popfirst!(lines)
if startswith("====")(line)
line = popfirst!(lines)
end
m = match(r"Test Recov Result = (\d+)", line)
if isnothing(m)
return missing
else
return m[1] == "1"
end
end
# ==================================
# Main
"""
parse_slavelog_file(filename::AbstractString)
Main function to parse slave log file.
"""
function parse_slavelog_file(filename::AbstractString)
lines_iter = Iterators.Stateful(eachline(filename))
asdtp_results = AsdtpResult[]
power_results = PowerResult[]
recov_results = Union{Bool, Missing}[]
mode::SlaveLogSection = MODE_NONE
# main loop
while !isempty(lines_iter)
# @info "section" mode
# each sections
if mode == MODE_NONE
line = popfirst!(lines_iter)
mode = detect_mode_start(mode, line)
elseif mode == MODE_QSPIP
parse_qspip_section!(lines_iter)
mode = MODE_NONE
elseif mode == MODE_POWER
result = parse_power_section!(lines_iter)
push!(power_results, result)
mode = MODE_NONE
elseif mode == MODE_ASDTP
result = parse_asdtp_section!(lines_iter)
push!(asdtp_results, result)
mode = MODE_NONE
elseif mode == MODE_RECOV
result = parse_recov_section!(lines_iter)
push!(recov_results, result)
mode = MODE_NONE
end
end
return (asdtp = asdtp_results, power = power_results, recov = recov_results)
end
function eff99_count_map(asdtp_results)
# try(100) × channel(8) × channel(32)
@assert length(asdtp_results) == 100
@assert length(asdtp_results[begin]) == 8
@assert length(asdtp_results[begin][begin]) == 32
map(1:8) do i_asic
map(1:32) do i_channel
sum(1:100) do i_try
asdtp_results[i_try][i_asic][i_channel] != AsdtpMeasurement(0, 1, 0)
end
end
end
end
end # module SlaveLogParser

View file

@ -4,14 +4,17 @@
Insert version information of this software as string.
"""
function insert_version_info(db::SQLite.DB)
stmt = DBInterface.prepare(
stmt_insert_version = DBInterface.prepare(
db,
sql"""
INSERT INTO versions VALUES (:converter)
""",
)
@info "converter version info" pkgversion(@__MODULE__) |> string
DBInterface.execute(stmt, (; converter = pkgversion(@__MODULE__) |> string))
DBInterface.execute(
stmt_insert_version,
(; converter = pkgversion(@__MODULE__) |> string),
)
nothing
end
@ -29,12 +32,12 @@ function insert_qaqc_campaign_id(db::SQLite.DB)
(DateTime(2024, 9, 10), DateTime(2024, 9, 12)),
(DateTime(2024, 9, 30), DateTime(2024, 10, 4)),
]
stmt = DBInterface.prepare(
stmt_insert_campaigns = DBInterface.prepare(
db,
sql"INSERT INTO qaqc_campaigns VALUES (:id, :start_date, :end_date, :note)",
)
DBInterface.executemany(
stmt,
stmt_insert_campaigns,
(
id = campaigns,
start_date = dates .|> (x -> x[1]) .|> string,
@ -59,7 +62,7 @@ function insert_qaqc_positions(db::SQLite.DB, jathub_db_table::DataFrame)
Symbol("立ち上がり [ns]") => ByRow(Float64) => Symbol("立ち上がり [ns]"),
)
stmt = DBInterface.prepare(
stmt_insert_positions = DBInterface.prepare(
db,
sql"""
INSERT INTO qaqc_positions
@ -73,7 +76,7 @@ function insert_qaqc_positions(db::SQLite.DB, jathub_db_table::DataFrame)
""",
)
DBInterface.executemany(
stmt,
stmt_insert_positions,
(
id = 1:18,
name = ["B-$i-$j" for i in 0:1 for j in 1:9],
@ -139,12 +142,12 @@ function add_psboard_ids(db::SQLite.DB, single_result_table::DataFrame)
end
filter!(:motherboard_id => !=(999999), df)
stmt = DBInterface.prepare(
stmt_insert_psbid = DBInterface.prepare(
db,
sql"INSERT INTO ps_boards VALUES (:psbid, :daughterboardid)",
)
DBInterface.executemany(
stmt,
stmt_insert_psbid,
(psbid = df.motherboard_id, daughterboardid = df.daughterboard),
)
@ -427,7 +430,7 @@ function add_qaqc_dispatch(db::SQLite.DB, dispatch_table::DataFrame)
dispatch_table = prepare_dispatch_table(dispatch_table)
# TODO: provide datetime
stmt = DBInterface.prepare(
stmt_insert_dispatch = DBInterface.prepare(
db,
sql"""
INSERT INTO qaqc_dispatch(qaqc_campaign_id, psb_id, source_place, destination, time)
@ -436,7 +439,7 @@ function add_qaqc_dispatch(db::SQLite.DB, dispatch_table::DataFrame)
)
DBInterface.executemany(
stmt,
stmt_insert_dispatch,
(campaign_id = dispatch_table.campaign_id, psboard_id = dispatch_table.psboard_id),
)
@ -718,7 +721,7 @@ See [`ClockParser.get_skew`](@ref) for parse detail.
- `630_190`: broken file
"""
function add_skew_from_slave_clk_logs(db::SQLite.DB, logs_dir::AbstractString)
stmt_insrt = DBInterface.prepare(
stmt_insert_skew_to_single_result = DBInterface.prepare(
db,
sql"""
UPDATE qaqc_single_run_results
@ -727,7 +730,7 @@ function add_skew_from_slave_clk_logs(db::SQLite.DB, logs_dir::AbstractString)
""",
)
clk_files =
readdir("$logs_dir/main", join = true) |>
readdir(joinpath(logs_dir, "main"), join = true) |>
filter(endswith("_clk.txt")) |>
filter(!contains("nagoya"))
@ -744,7 +747,7 @@ function add_skew_from_slave_clk_logs(db::SQLite.DB, logs_dir::AbstractString)
end
DBInterface.execute(
stmt_insrt,
stmt_insert_skew_to_single_result,
(skew = ClockParser.get_skew(file), runid = m[:runid], psbid = m[:psbid]),
)
end
@ -752,3 +755,82 @@ function add_skew_from_slave_clk_logs(db::SQLite.DB, logs_dir::AbstractString)
nothing
end
"""
add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
Extract QAQC results from slave log files for single runs.
Slave log files are expected to located in certain format under `logs_dir`.
"""
function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
exclude_runs =
((runid = 51, reason = "clock only"), (runid = 175, reason = "broken files"))
stmt_insert_slave_result_to_single_result = DBInterface.prepare(
db,
sql"""
UPDATE qaqc_single_run_results
SET
power_3v3d = :power_3v3d,
power_3v3a = :power_3v3a,
power_n3va = :power_n3va
WHERE
runid = :runid AND psboard_id = :psbid
""",
)
runids =
DBInterface.execute(
db,
sql"""
SELECT id
FROM qaqc_runs
""",
) |> Tables.columntable |> (tbl -> tbl.id)
slave_files =
readdir(joinpath(logs_dir, "main"), join = true) |>
filter(contains(r"\d+_\d+\.txt"))
DBInterface.transaction(db) do
for file in slave_files
psbid, runid, islongrun =
SlaveLogParser.get_psbid_runid_from_filename(basename(file))
@assert !islongrun
# exclusion
exclude_cond = Iterators.filter(exclude_runs) do cond
runid == cond.runid
end
if !isempty(exclude_cond)
@debug "skipping runid = $(runid) for $(first(exclude_cond).reason)"
continue
end
if !(runid in runids)
slave_result = SlaveLogParser.parse_slavelog_file(file)
@debug "runid: $(runid) not in run list (psbid: $(psbid))"
continue
end
# main
slave_result = SlaveLogParser.parse_slavelog_file(file)
@assert length(slave_result.power) == 1 "Too many power results for single run"
DBInterface.execute(
stmt_insert_slave_result_to_single_result,
(;
power_3v3d = slave_result.power[1].result_3v3d,
power_3v3a = slave_result.power[1].result_3v3a,
power_n3va = slave_result.power[1].result_n3va,
runid,
psbid,
),
)
end
end
nothing
end

View file

@ -19,7 +19,7 @@ Invalid cases are:
- no measurement has >500 counts => "Clock skew out of range"
"""
function get_skew(file::T) where {T <: AbstractString}
@debug "file: $(file)"
# @debug "file: $(file)"
lines = Iterators.Stateful(eachline(file))
was_0_before = false
@ -40,7 +40,7 @@ function get_skew(file::T) where {T <: AbstractString}
return time
end
end
@debug "Clock skew out of range"
@debug "Clock skew out of range (file: $(file))"
return missing
end

View file

@ -22,6 +22,9 @@ CREATE TABLE qaqc_single_run_results (
reset INTEGER,
qaqc_result INTEGER,
lvds_tx_skew REAL,
power_3v3d REAL,
power_3v3a REAL,
power_n3va REAL,
note TEXT,
FOREIGN KEY("runid") REFERENCES "qaqc_runs"("id"),
FOREIGN KEY("psboard_id") REFERENCES "ps_boards"("id"),

View file

@ -5,3 +5,8 @@ slavelogs/main/*
!slavelogs/main/448_103_clk.txt
!slavelogs/main/444_103_clk.txt
!slavelogs/main/209_51_clk.txt
!slavelogs/main/525_244.txt
!slavelogs/main/525_245_longrun.txt
!slavelogs/main/430_100.txt
!slavelogs/main/364_88_longrun.txt
!slavelogs/main/127_172.txt

View file

@ -0,0 +1,404 @@
=============== Test QAPIp Start ===============
PSBID :127
set_address done
TX_mode set as bitbanging mode 2'b10
SL_master done
initial setup done
device_id = e101d4
Device ID does not match.
Read Device ID : e101d4
SL_master done
TX_mode set as bitbanging mode 2'b10
=============== Test Recov Start ===============
Test Recov Result = 1
=============== Test Power Start ===============
3V3D [V] = 7.65
3V3A [V] = 3.80
-3VA [V] = -2.87
FPGA Temprature [C] = -63.21
Elements Status(1'bQSPI,1'bSi5395Lock,1'bPPASIC_status,3'bSEU_status) = 0b001111
Power Good(1V0A,1V2A,1V8A,1V0D,1V8D) = 0b10001
channel 0: DAC [mV] = 30, ADC [mV] = 0
channel 1: DAC [mV] = 0, ADC [mV] = 147
channel 2: DAC [mV] = 19, ADC [mV] = 138
channel 3: DAC [mV] = 76, ADC [mV] = 6
channel 4: DAC [mV] = 56, ADC [mV] = 39
channel 5: DAC [mV] = 0, ADC [mV] = 68
channel 6: DAC [mV] = 5, ADC [mV] = 75
channel 7: DAC [mV] = 4, ADC [mV] = 90
channel 8: DAC [mV] = 9, ADC [mV] = 137
channel 9: DAC [mV] = 77, ADC [mV] = 29
channel a: DAC [mV] = 9, ADC [mV] = 9
channel b: DAC [mV] = 28, ADC [mV] = 55
channel c: DAC [mV] = 24, ADC [mV] = 18
channel d: DAC [mV] = 17, ADC [mV] = 18
channel e: DAC [mV] = 54, ADC [mV] = 155
channel f: DAC [mV] = 5, ADC [mV] = 138
Test Power Reseult = 2
=============== Test Clock Start ===============
10.000000000000000 1000.000000 0.000000
10.017857142857142 1000.000000 0.000000
10.035714285714286 1000.000000 0.000000
10.053571428571429 1000.000000 0.000000
10.071428571428571 1000.000000 0.000000
10.089285714285714 1000.000000 0.000000
10.107142857142858 1000.000000 0.000000
10.125000000000000 1000.000000 0.000000
10.142857142857142 1000.000000 0.000000
10.160714285714286 1000.000000 0.000000
10.178571428571429 1000.000000 0.000000
10.196428571428571 1000.000000 0.000000
10.214285714285714 1000.000000 0.000000
10.232142857142858 1000.000000 0.000000
10.250000000000000 1000.000000 0.000000
10.267857142857142 1000.000000 0.000000
10.285714285714286 1000.000000 0.000000
10.303571428571429 1000.000000 0.000000
10.321428571428571 1000.000000 0.000000
10.339285714285714 1000.000000 0.000000
10.357142857142858 1000.000000 0.000000
10.375000000000000 1000.000000 0.000000
10.392857142857142 1000.000000 0.000000
10.410714285714286 1000.000000 0.000000
10.428571428571429 1000.000000 0.000000
10.446428571428571 1000.000000 0.000000
10.464285714285714 1000.000000 0.000000
10.482142857142858 1000.000000 0.000000
10.500000000000000 1000.000000 0.000000
10.517857142857142 1000.000000 0.000000
10.535714285714286 1000.000000 0.000000
10.553571428571429 1000.000000 0.000000
10.571428571428571 1000.000000 0.000000
10.589285714285714 1000.000000 0.000000
10.607142857142858 1000.000000 0.000000
10.625000000000000 1000.000000 0.000000
10.642857142857142 1000.000000 0.000000
10.660714285714286 1000.000000 0.000000
10.678571428571429 1000.000000 0.000000
10.696428571428571 1000.000000 0.000000
10.714285714285714 1000.000000 0.000000
10.732142857142858 1000.000000 0.000000
10.750000000000000 1000.000000 0.000000
10.767857142857142 1000.000000 0.000000
10.785714285714286 1000.000000 0.000000
10.803571428571429 1000.000000 0.000000
10.821428571428571 1000.000000 0.000000
10.839285714285714 1000.000000 0.000000
10.857142857142858 1000.000000 0.000000
10.875000000000000 1000.000000 0.000000
10.892857142857142 1000.000000 0.000000
10.910714285714286 1000.000000 0.000000
10.928571428571429 1000.000000 0.000000
10.946428571428571 1000.000000 0.000000
10.964285714285714 1000.000000 0.000000
10.982142857142858 1000.000000 0.000000
11.000000000000000 1000.000000 0.000000
11.017857142857142 1000.000000 0.000000
11.035714285714286 1000.000000 0.000000
11.053571428571429 1000.000000 0.000000
11.071428571428571 1000.000000 0.000000
11.089285714285714 1000.000000 0.000000
11.107142857142858 1000.000000 0.000000
11.125000000000000 1000.000000 0.000000
11.142857142857142 1000.000000 0.000000
11.160714285714286 1000.000000 0.000000
11.178571428571429 1000.000000 0.000000
11.196428571428571 1000.000000 0.000000
11.214285714285714 1000.000000 0.000000
11.232142857142858 1000.000000 0.000000
11.250000000000000 1000.000000 0.000000
11.267857142857142 1000.000000 0.000000
11.285714285714286 1000.000000 0.000000
11.303571428571429 1000.000000 0.000000
11.321428571428571 1000.000000 0.000000
11.339285714285714 1000.000000 0.000000
11.357142857142858 1000.000000 0.000000
11.375000000000000 1000.000000 0.000000
11.392857142857142 1000.000000 0.000000
11.410714285714286 1000.000000 0.000000
11.428571428571429 1000.000000 0.000000
11.446428571428571 1000.000000 0.000000
11.464285714285714 1000.000000 0.000000
11.482142857142858 1000.000000 0.000000
11.500000000000000 1000.000000 0.000000
11.517857142857142 1000.000000 0.000000
11.535714285714286 1000.000000 0.000000
11.553571428571429 1000.000000 0.000000
11.571428571428571 1000.000000 0.000000
11.589285714285714 1000.000000 0.000000
11.607142857142858 1000.000000 0.000000
11.625000000000000 1000.000000 0.000000
11.642857142857142 1000.000000 0.000000
11.660714285714286 1000.000000 0.000000
11.678571428571429 1000.000000 0.000000
11.696428571428571 1000.000000 0.000000
11.714285714285714 1000.000000 0.000000
11.732142857142858 1000.000000 0.000000
11.750000000000000 1000.000000 0.000000
11.767857142857142 1000.000000 0.000000
11.785714285714286 1000.000000 0.000000
11.803571428571429 1000.000000 0.000000
11.821428571428571 1000.000000 0.000000
11.839285714285714 1000.000000 0.000000
11.857142857142858 1000.000000 0.000000
11.875000000000000 1000.000000 0.000000
11.892857142857142 1000.000000 0.000000
11.910714285714286 1000.000000 0.000000
11.928571428571429 1000.000000 0.000000
11.946428571428571 1000.000000 0.000000
11.964285714285714 1000.000000 0.000000
11.982142857142858 1000.000000 0.000000
12.000000000000000 1000.000000 0.000000
12.017857142857142 1000.000000 0.000000
12.035714285714286 1000.000000 0.000000
12.053571428571429 1000.000000 0.000000
12.071428571428571 1000.000000 0.000000
12.089285714285714 1000.000000 0.000000
12.107142857142858 1000.000000 0.000000
12.125000000000000 1000.000000 0.000000
12.142857142857142 1000.000000 0.000000
12.160714285714286 1000.000000 0.000000
12.178571428571429 1000.000000 0.000000
12.196428571428571 1000.000000 0.000000
12.214285714285714 1000.000000 0.000000
12.232142857142858 1000.000000 0.000000
12.250000000000000 1000.000000 0.000000
12.267857142857142 1000.000000 0.000000
12.285714285714286 1000.000000 0.000000
12.303571428571429 1000.000000 0.000000
12.321428571428571 1000.000000 0.000000
12.339285714285714 1000.000000 0.000000
12.357142857142858 1000.000000 0.000000
12.375000000000000 1000.000000 0.000000
12.392857142857142 1000.000000 0.000000
12.410714285714286 1000.000000 0.000000
12.428571428571429 1000.000000 0.000000
12.446428571428571 1000.000000 0.000000
12.464285714285714 1000.000000 0.000000
12.482142857142858 1000.000000 0.000000
12.500000000000000 1000.000000 0.000000
12.517857142857142 1000.000000 0.000000
12.535714285714286 1000.000000 0.000000
12.553571428571429 1000.000000 0.000000
12.571428571428571 1000.000000 0.000000
12.589285714285714 1000.000000 0.000000
12.607142857142858 1000.000000 0.000000
12.625000000000000 1000.000000 0.000000
12.642857142857142 1000.000000 0.000000
12.660714285714286 1000.000000 0.000000
12.678571428571429 1000.000000 0.000000
12.696428571428571 1000.000000 0.000000
12.714285714285714 1000.000000 0.000000
12.732142857142858 1000.000000 0.000000
12.750000000000000 1000.000000 0.000000
12.767857142857142 1000.000000 0.000000
12.785714285714286 1000.000000 0.000000
12.803571428571429 1000.000000 0.000000
12.821428571428571 1000.000000 0.000000
12.839285714285714 1000.000000 0.000000
12.857142857142858 1000.000000 0.000000
12.875000000000000 1000.000000 0.000000
12.892857142857142 1000.000000 0.000000
12.910714285714286 1000.000000 0.000000
12.928571428571429 1000.000000 0.000000
12.946428571428571 1000.000000 0.000000
12.964285714285714 1000.000000 0.000000
12.982142857142858 1000.000000 0.000000
13.000000000000000 1000.000000 0.000000
13.017857142857142 1000.000000 0.000000
13.035714285714286 1000.000000 0.000000
13.053571428571429 1000.000000 0.000000
13.071428571428571 1000.000000 0.000000
13.089285714285714 1000.000000 0.000000
13.107142857142858 1000.000000 0.000000
13.125000000000000 1000.000000 0.000000
13.142857142857142 1000.000000 0.000000
13.160714285714286 1000.000000 0.000000
13.178571428571429 1000.000000 0.000000
13.196428571428571 1000.000000 0.000000
13.214285714285714 1000.000000 0.000000
13.232142857142858 1000.000000 0.000000
13.250000000000000 1000.000000 0.000000
13.267857142857142 1000.000000 0.000000
13.285714285714286 1000.000000 0.000000
13.303571428571429 1000.000000 0.000000
13.321428571428571 1000.000000 0.000000
13.339285714285714 1000.000000 0.000000
13.357142857142858 1000.000000 0.000000
13.375000000000000 1000.000000 0.000000
13.392857142857142 1000.000000 0.000000
13.410714285714286 1000.000000 0.000000
13.428571428571429 1000.000000 0.000000
13.446428571428571 1000.000000 0.000000
13.464285714285714 1000.000000 0.000000
13.482142857142858 1000.000000 0.000000
13.500000000000000 1000.000000 0.000000
13.517857142857142 1000.000000 0.000000
13.535714285714286 1000.000000 0.000000
13.553571428571429 1000.000000 0.000000
13.571428571428571 1000.000000 0.000000
13.589285714285714 1000.000000 0.000000
13.607142857142858 1000.000000 0.000000
13.625000000000000 1000.000000 0.000000
13.642857142857142 1000.000000 0.000000
13.660714285714286 1000.000000 0.000000
13.678571428571429 1000.000000 0.000000
13.696428571428571 1000.000000 0.000000
13.714285714285714 1000.000000 0.000000
13.732142857142858 1000.000000 0.000000
13.750000000000000 1000.000000 0.000000
13.767857142857142 1000.000000 0.000000
13.785714285714286 1000.000000 0.000000
13.803571428571429 1000.000000 0.000000
13.821428571428571 1000.000000 0.000000
13.839285714285714 1000.000000 0.000000
13.857142857142858 1000.000000 0.000000
13.875000000000000 1000.000000 0.000000
13.892857142857142 1000.000000 0.000000
13.910714285714286 1000.000000 0.000000
13.928571428571429 1000.000000 0.000000
13.946428571428571 1000.000000 0.000000
13.964285714285714 1000.000000 0.000000
13.982142857142858 1000.000000 0.000000
14.000000000000000 1000.000000 0.000000
14.017857142857142 1000.000000 0.000000
14.035714285714286 1000.000000 0.000000
14.053571428571429 1000.000000 0.000000
14.071428571428571 1000.000000 0.000000
14.089285714285714 1000.000000 0.000000
14.107142857142858 1000.000000 0.000000
14.125000000000000 1000.000000 0.000000
14.142857142857142 1000.000000 0.000000
14.160714285714286 1000.000000 0.000000
14.178571428571429 1000.000000 0.000000
14.196428571428571 1000.000000 0.000000
14.214285714285714 1000.000000 0.000000
14.232142857142858 1000.000000 0.000000
14.250000000000000 1000.000000 0.000000
14.267857142857142 1000.000000 0.000000
14.285714285714286 1000.000000 0.000000
14.303571428571429 1000.000000 0.000000
14.321428571428571 1000.000000 0.000000
14.339285714285714 1000.000000 0.000000
14.357142857142858 1000.000000 0.000000
14.375000000000000 1000.000000 0.000000
14.392857142857142 1000.000000 0.000000
14.410714285714286 1000.000000 0.000000
14.428571428571429 1000.000000 0.000000
14.446428571428571 1000.000000 0.000000
14.464285714285714 1000.000000 0.000000
14.482142857142858 1000.000000 0.000000
14.500000000000000 1000.000000 0.000000
14.517857142857142 1000.000000 0.000000
14.535714285714286 1000.000000 0.000000
14.553571428571429 1000.000000 0.000000
14.571428571428571 1000.000000 0.000000
14.589285714285714 1000.000000 0.000000
14.607142857142858 1000.000000 0.000000
14.625000000000000 1000.000000 0.000000
14.642857142857142 1000.000000 0.000000
14.660714285714286 1000.000000 0.000000
14.678571428571429 1000.000000 0.000000
14.696428571428571 1000.000000 0.000000
14.714285714285714 1000.000000 0.000000
14.732142857142858 1000.000000 0.000000
14.750000000000000 1000.000000 0.000000
14.767857142857142 1000.000000 0.000000
14.785714285714286 1000.000000 0.000000
14.803571428571429 1000.000000 0.000000
14.821428571428571 1000.000000 0.000000
14.839285714285714 1000.000000 0.000000
14.857142857142858 1000.000000 0.000000
14.875000000000000 1000.000000 0.000000
14.892857142857142 1000.000000 0.000000
14.910714285714286 1000.000000 0.000000
14.928571428571429 1000.000000 0.000000
14.946428571428571 1000.000000 0.000000
14.964285714285714 1000.000000 0.000000
14.982142857142858 1000.000000 0.000000
15.000000000000000 1000.000000 0.000000
15.017857142857142 1000.000000 0.000000
15.035714285714286 1000.000000 0.000000
15.053571428571429 1000.000000 0.000000
15.071428571428571 1000.000000 0.000000
15.089285714285714 1000.000000 0.000000
15.107142857142858 1000.000000 0.000000
15.125000000000000 1000.000000 0.000000
15.142857142857142 1000.000000 0.000000
15.160714285714286 1000.000000 0.000000
15.178571428571429 1000.000000 0.000000
15.196428571428571 1000.000000 0.000000
15.214285714285714 1000.000000 0.000000
15.232142857142858 1000.000000 0.000000
15.250000000000000 1000.000000 0.000000
15.267857142857142 1000.000000 0.000000
15.285714285714286 1000.000000 0.000000
15.303571428571429 1000.000000 0.000000
15.321428571428571 1000.000000 0.000000
15.339285714285714 1000.000000 0.000000
15.357142857142858 1000.000000 0.000000
15.375000000000000 1000.000000 0.000000
15.392857142857142 1000.000000 0.000000
15.410714285714286 1000.000000 0.000000
15.428571428571429 1000.000000 0.000000
15.446428571428571 1000.000000 0.000000
15.464285714285714 1000.000000 0.000000
15.482142857142858 1000.000000 0.000000
15.500000000000000 1000.000000 0.000000
15.517857142857142 1000.000000 0.000000
15.535714285714286 1000.000000 0.000000
15.553571428571429 1000.000000 0.000000
15.571428571428571 1000.000000 0.000000
15.589285714285714 1000.000000 0.000000
15.607142857142858 1000.000000 0.000000
15.625000000000000 1000.000000 0.000000
15.642857142857142 1000.000000 0.000000
15.660714285714286 1000.000000 0.000000
15.678571428571429 1000.000000 0.000000
15.696428571428571 1000.000000 0.000000
15.714285714285714 1000.000000 0.000000
15.732142857142858 1000.000000 0.000000
15.750000000000000 1000.000000 0.000000
15.767857142857142 1000.000000 0.000000
15.785714285714286 1000.000000 0.000000
15.803571428571429 1000.000000 0.000000
15.821428571428571 1000.000000 0.000000
15.839285714285714 1000.000000 0.000000
15.857142857142858 1000.000000 0.000000
15.875000000000000 1000.000000 0.000000
15.892857142857142 1000.000000 0.000000
15.910714285714286 1000.000000 0.000000
15.928571428571429 1000.000000 0.000000
15.946428571428571 1000.000000 0.000000
15.964285714285714 1000.000000 0.000000
15.982142857142858 1000.000000 0.000000
16.000000000000000 1000.000000 0.000000
Test Clock Result = 2
=============== Test ASDTP Start ===============
reconfig_done = 1272
always_hit_flag = 6456
Autoreconfig fail
ASDTP : 25334 times reset : result = 2
reconfig_done = 16377
always_hit_flag = 14847
------- Done check -------
Si_done = 0x3f0f
LOLB_in = 0x1fff
PPconfig_done = 0x93fe
PPconfig_error = 0x2f6b
PLLLD_fail_counter = 0x39e1
PPconfig_fail_counter = 0x2f1
PP1_PLLLD = 0x1c01
PP2_PLLLD = 0x19fa
PP3_PLLLD = 0x1112
PP4_PLLLD = 0xe577
PP5_PLLLD = 0x7efa
PP6_PLLLD = 0x1712
PP7_PLLLD = 0x10f9
PP8_PLLLD = 0x17f9

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
using Test
using PSBoardDataBase
using StaticArrays
using CSV, DataFrames
using SQLite, DBInterface
using Dates
@ -45,6 +46,122 @@ true || include("../src/PSBoardDataBase.jl")
) == 22
end
@testset "Slave Log parser" begin
@testset "AsdtpResult" begin
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/430_100.txt"), 2280),
)
result_asdtp = PSBoardDataBase.SlaveLogParser.parse_asdtp_section!(lines)
@test result_asdtp == PSBoardDataBase.SlaveLogParser.AsdtpResult(
1,
0,
true,
fill(
PSBoardDataBase.SlaveLogParser.AsdtpMeasurement.(fill((0, 1, 0), 32)),
8,
),
0,
1,
1,
0,
0x1,
0x1,
0xff,
0x0,
0x0,
0x0,
MVector((0x1001, 0x2001, 0x3001, 0x4001, 0x5001, 0x6001, 0x7001, 0x8001)),
)
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/525_244.txt"), 2280),
)
result_asdtp = PSBoardDataBase.SlaveLogParser.parse_asdtp_section!(lines)
@test result_asdtp.reconfig_done == 0
end
@testset "Power" begin
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/430_100.txt"), 1915),
)
result = PSBoardDataBase.SlaveLogParser.parse_power_section!(lines)
@test result.result_3v3d == 3.43
@test result.result_3v3a == 2.91
@test result.result_n3va == -2.97
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/525_244.txt"), 1915),
)
result = PSBoardDataBase.SlaveLogParser.parse_power_section!(lines)
@test result.result_3v3d == 3.47
@test result.result_3v3a == 2.91
@test result.result_n3va == -3.01
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/127_172.txt"), 17),
)
result = PSBoardDataBase.SlaveLogParser.parse_power_section!(lines)
@test result.result_3v3d == 7.65
@test result.result_3v3a == 3.80
@test result.result_n3va == -2.87
@test result.fpga_temp == -63.21
end
@testset "Recov" begin
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/430_100.txt"), 1912),
)
@test PSBoardDataBase.SlaveLogParser.parse_recov_section!(lines)
lines = Iterators.Stateful(
Iterators.drop(eachline("./input/slavelogs/main/525_244.txt"), 1912),
)
@test PSBoardDataBase.SlaveLogParser.parse_recov_section!(lines)
# Maybe add more cases
end
@testset "Integrated" begin
result = PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/430_100.txt",
)
@test result isa NamedTuple
@test result.asdtp |> length |> ==(1)
@test result.power |> length |> ==(1)
@test result.power[1].result_3v3d == 3.43
@test result.recov[1]
@test PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/525_244.txt",
) isa NamedTuple
result = PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/525_245_longrun.txt",
)
@test result isa NamedTuple
# @test result.asdtp |> length |> ==(100)
@test result.power |> length |> ==(0)
@info "" result.asdtp |> length result.power |> length
@test readlines("./input/slavelogs/main/525_245_longrun.txt") |>
filter(contains("=== Test Power Start ==")) |>
length |>
==(length(result.power))
result = PSBoardDataBase.SlaveLogParser.parse_slavelog_file(
"./input/slavelogs/main/364_88_longrun.txt",
)
@test result isa NamedTuple
@test result.asdtp |> length |> ==(100)
@test result.power |> length |> ==(0)
@info "" result.asdtp |> length result.power |> length
@test readlines("./input/slavelogs/main/364_88_longrun.txt") |>
filter(contains("=== Test Power Start ==")) |>
length |>
==(length(result.power))
end
end
@testset "Download data csv" begin
out = tempname()
@test CSV.read(
@ -132,6 +249,8 @@ true || include("../src/PSBoardDataBase.jl")
@test PSBoardDataBase.add_skew_from_slave_clk_logs(db, "input/slavelogs/") |>
isnothing
@test PSBoardDataBase.add_slavelog_result(db, "input/slavelogs/") |> isnothing
run(`sqlitebrowser $dbpath`)
@test PSBoardDataBase.create_database_from_exported_csvs(
@ -155,3 +274,15 @@ true || include("../src/PSBoardDataBase.jl")
end
end
end
using Aqua
@testset "Aqua.jl" begin
Aqua.test_all(
PSBoardDataBase;
# ambiguities = (exclude = [], broken = true),
stale_deps = (ignore = Symbol[:Documenter],),
# deps_compat = (ignore = Symbol[],),
# piracies = false,
)
end