Skip to content

Commit

Permalink
Add script to analyze installer log for action run times
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Oct 17, 2024
1 parent 67702be commit 886fdde
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bin/installer-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env ruby

log = File.read(ARGV[0])

tasks = log.split("\n").select do |line|
line.include?('Evaluated in')
end

profile = []

#2021-04-27 01:13:35 [DEBUG ] [configure] /Stage[main]/Foreman/Foreman::Rake[apipie:cache:index]/Exec[foreman-rake-apipie:cache:index]: Evaluated in 86.60 seconds
tasks.each do |task|
EVALTRACE = %r{.+/(?<resource>.+\]): Evaluated in (?<time>\d+\.\d+) seconds}

evaltrace = EVALTRACE.match(task)
next if evaltrace.nil?
profile << {:task => evaltrace[:resource], :time => evaltrace[:time].to_f}
end

profile.sort! { |a,b| b[:time] <=> a[:time] }

profile[0...15].each do |task|
puts "#{task[:time]}: #{task[:task]}"
end

0 comments on commit 886fdde

Please sign in to comment.