wiki:Old/Athstats/ScriptsRepository/AthstatsAppDef

Version 4 (modified by kishore, 19 years ago) ( diff )

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, 0)
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)
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)

a.addMeasurement("queryport", nil, [
  ['succ_tx_attempts','int'],
  ['fail_xretries','int'],
  ['total_frames_rcvd','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


Note: See TracWiki for help on using the wiki.