home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma30.dms / ma30.adf / VMM / Developer / include / VMM_Stat.h
C/C++ Source or Header  |  1994-09-15  |  2KB  |  65 lines

  1. #ifndef VMM_STAT_H
  2. #define VMM_STAT_H
  3.  
  4. #include <exec/types.h>
  5. #include <exec/tasks.h>
  6. #include <exec/ports.h>
  7.  
  8. /* Getting statistics messages from VMM for further processing */
  9.  
  10. struct VMStatMsg
  11.   {
  12.   struct Message VMMessage;   /* don't forget to put sizeof (struct VMStatMsg) */
  13.                               /* into mn_Length. Future version of VMM might   */
  14.                               /* extend this structure */
  15.   struct Task   *Sender;      
  16.   UWORD          Command;
  17.   UWORD          ReplySignal;
  18.   ULONG          VMSize;
  19.   ULONG          VMFree;
  20.   ULONG          Faults;
  21.   ULONG          PagesWritten;
  22.   ULONG          PagesRead;
  23.   ULONG          NumFrames;
  24.   ULONG          PagesUsed;
  25.   ULONG          PageSize;
  26.   ULONG          TrapStructsFree;
  27.   };
  28.  
  29. #define VMCMD_AskStat 1472
  30.  
  31. /* Do the following to get a statistics message from VMM:
  32.  * 
  33.  * struct VMStatMsg *StatMsg;
  34.  * LONG   VMSignal;
  35.  * struct MsgPort *VMPort;
  36.  *
  37.  * if ((StatMsg = AllocMem (sizeof (struct VMStatMsg), MEMF_PUBLIC)) == NULL)
  38.  *   Cleanup ();
  39.  *
  40.  * if ((VMSignal = AllocSignal (-1L)) == -1L)
  41.  *   Cleanup ();
  42.  *
  43.  * StatMsg->VMMessage.mn_Length = sizeof (struct VMStatMsg);
  44.  * StatMsg->Sender      = FindTask (NULL);
  45.  * StatMsg->Command     = VMCMD_AskStat;
  46.  * StatMsg->ReplySignal = VMSignal;
  47.  *
  48.  * Forbid ();
  49.  * if ((VMPort = FindPort ("VMM_Port")) != NULL)
  50.  *   PutMsg (VMPort, (struct Message*)StatMsg);
  51.  * else
  52.  *   ....
  53.  *
  54.  * Permit ();
  55.  * 
  56.  * Wait (1L << VMSignal);
  57.  *
  58.  * When this returns the StatMsg will contain the necessary parameters.
  59.  * Do whatever you like with it.
  60.  *
  61.  * Cleanup ();
  62.  *
  63.  * Easy, isn't it?
  64.  */
  65.