Skip to content

Instantly share code, notes, and snippets.

@wvdschel
Created May 4, 2012 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvdschel/2595804 to your computer and use it in GitHub Desktop.
Save wvdschel/2595804 to your computer and use it in GitHub Desktop.
CATS parsing magic
Dir['*.log'].each do |fname|
log = Log.parse(fname)
symbol = log.symbols.values.sort_by { |s| -s.charcount }.first
line = log.lines.values.sort_by { |s| -s.charcount }.first
puts "#{log.cats_charcount}/#{log.charcount} in #{log.name}, most offensive: #{symbol.name} (#{symbol.charcount}), #{line.name} (#{line.charcount})"
end
# Output:
# 2169/21484 in regexp-info.log, most offensive: -/legacy/printf (983), -/legacy/printf:0000 (983)
# 212132/227923 in teraterm.log, most offensive: amApp/resmgmt (22885), amApp/resmgmt:0850 (16423)
# 170108/170108 in teraterm_csm_magic_keys.log, most offensive: -/legacy/printf (67248), -/legacy/printf:0000 (67248)
# 522492/525455 in teraterm_newprints.log, most offensive: er/plfpow_merr (183278), er/plfpow_merr:0356 (182851)
# 38928017/39752024 in zzz_hbbtv_CATS_crash.log, most offensive: -/legacy/printf (7015982), -/legacy/printf:0000 (7015568)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment