Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
ExplicitImports = "1"
HTTP = "1"
JET = "0.9, 0.10, 0.11"
JSON3 = "1"
JSON3 = "1.1"
JuliaFormatter = "2"
LocalRegistry = "0.5"
SafeTestsets = "0.0.1, 0.1, 1"
Expand Down
24 changes: 14 additions & 10 deletions src/import_timing_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,22 @@ function analyze_import_timing_in_process(repo_path::String, package_name::Strin

# Capture timing data in a structured way
timing_data = []
raw_output = IOBuffer()

# Redirect stdout to capture the timing output
original_stdout = stdout
redirect_stdout(raw_output) do
# Run with time imports flag
Base.eval(Main, :(using InteractiveUtils))
Base.eval(Main, :(@time_imports using \$(Symbol("$package_name"))))

# Redirect stdout to a temporary file to capture the timing output.
# `redirect_stdout` accepts a file IOStream (not an IOBuffer), so we
# write to a temp file and read it back.
timing_capture_file = tempname()
open(timing_capture_file, "w") do capture_io
redirect_stdout(capture_io) do
# Run with time imports flag
Base.eval(Main, :(using InteractiveUtils))
Base.eval(Main, :(@time_imports using \$(Symbol("$package_name"))))
end
end

# Process the captured output
raw_str = String(take!(raw_output))
raw_str = read(timing_capture_file, String)
rm(timing_capture_file; force = true)
lines = split(raw_str, '\n')

for line in lines
Expand Down
1 change: 1 addition & 0 deletions test/import_timing_analysis_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrgMaintenanceScripts
using Test
using Dates

@testset "Import Timing Analysis Tests" begin
# Create a simple test package structure
Expand Down
1 change: 1 addition & 0 deletions test/invalidation_analysis_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using OrgMaintenanceScripts
using Test
using Dates

@testset "Invalidation Analysis Tests" begin
# Create a simple test package structure
Expand Down
Loading