wiki:Old/Athstats/ScriptsRepository/AthstatsAppDef

Orbit > Athstats > Scripts Repository > athstats.rb

#
# Create an application representation from scratch
#
require 'handler/appDefinition'

a = AppDefinition.create('test:app:athstats')
a.name = "athstats"
a.version(1, 1, 1)
a.shortDescription = "Application to gather madwifi driver statistics"
a.description = <<TEXT
This C application gathers driver statistics and reports them.
TEXT>>

# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
# Command-line arguments.
a.addProperty('interface', 'Use ath0/ath1, ath0 by default', nil, String, false)
a.addProperty('interval', 'Number of msec between calls to query driver', nil, String, false)

# Metrics reported via OML.
a.addMeasurement("queryport", nil, [
    ['succ_tx_attempts', 'int'],
    ['fail_xretries', 'int'],
    ['fail_fifoerr', 'int'],
    ['fail_filtered', 'int'],
    ['short_retries', 'int'],
    ['long_retries', 'int'],
    ['total_frames_rcvd', 'int'],
    ['crc_errors', 'int'],
    ['fifo_errors', 'int'],
    ['phy_errors', 'int']
 ])
a.path = "/usr/bin/athstats-oml"

if $0 == __FILE__
  require 'stringio'
  require 'rexml/document'
  include REXML

  sio = StringIO.new()
  a.to_xml.write(sio, 2)
  sio.rewind
  puts sio.read

  sio.rewind
  doc = Document.new(sio)
  t = AppDefinition.from_xml(doc.root)

  puts
  puts "-------------------------"
  puts
  t.to_xml.write($stdout, 2)

end

Last modified 14 years ago Last modified on Jul 31, 2006, 1:26:35 AM
Note: See TracWiki for help on using the wiki.