Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log memory and file system access #64

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions bench
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bundle update
NUMBER_OF_RUNS=3
RESULTS="$(pwd)/results.csv"
if [[ ! -s $RESULTS ]]; then
echo "Jekyll version, user time in seconds, site" > $RESULTS
echo "Jekyll version, user time in seconds, site, Maximum memory, Number of file writes, Number of file reads" > $RESULTS
fi

if [[ -n $PR ]]; then
Expand Down Expand Up @@ -65,7 +65,7 @@ for SITE in $(cat "site-list"); do
git clone --recurse-submodules -q "$SITE" "$SOURCE"
fi
for ((i=0; i<NUMBER_OF_RUNS; ++i)); do
"$TIME" -ao "$RESULTS" -f"$VERSION,%U,$SITE" \
"$TIME" -ao "$RESULTS" -f"$VERSION,%U,$SITE,%M,%O,%I" \
bundle exec jekyll build -s "$SOURCE" -d "$DESTINATION" --trace
done

Expand Down
29 changes: 18 additions & 11 deletions report
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,32 @@ end

puts markdown_header if ENV.key?("REF") && ENV.key?("PR")

puts "| ref | build time in seconds |"
puts "|:-----------------------------------------|----------------------:|"
puts "| ref | build time in seconds | max memory | min memory |"
puts "|:-----------------------------------------|----------------------:|-----------:|-----------:|"

summed_results = {}
site_results = {}
results.each do |row|
summed_results[row[0]] = 0.0 unless summed_results.key?(row[0])
site_results[row[2]] ||= {
:flamegraph => linkify_flamegraph(row[2]),
:site => linkify_site(row[2]),
ref = row[0]
site = row[2]
site_results[site] ||= {
:flamegraph => linkify_flamegraph(site),
:site => linkify_site(site),
:time => 0.0,
}
summed_results[row[0]] += row[1]
site_results[row[2]][:time] += row[1] if row[0] == "##{ENV["PR"]}"
summed_results[ref] ||= {
:ref => (ref =~ %r!\A(?:[0-9a-f]+|#\d+)\Z!) ? ref : "`#{ref}`",
:time => 0.0,
:max_mem => row[3],
:min_mem => row[3]
}
site_results[site][:time ] += row[1] if ref[0] == "##{ENV["PR"]}"
summed_results[ref][:time] += row[1]
summed_results[ref][:max_mem] = row[3] if row[3] > summed_results[ref][:max_mem]
end

summed_results.each do |ref, time|
ref = "`#{ref}`" unless ref =~ %r!\A(?:[0-9a-f]+|#\d+)\Z!
puts format("| %-40s | %21.2f |", ref, time)
summed_results.each do |ref, data|
puts format("| %<ref>-40s | %<time>21.2f | %<max_mem>10d | %<min_mem>10d |", data)
end

if ENV.key?("REF") && ENV.key?("PR")
Expand Down