#!/usr/bin/ruby # # $Id: vfprofile.rb,v 1.1 2004/12/13 11:13:18 jeffm Exp $ # require './Vflow' require 'socket' require 'profile' TESTFILE='testdata/dummy_flow' puts "+++ get new()" x = Vflow.new() puts "+++ open a file" x.open(TESTFILE) puts "+++ each" count = 0 total_pkts, total_flows, total_octets = 0,0,0 x.each() {|r| count += 1 # do some realistic-ish calculations r.dpkts and total_pkts += r.dpkts r.dflows and total_flows += r.dflows r.doctets and total_octets += r.doctets } puts "+++ close a file" x.close() puts "pkts: #{total_pkts} flows: #{total_flows} octets: #{total_octets}" puts "=== End of Tests ===";