home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /* */
- /* Listing 2 */
- /* */
- /* NAME : PROFCTRL */
- /* */
- /* DATE : March 30, 1988 */
- /* */
- /* AUTHOR : (C) Copyright 1988 G. Kent Cobb - All Rights Reserved */
- /* */
- /* DESCRIPTION : */
- /* This program provides control functions for the terminate-and-stay- */
- /* resident system profiler. The syntax for executing PROFCTRL is: */
- /* */
- /* */
- /* | STATUS | */
- /* | ON | */
- /* PROFCTRL | OFF | */
- /* | ZERO | */
- /* | REPORT [output-file-name] | */
- /* */
- /* The ON and OFF options affect the accumulation of interrupt data; */
- /* STATUS reports the current state; ZERO erases all data that has */
- /* been accumulated; and REPORT generates a listing that describes */
- /* the contents of the tables. */
- /* */
- /* SYS_PROF and PROFCTRL are most easily used in a batch file, such as: */
- /* */
- /* */
- /* SYS_PROF */
- /* PROFCTRL zero */
- /* PROFCTRL on */
- /* chkdsk c: */
- /* PROFCTRL off */
- /* PROFCTRL report temp */
- /* d:list temp */
- /* */
- /*****************************************************************************/
- /* modifications for Turbo C and updated function descriptions */
- /* by Ralf Brown, 5/18/89 */
- /*****************************************************************************/
- /* additional function call tracking added by Ralf Brown, 6/18/89 */
- /*****************************************************************************/
-
- #include "stdio.h"
- #include "dos.h"
- #ifdef __TURBOC__
- # include <stdlib.h>
- # include <string.h>
- #endif __TURBOC__
-
- #define NUM_INTS 13
- #define END_OF_STRING '\0'
-
- #define CONTROL_INTERRUPT 96
- #define STATUS 0
- #define OFF 1
- #define ON 2
- #define FIND 3
- #define ZERO 4
- #define REPORT 5
-
- #define DOS 0x21
- #define GET_INT_VECTOR 0x35
-
- #ifdef __TURBOC__ /* prototype the functions */
- int error_exit(void) ;
- int tally_total_ticks(void) ;
- int print_interrupt_summary( int, char *descriptions[] ) ;
- int print_line(char *title, long number, long duration) ;
- #endif __TURBOC__
-
- struct tally
- {
- long time;
- long number;
- };
-
- long total_ticks; /* TOTAL NUMBER OF TIMER TICKS RECORDED. */
-
- char *int_desc[NUM_INTS+1] = {"OTHER",
- "PRINT SCREEN - INTERRUPT 5H",
- "VIDEO BIOS - INTERRUPT 10H",
- "DISK SERVICES - INTERRUPT 13H",
- "COMM PORT - INTERRUPT 14H",
- "SYSTEM UTILITY SERVICES - INTERRUPT 15H",
- "KEYBOARD BIOS - INTERRUPT 16H",
- "PRINTER BIOS - INTERRUPT 17H",
- "DOS FUNCTIONS - INTERRUPT 21H",
- "DOS ABSOLUTE DISK READ - INTERRUPT 25H",
- "DOS ABSOLUTE DISK WRITE - INTERRUPT 26H",
- "NETWORK - INTERRUPT 2AH",
- "MULTIPLEX - INTERRUPT 2FH",
- "EXPANDED MEMORY DRIVER - INTERRUPT 67H" };
-
- int max_services[NUM_INTS+1] = {0,0,29,29,6,223,19,3,109,0,0,7,206,108};
-
- char *other_services[] = {""};
- char *print_screen_services[] = {""};
- char *video_services[] = {"00 - Set Mode",
- "01 - Set Cursor Size",
- "02 - Set Cursor Position",
- "03 - Get Cursor Position",
- "04 - Get Light Pen Position",
- "05 - Set Active Page",
- "06 - Scroll Up",
- "07 - Scroll Down",
- "08 - Read Character and Attribute",
- "09 - Write Character and Attribute",
- "0A - Write Character",
- "0B - Set Palette",
- "0C - Write Dot",
- "0D - Read Dot",
- "0E - Write TTY",
- "0F - Get Mode",
- "10 - Service 16",
- "11 - Service 17",
- "12 - Alternate function select",
- "13 - Write String",
- "14 - LCD fonts",
- "15 - Get physical display parameters",
- "16 - Service 22",
- "17 - Service 23",
- "18 - Service 24",
- "19 - Service 25",
- "1A - Display combination",
- "1B - Functionality/State information",
- "1C - Save/Restore video state",
- "Undefined services"};
- char *disk_services[] = {"00 - Reset Diskette System",
- "01 - Get Diskette Status",
- "02 - Read Sectors",
- "03 - Write Sectors",
- "04 - Verify Sectors",
- "05 - Format Track",
- "06 - Fixed Disk - Format track",
- "07 - Fixed Disk - Format drive",
- "08 - Get Drive Parameters",
- "09 - Initialize Parameter Tables",
- "0A - Read Long",
- "0B - Write Long",
- "0C - Seek to Cylinder",
- "0D - Alternate Disk Reset",
- "0E - Read sector buffer",
- "0F - Write sector buffer",
- "10 - Test Ready",
- "11 - Recalibrate Drive",
- "12 - Controller RAM Diagnostics",
- "13 - Drive Diagnostics",
- "14 - Controller Diagnostics",
- "15 - Get Disk Type",
- "16 - Change Disk Status",
- "17 - Set Disk Type",
- "18 - Set Media Type for Format",
- "19 - Park Heads (ESDI)",
- "1A - Format ESDI Drive",
- "1B - Get ESDI Manufacturing Header",
- "1C - Get ESDI info",
- "Undefined services"};
- char *comm_services[] = {"00 - Initialize Serial Port",
- "01 - Send Character",
- "02 - Receive Character",
- "03 - Get Status",
- "04 - Extended Initialization",
- "05 - Extended Port Control",
- "Undefined services"};
- char *sys_util_services[] = {
- "00 - Turn on cassette motor",
- "01 - Turn off cassette motor",
- "02 - Read cassette",
- "03 - Write cassette",
- "04 - Service 4",
- "05 - Service 5",
- "06 - Service 6",
- "07 - Service 7",
- "08 - Service 8",
- "09 - Service 9",
- "0A - Service 10",
- "0B - Service 11",
- "0C - Service 12",
- "0D - Service 13",
- "0E - Service 14",
- "0F - Format Unit periodic interrupt",
- "10 - TopView/DESQview",
- "11 - TopView/DESQview",
- "12 - TopView/DESQview 'SEND' interface",
- "13 - Service 19",
- "14 - Service 20",
- "15 - Service 21",
- "16 - Service 22",
- "17 - Service 23",
- "18 - Service 24",
- "19 - Service 25",
- "1A - Service 26",
- "1B - Service 27",
- "1C - Service 28",
- "1D - Service 29",
- "1E - Service 30",
- "1F - Service 31",
- "20 - SysReq ",
- "21 - POST error log",
- "22 - Service 34",
- "23 - Service 35",
- "24 - Service 36",
- "25 - Service 37",
- "26 - Service 38",
- "27 - Service 39",
- "28 - Service 40",
- "29 - Service 41",
- "2A - Service 42",
- "2B - Service 43",
- "2C - Service 44",
- "2D - Service 45",
- "2E - Service 46",
- "2F - Service 47",
- "30 - Service 48",
- "31 - Service 49",
- "32 - Service 50",
- "33 - Service 51",
- "34 - Service 52",
- "35 - Service 53",
- "36 - Service 54",
- "37 - Service 55",
- "38 - Service 56",
- "39 - Service 57",
- "3A - Service 58",
- "3B - Service 59",
- "3C - Service 60",
- "3D - Service 61",
- "3E - Service 62",
- "3F - Service 63",
- "40 - Read/Modify system profiles",
- "41 - Wait on external event",
- "42 - CONVERTIBLE: request power off",
- "43 - CONVERTIBLE: read system status",
- "44 - CONVERTIBLE: (de)activate internal modem",
- "45 - Service 69",
- "46 - Service 70",
- "47 - Service 71",
- "48 - Service 72",
- "49 - Service 73",
- "4A - Service 74",
- "4B - Service 75",
- "4C - Service 76",
- "4D - Service 77",
- "4E - Service 78",
- "4F - Keyboard intercept",
- "50 - Service 80",
- "51 - Service 81",
- "52 - Service 82",
- "53 - Service 83",
- "54 - Service 84",
- "55 - Service 85",
- "56 - Service 86",
- "57 - Service 87",
- "58 - Service 88",
- "59 - Service 89",
- "5A - Service 90",
- "5B - Service 91",
- "5C - Service 92",
- "5D - Service 93",
- "5E - Service 94",
- "5F - Service 95",
- "60 - Service 96",
- "61 - Service 97",
- "62 - Service 98",
- "63 - Service 99",
- "64 - Service 100",
- "65 - Service 101",
- "66 - Service 102",
- "67 - Service 103",
- "68 - Service 104",
- "69 - Service 105",
- "6A - Service 106",
- "6B - Service 107",
- "6C - Service 108",
- "6D - Service 109",
- "6E - Service 110",
- "6F - Service 111",
- "70 - Service 112",
- "71 - Service 113",
- "72 - Service 114",
- "73 - Service 115",
- "74 - Service 116",
- "75 - Service 117",
- "76 - Service 118",
- "77 - Service 119",
- "78 - Service 120",
- "79 - Service 121",
- "7A - Service 122",
- "7B - Service 123",
- "7C - Service 124",
- "7D - Service 125",
- "7E - Service 126",
- "7F - Service 127",
- "80 - device open",
- "81 - device close",
- "82 - device program terminate",
- "83 - event wait",
- "84 - read joystick",
- "85 - SysReq key pressed/released",
- "86 - wait",
- "87 - extended memory block move",
- "88 - get extended memory size",
- "89 - switch to protected mode",
- "8A - Service 138",
- "8B - Service 139",
- "8C - Service 140",
- "8D - Service 141",
- "8E - Service 142",
- "8F - Service 143",
- "90 - device busy loop",
- "91 - complete device busy loop",
- "92 - Service 146",
- "93 - Service 147",
- "94 - Service 148",
- "95 - Service 149",
- "96 - Service 150",
- "97 - Service 151",
- "98 - Service 152",
- "99 - Service 153",
- "9A - Service 154",
- "9B - Service 155",
- "9C - Service 156",
- "9D - Service 157",
- "9E - Service 158",
- "9F - Service 159",
- "A0 - Service 160",
- "A1 - Service 161",
- "A2 - Service 162",
- "A3 - Service 163",
- "A4 - Service 164",
- "A5 - Service 165",
- "A6 - Service 166",
- "A7 - Service 167",
- "A8 - Service 168",
- "A9 - Service 169",
- "AA - Service 170",
- "AB - Service 171",
- "AC - Service 172",
- "AD - Service 173",
- "AE - Service 174",
- "AF - Service 175",
- "B0 - Service 176",
- "B1 - Service 177",
- "B2 - Service 178",
- "B3 - Service 179",
- "B4 - Service 180",
- "B5 - Service 181",
- "B6 - Service 182",
- "B7 - Service 183",
- "B8 - Service 184",
- "B9 - Service 185",
- "BA - Service 186",
- "BB - Service 187",
- "BC - Service 188",
- "BD - Service 189",
- "BE - Service 190",
- "BF - Service 191",
- "C0 - Get system configuration",
- "C1 - Return BIOS extended data area",
- "C2 - Pointing device interface",
- "C3 - enable/disable watchdog timeout",
- "C4 - programmable option select",
- "C5 - Service 197",
- "C6 - Service 198",
- "C7 - Service 199",
- "C8 - Service 200",
- "C9 - Service 201",
- "CA - Service 202",
- "CB - Service 203",
- "CC - Service 204",
- "CD - Service 205",
- "CE - Service 206",
- "CF - Service 207",
- "D0 - Service 208",
- "D1 - Service 209",
- "D2 - Service 210",
- "D3 - Service 211",
- "D4 - service 212",
- "D5 - service 213",
- "D6 - service 214",
- "D7 - service 215",
- "D8 - service 216",
- "D9 - service 217",
- "DA - service 218",
- "DB - service 219",
- "DC - service 220",
- "DD - service 221",
- "DE - DESQview ",
- "Undefined services" } ;
- char *keyboard_services[] = {"00 - Read Character",
- "01 - Character Waiting?",
- "02 - Get Shift Status",
- "03 - Set Delays",
- "04 - Set Keyclick",
- "05 - Write to Keyboard",
- "06 - Service 6",
- "07 - Service 7",
- "08 - Service 8",
- "09 - Service 9",
- "0A - Service 10",
- "0B - Service 11",
- "0C - Service 12",
- "0D - Service 13",
- "0E - Service 14",
- "0F - Service 15",
- "10 - Read Extended Keystroke",
- "11 - Extended Key Waiting?",
- "12 - Extended Shift Status",
- "Undefined services"};
- char *printer_services[] = {"00 - Send Byte",
- "01 - Initialize Printer",
- "02 - Get Printer Status",
- "Undefined services"};
- char *dos_services[] = {"00 - Terminate",
- "01 - Keyboard Input With Echo",
- "02 - Display Output",
- "03 - Serial Input",
- "04 - Serial Output",
- "05 - Printer Output",
- "06 - Keyboard/Display I/O",
- "07 - Keyboard Input No Echo",
- "08 - Keyboard Input No Echo",
- "09 - Display String",
- "0A - Buffered Keyboard Input",
- "0B - Keyboard Status",
- "0C - Clear Keyboard",
- "0D - Reset Disk",
- "0E - Set Default Drive",
- "0F - Open File FCB Mode",
- "10 - Close File FCB Mode",
- "11 - Find First File FCB Mode",
- "12 - Find Next File FCB Mode",
- "13 - Delete File FCB Mode",
- "14 - Read Sequential",
- "15 - Write Sequential",
- "16 - Create File FCB Mode",
- "17 - Rename File FCB Mode",
- "18 - Service 24",
- "19 - Get Default Drive",
- "1A - Set Disk Transfer Area",
- "1B - Get FAT Info, Default Drive",
- "1C - Get FAT Info, Any Drive",
- "1D - Service 29",
- "1E - Service 30",
- "1F - Get Default Drive Params",
- "20 - Service 32",
- "21 - Read Random",
- "22 - Write Random",
- "23 - Get File Size",
- "24 - Set Random Record Field",
- "25 - Set Interrupt Vector",
- "26 - Create Program Segment",
- "27 - Read Random, Multiple Records",
- "28 - Write Random, Multiple Records",
- "29 - Parse Filename",
- "2A - Get Date",
- "2B - Set Date",
- "2C - Get Time",
- "2D - Set Time",
- "2E - Set Disk Write Verification",
- "2F - Get DTA Address",
- "30 - Get DOS Version Number",
- "31 - Terminate and Stay Resident",
- "32 - Get Drive Parameter Block",
- "33 - Get/Set Ctrl Break",
- "34 - Get INDOS Flag",
- "35 - Get Interrupt Vector",
- "36 - Get Disk Free Space",
- "37 - Switchar/Availdev",
- "38 - Get Country-Dependent Info",
- "39 - Make Directory",
- "3A - Remove Directory",
- "3B - Change Default Directory",
- "3C - Create File, Handle Mode",
- "3D - Open File, Handle Mode",
- "3E - Close File, Handle Mode",
- "3F - Read from File or Device",
- "40 - Write to File or Device",
- "41 - Delete File, Handle Mode",
- "42 - Move File Pointer",
- "43 - Get/Set File Attributes",
- "44 - I/O Control for Devices",
- "45 - Duplicate File Handle",
- "46 - Force File Handle Duplication",
- "47 - Get Default Directory",
- "48 - Allocate Memory",
- "49 - Free Memory",
- "4A - Modify Allocated Memory",
- "4B - EXEC",
- "4C - Terminate Process",
- "4D - Get Return Code",
- "4E - Find First File, Handle Mode",
- "4F - Find Next File, Handle Mode",
- "50 - Set PSP",
- "51 - Get PSP",
- "52 - Get DOS list-of-lists",
- "53 - Translate BIOS Parameter Block",
- "54 - Get Verify State",
- "55 - Create Child PSP",
- "56 - Rename File, Handle Mode",
- "57 - Get/Set File Date and Time",
- "58 - Get/Set Memory Allocation Strategy",
- "59 - Get Extended Error",
- "5A - Create Temporary File",
- "5B - Create New File",
- "5C - Lock/Unlock File Access",
- "5D - SHARE.EXE-related",
- "5E - Network Services",
- "5F - Network Services",
- "60 - Canonicalize Filename",
- "61 - Service 97 - unused",
- "62 - Get PSP Address",
- "63 - Get Lead Byte Table",
- "64 - Network-related",
- "65 - Get Extended Country Info",
- "66 - Code Page Support",
- "67 - Set Handle Count",
- "68 - Commit File",
- "69 - Get/Set Disk Serial Number",
- "6A - Service 106",
- "6B - Service 107",
- "6C - Extended Open/Create",
- "Undefined services"};
- char *disk_read_services[] = {""};
- char *disk_write_services[] = {""};
- char *network2A_services[] = {
- "00 - Network installation check",
- "01 - Execute NetBIOS request",
- "02 - Set Network printer mode",
- "03 - Check direct I/O",
- "04 - Execute NetBIOS",
- "05 - Get network resource info",
- "06 - Print-stream control",
- "Other services (network hooks)"};
- char *multiplex_services[] = {
- "00 - Service 0",
- "01 - PRINT",
- "02 - PC LAN Program redirector",
- "03 - Service 3",
- "04 - Service 4",
- "05 - Critical Error msg override",
- "06 - ASSIGN",
- "07 - Service 7",
- "08 - DRIVER.SYS support",
- "09 - Service 9",
- "0A - Service 10",
- "0B - Service 11",
- "0C - Service 12",
- "0D - Service 13",
- "0E - Service 14",
- "0F - Service 15",
- "10 - SHARE",
- "11 - Network redirector",
- "12 - Network/SHARE support",
- "13 - Service 19",
- "14 - NLSFUNC",
- "15 - CDROM",
- "16 - Service 22",
- "17 - Service 23",
- "18 - Service 24",
- "19 - SHELLB.COM",
- "1A - ANSI.SYS",
- "1B - XMA2EMS.SYS",
- "1C - Service 28",
- "1D - Service 29",
- "1E - Service 30",
- "1F - Service 31",
- "20 - Service 32",
- "21 - Service 33",
- "22 - Service 34",
- "23 - Service 35",
- "24 - Service 36",
- "25 - Service 37",
- "26 - Service 38",
- "27 - Service 39",
- "28 - Service 40",
- "29 - Service 41",
- "2A - Service 42",
- "2B - Service 43",
- "2C - Service 44",
- "2D - Service 45",
- "2E - Service 46",
- "2F - Service 47",
- "30 - Service 48",
- "31 - Service 49",
- "32 - Service 50",
- "33 - Service 51",
- "34 - Service 52",
- "35 - Service 53",
- "36 - Service 54",
- "37 - Service 55",
- "38 - Service 56",
- "39 - Service 57",
- "3A - Service 58",
- "3B - Service 59",
- "3C - Service 60",
- "3D - Service 61",
- "3E - Service 62",
- "3F - Service 63",
- "40 - Service 64",
- "41 - Service 65",
- "42 - Service 66",
- "43 - XMS driver",
- "44 - Service 68",
- "45 - Service 69",
- "46 - Service 70",
- "47 - Service 71",
- "48 - Service 72",
- "49 - Service 73",
- "4A - Service 74",
- "4B - Service 75",
- "4C - Service 76",
- "4D - Service 77",
- "4E - Service 78",
- "4F - Service 79",
- "50 - Service 80",
- "51 - Service 81",
- "52 - Service 82",
- "53 - Service 83",
- "54 - TesSeRact TSR interface",
- "55 - Service 85",
- "56 - Service 86",
- "57 - Service 87",
- "58 - Service 88",
- "59 - Service 89",
- "5A - Service 90",
- "5B - Service 91",
- "5C - Service 92",
- "5D - Service 93",
- "5E - Service 94",
- "5F - Service 95",
- "60 - Service 96",
- "61 - Service 97",
- "62 - Service 98",
- "63 - Service 99",
- "64 - SCRNSAV2.COM",
- "65 - Service 101",
- "66 - Service 102",
- "67 - Service 103",
- "68 - Service 104",
- "69 - Service 105",
- "6A - Service 106",
- "6B - Service 107",
- "6C - Service 108",
- "6D - Service 109",
- "6E - Service 110",
- "6F - Service 111",
- "70 - Service 112",
- "71 - Service 113",
- "72 - Service 114",
- "73 - Service 115",
- "74 - Service 116",
- "75 - Service 117",
- "76 - Service 118",
- "77 - Service 119",
- "78 - Service 120",
- "79 - Service 121",
- "7A - Novell Netware",
- "7B - Service 123",
- "7C - Service 124",
- "7D - Service 125",
- "7E - Service 126",
- "7F - Service 127",
- "80 - EASY-NET",
- "81 - Service 129",
- "82 - Service 130",
- "83 - Service 131",
- "84 - Service 132",
- "85 - Service 133",
- "86 - Service 134",
- "87 - Service 135",
- "88 - Service 136",
- "89 - WHOA!.COM",
- "8A - Service 138",
- "8B - Service 139",
- "8C - Service 140",
- "8D - Service 141",
- "8E - Service 142",
- "8F - Service 143",
- "90 - Service 144",
- "91 - Service 145",
- "92 - Service 146",
- "93 - Service 147",
- "94 - Service 148",
- "95 - Service 149",
- "96 - Service 150",
- "97 - Service 151",
- "98 - Service 152",
- "99 - Service 153",
- "9A - Service 154",
- "9B - Service 155",
- "9C - Service 156",
- "9D - Service 157",
- "9E - Service 158",
- "9F - Service 159",
- "A0 - Service 160",
- "A1 - Service 161",
- "A2 - Service 162",
- "A3 - Service 163",
- "A4 - Service 164",
- "A5 - Service 165",
- "A6 - Service 166",
- "A7 - Service 167",
- "A8 - Service 168",
- "A9 - Service 169",
- "AA - VIDCLOCK.COM",
- "AB - Service 171",
- "AC - Service 172",
- "AD - DISPLAY.SYS/KEYB.COM",
- "AE - COMMAND.COM installable cmds",
- "AF - Service 175",
- "B0 - GRAFTABL",
- "B1 - Service 177",
- "B2 - Service 178",
- "B3 - Service 179",
- "B4 - Service 180",
- "B5 - Service 181",
- "B6 - Service 182",
- "B7 - APPEND",
- "B8 - Network",
- "B9 - Service 185",
- "BA - Service 186",
- "BB - Service 187",
- "BC - Service 188",
- "BD - Service 189",
- "BE - Service 190",
- "BF - PC LAN Program",
- "C0 - Service 192",
- "C1 - Service 193",
- "C2 - Service 194",
- "C3 - Service 195",
- "C4 - Service 196",
- "C5 - Service 197",
- "C6 - Service 198",
- "C7 - Service 199",
- "C8 - Service 200",
- "C9 - Service 201",
- "CA - Service 202",
- "CB - Communicating App Spec",
- "CC - Service 204",
- "CD - Intel Image Processing Interface",
- "Undefined services"
- } ;
- char *ems_services[] = {"00 - Service 0",
- "01 - Service 1",
- "02 - Service 2",
- "03 - Service 3",
- "04 - Service 4",
- "05 - Service 5",
- "06 - Service 6",
- "07 - Service 7",
- "08 - Service 8",
- "09 - Service 9",
- "0A - Service 10",
- "0B - Service 11",
- "0C - Service 12",
- "0D - Service 13",
- "0E - Service 14",
- "0F - Service 15",
- "10 - Service 16",
- "11 - Service 17",
- "12 - Service 18",
- "13 - Service 19",
- "14 - Service 20",
- "15 - Service 21",
- "16 - Service 22",
- "17 - Service 23",
- "18 - Service 24",
- "19 - Service 25",
- "1A - Service 26",
- "1B - Service 27",
- "1C - Service 28",
- "1D - Service 29",
- "1E - Service 30",
- "1F - Service 31",
- "20 - Service 32",
- "21 - Service 33",
- "22 - Service 34",
- "23 - Service 35",
- "24 - Service 36",
- "25 - Service 37",
- "26 - Service 38",
- "27 - Service 39",
- "28 - Service 40",
- "29 - Service 41",
- "2A - Service 42",
- "2B - Service 43",
- "2C - Service 44",
- "2D - Service 45",
- "2E - Service 46",
- "2F - Service 47",
- "30 - Service 48",
- "31 - Service 49",
- "32 - Service 50",
- "33 - Service 51",
- "34 - Service 52",
- "35 - Service 53",
- "36 - Service 54",
- "37 - Service 55",
- "38 - Service 56",
- "39 - Service 57",
- "3A - Service 58",
- "3B - Service 59",
- "3C - Service 60",
- "3D - Service 61",
- "3E - Service 62",
- "3F - Service 63",
- "40 - Get manager status",
- "41 - Get page frame segment",
- "42 - Get number of pages",
- "43 - Get handle and allocate memory",
- "44 - Map memory",
- "45 - Release handle and memory",
- "46 - Get EMM version",
- "47 - Save mapping context",
- "48 - Restore mapping context",
- "49 - reserved - Get I/O port address",
- "4A - reserved - Get Translation Array",
- "4B - Get number of EMM handles",
- "4C - Get pages owned by handle",
- "4D - Get pages for all handles",
- "4E - Get or Set page map",
- "4F - Get/Set partial page map",
- "50 - Map/Unmap multiple handle pages",
- "51 - Reallocate pages",
- "52 - Get/Set handle attributes",
- "53 - Get/Set handle name",
- "54 - Get handle directory",
- "55 - Alter page map and jump",
- "56 - Alter page map and call",
- "57 - Move/Exchange memory region",
- "58 - Get mappable physical address array",
- "59 - Get expanded memory hardware information",
- "5A - Allocate standard/raw pages",
- "5B - Alternate map register set",
- "5C - Prepare for warm boot",
- "5D - Enable/Disable OS function set",
- "5E - Service 94",
- "5F - Service 95",
- "60 - EEMS: Get physical window array",
- "61 - EEMS: Generic accelerator card support",
- "62 - Service 98",
- "63 - Service 99",
- "64 - Service 100",
- "65 - Service 101",
- "66 - Service 102",
- "67 - Service 103",
- "68 - EEMS: Get addresses of all page frames",
- "69 - EEMS: Map page into frame",
- "6A - EEMS: Page mapping",
- "6B - Service 107",
- "undefined services"
- } ;
-
- char **service_descriptions[NUM_INTS+1] = {other_services,
- print_screen_services,
- video_services,
- disk_services,
- comm_services,
- sys_util_services,
- keyboard_services,
- printer_services,
- dos_services,
- disk_read_services,
- disk_write_services,
- network2A_services,
- multiplex_services,
- ems_services };
-
- FILE *output_file;
-
- main ( argc , argv )
- int argc;
- char *argv[];
- {
- union REGS registers;
- struct SREGS segregs;
- int function;
- int save_status;
- FILE *fopen();
- int int_number;
-
- printf("\n\n(C) Copyright 1988 G. Kent Cobb - All Rights Reserved\n\tEnhanced by Ralf Brown\n");
- if (argc < 2)
- error_exit();
-
- if (stricmp(argv[1],"STATUS") == 0)
- function = 0;
- else if (stricmp(argv[1],"OFF") == 0)
- function = 1;
- else if (stricmp(argv[1],"ON") == 0)
- function = 2;
- else if (stricmp(argv[1],"ZERO") == 0)
- function = 4;
- else if (stricmp(argv[1],"REPORT") == 0)
- function = 5;
- else
- error_exit();
-
- /* CHECK TO MAKE SURE THAT sys_prof HAS BEEN INSTALLED. */
-
- registers.h.ah = GET_INT_VECTOR;
- registers.h.al = CONTROL_INTERRUPT;
- int86x(DOS,®isters,®isters,&segregs);
- if ((registers.x.bx == 0) && (segregs.es == 0))
- {
- printf("\n\nSYS_PROF has not been installed.");
- exit(2);
- }
-
- switch (function)
- {
-
- /* IF TURNING PROFILER OFF OR ON, DROP THROUGH TO REPORT THE STATUS ALSO. */
-
- case OFF:
- case ON:
- registers.h.ah = function;
- int86(CONTROL_INTERRUPT,®isters,®isters);
- case STATUS:
- registers.h.ah = STATUS;
- int86(CONTROL_INTERRUPT,®isters,®isters);
- printf("\n\nProfiler is %s",(registers.x.ax == 0) ? "OFF" : "ON" );
- break;
- case ZERO:
- registers.h.ah = function;
- int86(CONTROL_INTERRUPT,®isters,®isters);
- printf("\n\nProfiler tables re-initialized.");
- break;
- case REPORT:
-
- /* GET THE CURRENT PROFILER STATUS. */
-
- registers.h.ah = STATUS;
- int86(CONTROL_INTERRUPT,®isters,®isters);
- save_status = registers.x.ax;
-
- /* TURN ACCUMULATION OFF FOR NOW. */
-
- registers.h.ah = OFF;
- int86(CONTROL_INTERRUPT,®isters,®isters);
-
- /* GET THE ADDRESS OF THE ACCUMULATION TABLE. */
-
- registers.h.ah = FIND;
- int86x(CONTROL_INTERRUPT,®isters,®isters,&segregs);
-
- /* OPEN THE FILE WHICH WILL CONTAIN THE OUTPUT. */
-
- if (argc > 2)
- {
- if ((output_file = fopen(argv[2],"w")) == NULL)
- {
- printf("\n\nCannot open output file.");
- exit(2);
- }
- }
- else
- output_file = stdprn;
-
- /* CALCULATE THE TOTAL NUMBER OF TIMER TICKS. */
-
- tally_total_ticks();
-
- /* PRINT OUT THE HEADERS. */
-
- fprintf(output_file,
- " Number of Number of Percent of\n");
- fprintf(output_file,
- " Service Occurrences Timer ticks Total Time\n");
-
- /* PRINT OUT A SUMMARY FOR EACH INTERRUPT. */
-
- for (int_number = 1; int_number <= NUM_INTS; int_number++)
- print_interrupt_summary(int_number,service_descriptions[int_number]);
- print_interrupt_summary(0,service_descriptions[0]);
-
- fprintf(output_file,"\n\n");
- fprintf(output_file,
- "\n Total time: %ld timer ticks",total_ticks);
- fprintf(output_file,
- "\n %ld seconds\n",
- (long)(total_ticks/18.2));
-
- /* IF ACCUMULATION WAS ON WHEN WE STARTED, TURN IT BACK ON. */
-
- if (save_status != 0)
- {
- registers.h.ah = ON;
- int86(CONTROL_INTERRUPT,®isters,®isters);
- }
-
- default:
-
- break;
- } /* END OF SWITCH (FUNCTION) */
-
- exit(0);
- } /* END OF MAIN */
-
- print_interrupt_summary ( int_number , descriptions )
-
- int int_number;
-
- char *descriptions[];
- {
- struct tally far *beginning_address , far *address;
- int non_zero , service;
- long total_time , total_number;
- int idx;
- union REGS registers;
- struct SREGS segregs;
-
- /* GET THE ADDRESS OF THE TABULATED DATA FOR THIS PARTICULAR INTERRUPT. */
-
- registers.h.ah = FIND;
- int86x(CONTROL_INTERRUPT,®isters,®isters,&segregs);
- #ifdef __TURBOC__
- beginning_address = MK_FP(segregs.es,registers.x.bx) ;
- #else
- FP_SEG(beginning_address) = segregs.es;
- FP_OFF(beginning_address) = registers.x.bx;
- #endif __TURBOC__
- for (idx = 0; idx < int_number; idx++)
- beginning_address += (1+max_services[idx]);
-
- /* CALCULATE THE TOTAL NUMBER OF TIMER TICKS SPENT IN THIS INTERRUPT. */
-
- for (service = 0 , total_number = 0L , address = beginning_address;
- service <= max_services[int_number]; address++ , service++)
- total_number += address->number;
-
- /* DON'T PRINT ANYTHING IF THIS INTERRUPT WAS NOT USED. */
-
- if (total_number == 0)
- return;
-
- /* PRINT OUT THE HEADER DESCRIBING THE INTERRUPT. */
-
- fprintf(output_file,"\n\n%s\n",int_desc[int_number]);
-
- /* NOW PRINT OUT THE INFORMATION FOR EACH SERVICE. */
-
- for (service = 0 , total_time = 0L , address = beginning_address , non_zero = 0;
- service <= max_services[int_number]; address++ , service++)
- {
- if (address->number != 0)
- {
- print_line(descriptions[service],address->number,address->time);
- non_zero++;
- }
- total_time += address->time;
- }
-
- /* AFTER DETAILING EACH SERVICE, PRINT OUT THE SUMMARY FOR ALL SERVICES. */
-
- if (non_zero > 1)
- print_line("TOTAL",total_number,total_time);
-
- return;
- } /* END OF PRINT_INTERRUPT_SUMMARY */
-
- print_line ( title , number , duration )
- char *title;
- long number;
- long duration;
- {
- char string[120];
- static char blanks[40] = " ";
-
- sprintf(string,"\n %s",title);
- strcat(string,blanks);
- string[40] = END_OF_STRING;
- sprintf(&string[40],"%8ld %8ld %5.2f",number,duration,
- (float)(100*duration)/total_ticks);
- fputs(string,output_file);
- return;
- } /* END OF PRINT_LINE */
-
- tally_total_ticks()
- {
- struct tally far *ptr;
- union REGS registers;
- struct SREGS segregs;
- int idx , total_services;
-
- /* CALCULATE THE TOTAL NUMBER OF BINS. */
-
- for (idx = 0 , total_services = 0; idx <= NUM_INTS; idx++)
- total_services += (1+max_services[idx]);
-
- /* GET THE ADDRESS OF THE TABLE. */
-
- registers.h.ah = FIND;
- int86x(CONTROL_INTERRUPT,®isters,®isters,&segregs);
- #ifdef __TURBOC__
- ptr = MK_FP(segregs.es,registers.x.bx) ;
- #else
- FP_SEG(ptr) = segregs.es;
- FP_OFF(ptr) = registers.x.bx;
- #endif __TURBOC__
-
- for (idx = 0 , total_ticks = 0; idx < total_services; idx++ , ptr++)
- total_ticks += ptr->time;
-
- return;
- } /* END OF TALLY_TOTAL_TICKS */
-
- error_exit()
-
- {
- printf("\n\nProper syntax is:\n\n ");
- printf("PROFCTRL STATUS | OFF | ON | ZERO | REPORT");
- exit(1);
- } /* END OF ERROR_EXIT */
-
-
-