home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / mprogs / vmsum.icn < prev   
Text File  |  2000-07-29  |  1KB  |  63 lines

  1. ############################################################################
  2. #
  3. #    File:     vmsum.icn
  4. #
  5. #    Subject:  Program to tabulate virtual-machine operations
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 22, 1997
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This tool tabulates event codes.
  18. #    
  19. ############################################################################
  20. #
  21. #  Requires:  Version 9 graphics and MT Icon
  22. #
  23. ############################################################################
  24. #
  25. #  Links:  evinit, numbers, opnames
  26. #
  27. ############################################################################
  28. #
  29. #  Includes:  evdefs.icn
  30. #
  31. ############################################################################
  32.  
  33. $include "evdefs.icn"
  34.  
  35. link evinit
  36. link numbers
  37. link opnames
  38.  
  39. procedure main(args)
  40.    local name, summary, total, i
  41.  
  42.    EvInit(get(args) | &null)            # initialize interface
  43.  
  44.    name := opnames()
  45.  
  46.    summary := table(0)
  47.    total := 0
  48.  
  49.    while EvGet(E_Opcode) do {
  50.       summary[&eventvalue] +:= 1
  51.       total +:= 1
  52.       }
  53.  
  54.    summary := sort(summary,4)
  55.    total /:= 100.0
  56.  
  57.    write(left("code",10), right("count",8), right("percent",10))
  58.    write()
  59.    while write(left(name[get(summary)],10), right(i := get(summary),8),
  60.       "   ", fix(i, total, 5, 2))
  61.  
  62. end
  63.