Created
November 14, 2011 21:47
-
-
Save jrsconfitto/1365286 to your computer and use it in GitHub Desktop.
Grab the unique OPC methods from an exported OPC Analyzer trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.