home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / SYSINFO.CMD < prev    next >
OS/2 REXX Batch file  |  1995-05-24  |  4KB  |  78 lines

  1. EXTPROC CEnvi2
  2. //***************************************************************
  3. //*** SysInfo() - Display lots of system information from the ***
  4. //*** ver.1       DosQuerySysInfo() call.                     ***
  5. //***************************************************************
  6.  
  7. #define QSV_MAX_PATH_LENGTH   1
  8. #define QSV_MAX_TEXT_SESSIONS 2
  9. #define QSV_MAX_PM_SESSIONS   3
  10. #define QSV_MAX_VDM_SESSIONS  4
  11. #define QSV_BOOT_DRIVE        5  // 1=A, 2=B, etc.
  12. #define QSV_DYN_PRI_VARIATION 6  // 0=Absolute, 1=Dynamic
  13. #define QSV_MAX_WAIT          7  // seconds
  14. #define QSV_MIN_SLICE         8  // milli seconds
  15. #define QSV_MAX_SLICE         9  // milli seconds
  16. #define QSV_PAGE_SIZE         10
  17. #define QSV_VERSION_MAJOR     11
  18. #define QSV_VERSION_MINOR     12
  19. #define QSV_VERSION_REVISION  13 // Revision letter
  20. #define QSV_MS_COUNT          14 // Free running millisecond counter
  21. #define QSV_TIME_LOW          15 // Low dword of time in seconds
  22. #define QSV_TIME_HIGH         16 // High dword of time in seconds
  23. #define QSV_TOTPHYSMEM        17 // Physical memory on system
  24. #define QSV_TOTRESMEM         18 // Resident memory on system
  25. #define QSV_TOTAVAILMEM       19 // Available memory for all processes
  26. #define QSV_MAXPRMEM          20 // Avail private mem for calling proc
  27. #define QSV_MAXSHMEM          21 // Avail shared mem for calling proc
  28. #define QSV_TIMER_INTERVAL    22 // Timer interval in tenths of ms
  29. #define QSV_MAX_COMP_LENGTH   23 // max len of one component in a name
  30. #define QSV_FOREGROUND_FS_SESSION 24
  31. #define QSV_FOREGROUND_PROCESS 25
  32.  
  33. printf("System parameters:\n");
  34. printf("Maximum length, in bytes, of a path name: %d\n",QuerySysInfo(QSV_MAX_PATH_LENGTH));
  35. printf("Maximum number of text sessions: %d\n",QuerySysInfo(QSV_MAX_TEXT_SESSIONS));
  36. printf("Maximum number of PM sessions: %d\n",QuerySysInfo(QSV_MAX_PM_SESSIONS));
  37. printf("Maximum number of DOS sessions: %d\n",QuerySysInfo(QSV_MAX_VDM_SESSIONS));
  38. printf("Boot drive: %c\n",'A' - 1 + QuerySysInfo(QSV_BOOT_DRIVE));
  39. printf("Priority method: %s\n",QuerySysInfo(QSV_DYN_PRI_VARIATION) ? "Dynamic" : "Absolute" );
  40. printf("Maximum wait in seconds: %d\n",QuerySysInfo(QSV_MAX_WAIT));
  41. printf("Minimum time slice in milliseconds: %d\n",QuerySysInfo(QSV_MIN_SLICE));
  42. printf("Maximum time slice in milliseconds: %d\n",QuerySysInfo(QSV_MAX_SLICE));
  43. printf("Memory page size in bytes: %d\n",QuerySysInfo(QSV_PAGE_SIZE));
  44. printf("Major version number: %d\n",QuerySysInfo(QSV_VERSION_MAJOR));
  45. printf("Minor version number: %d\n",QuerySysInfo(QSV_VERSION_MINOR));
  46. printf("Revision letter (value): %d\n",QuerySysInfo(QSV_VERSION_REVISION));
  47. printf("32-bit, free-running millisecond counter: %u\n",QuerySysInfo(QSV_MS_COUNT));
  48. printf("Time (seconds) since January 1, 1970 at 0:00:00 (low): %u\n",QuerySysInfo(QSV_TIME_LOW));
  49. printf("Time (seconds) since January 1, 1970 at 0:00:00 (high): %u\n",QuerySysInfo(QSV_TIME_HIGH));
  50. printf("Total physical memory (bytes / Mb): %u / %f\n",
  51.        QuerySysInfo(QSV_TOTPHYSMEM),QuerySysInfo(QSV_TOTPHYSMEM)/float(0x100000));
  52. printf("Total resident memory (bytes / Mb): %u / %f\n",
  53.        QuerySysInfo(QSV_TOTRESMEM),QuerySysInfo(QSV_TOTRESMEM)/float(0x100000));
  54. printf("Total available memory (bytes / Mb): %u / %f\n",
  55.        QuerySysInfo(QSV_TOTAVAILMEM),QuerySysInfo(QSV_TOTAVAILMEM)/float(0x100000));
  56. printf("Available private memory for this process (bytes / Mb): %u / %f\n",
  57.        QuerySysInfo(QSV_MAXPRMEM),QuerySysInfo(QSV_MAXPRMEM)/float(0x100000));
  58. printf("Available shared memory for this process (bytes / Mb): %u / %f\n",
  59.        QuerySysInfo(QSV_MAXSHMEM),QuerySysInfo(QSV_MAXSHMEM)/float(0x100000));
  60. printf("Timer interval in tenths of a millisecond: %u\n",QuerySysInfo(QSV_TIMER_INTERVAL));
  61. printf("Maximum length of one component in a name: %u\n",QuerySysInfo(QSV_MAX_COMP_LENGTH));
  62. printf("Session ID of current full-screen session: %d\n",QuerySysInfo(QSV_FOREGROUND_FS_SESSION));
  63. printf("Process ID of current foreground process: %d\n",QuerySysInfo(QSV_FOREGROUND_PROCESS));
  64.  
  65.  
  66. QuerySysInfo(pIndex) // return double-word value for this
  67. {                    // index.  Exit failure if error.
  68.    #define ORD_DOS32QUERYSYSINFO 348
  69.    lRC = DynamicLink("doscalls",ORD_DOS32QUERYSYSINFO,BIT32,CDECL,
  70.                      pIndex,pIndex,lData,4);
  71.    if ( lRC ) {
  72.       printf("DosQuerySysInfo() returned error %d for index %d\n\a",lRC,pIndex);
  73.       exit(EXIT_FAILURE);
  74.    }
  75.    return lData;
  76. }
  77.  
  78.