Skip to content

Instantly share code, notes, and snippets.

@jrsconfitto
Created November 14, 2011 21:47
Show Gist options
  • Save jrsconfitto/1365286 to your computer and use it in GitHub Desktop.
Save jrsconfitto/1365286 to your computer and use it in GitHub Desktop.
Grab the unique OPC methods from an exported OPC Analyzer trace
#! ruby
#
# Gets the unique OPC methods from the OPC analyzer trace log of all the methods TopView Configurator and Engine uses
# Assumes that it has been given a valid file name
if ARGV.length == 1 and File.exists?(ARGV[0])
input = File.open(ARGV.first, "r").read
# Build up a unique array of OPC methods
opc_methods = []
# For each line in the file, pull out the package::method name string and put it in the opc_methods collection
input.lines.each do |line|
if match = line.match(/\w+\:\:\w+/).to_s and !opc_methods.include?(match)
opc_methods << match
end
end
# Chop out all the repeats and print the unique method names
puts "Unique OPC method calls:"
opc_methods.sort.each do |method_name|
puts "#{method_name}\n"
end
else
puts "Please give me the name of a valid file!"
end
@jrsconfitto
Copy link
Author

For this utility i expect that the exported trace file is given to this script as an argument. This will run off of *nix or Windows with ruby installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment