[comp.sources.amiga] v90i036: Xoper 2.2 - display and control system activity, Part01/04

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (02/01/90)

Submitted-by: Werner Guenther <G35%DHDURZ1.BITNET@CUNYVM.CUNY.EDU>
Posting-number: Volume 90, Issue 036
Archive-name: kernel/xoper-2.2/part01

Xoper is a freeware program to display and to control system activity.

[ the monolithic source file has been split into parts small enough to
  post.  remember to rejoin them into one file before assembling.  ...tad ]

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 4)."
# Contents:  Xoper.doc Xoper.startup
# Wrapped by tadguy@xanth on Wed Jan 31 22:31:31 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Xoper.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Xoper.doc'\"
else
echo shar: Extracting \"'Xoper.doc'\" \(20785 characters\)
sed "s/^X//" >'Xoper.doc' <<'END_OF_FILE'
X				 Xoper V2.2
X
X		    Copyright (c) Werner Gunther 1989
X
XXoper is a freeware program to display and to control system activity.
XPermition is granted to freely distribute this program.
X
X--------------------------------------------------------------------------
XChanges in V1.2:
XNew commands: Snoop, Capture, ClrCool, ClrWarm, ClrCold.
XAdded	    : CPU usage by task.
X
XCancel command has been rewritten, some minor bugs removed.
X---------------------------------------------------------------------------
XChanges in V1.3:
XNew commands: [S]=Stack usage, Sort, Hide, Hidden, Header, Window,
X	      InputHandler.
XAdded	    : Support of startup-scripts, I/O Interrupts/second, 'Kill' an
X	      alias for 'Cancel'.
XSome BIG bugs have been removed: The port-display used to GURU if more than
X32 Ports did exist. The Cli Xoper has been started did act like having a
Xpriority of 128. Unlock didn't unlock sometimes, the interrupt/priority
Xfield did contain rubbish, Currentdir didn't examine all Processes.
XThere were some more, minor bugs, all (hopefully) removed.
X---------------------------------------------------------------------------
XChanges in V1.3b:
XNew commands: [C] information on CLI-Tasks.
XAdded	    : 'Time 0' stops any update, System-Requesters are now handeled
X	      correctly (affects 'Kill' and 'Closewindow').
X---------------------------------------------------------------------------
XChanges in V2.0:
XThe 'user interface' (what user interface ?) has been rewritten from
Xscratch, and a small iconify routine has been added. To customize the whole
Xthing a little bit, there are a few new commands:
X MinimumChars, HistoryLines, ShowHistory, KillHistory, OutputLines,
XIconifyOff, BackDropIcon, UseScreen, UseWindow.
XOther new commands include:
XTimerIO, RemResident, Repeat, TrapGuru, Setfont, DiskChange, Alias,
XSaveOutput.
XAddresses are now shown as 32-Bit values for 68020 compatibility. The 'More'
Xcommand is obsolete and has been removed. The 'interrupt list' has two new
Xfields. 'Time' w/o parameters shows current setting. 'display commands'
Xseparated by blanks will display the lists one by one, instead of
Xdisplaying them all at once.
X---------------------------------------------------------------------------
XChanges in V2.1:
XMostly bug fixes:
X KS1.3 dependancy removed. Using UseScreen in the startup file could crash
Xthe program if started with the -b flag. The S (stack) command wasn't
Xrobust enought. Some strangness in the 'KILL' routine have been removed.
XThe iconizing routine couldn't distinguish between multiple drags and
Xdoubleclicks.
XAdded: SetFKeys, Time accepts values < 1, 'Windows' shows the owner task (if
Xavailable). The task display shows the name of the loaded command
X(enclosed in '[]') instead of the name, if the task is a CLI, 'CLICmd'
Xtoggles this feature on/off. Commandline completion using <tab>.
X
XA new program 'KillXoper' has been added to the distribution to remove
XXoper from memory in case it loops or freezes (I hope it won't be needed).
X---------------------------------------------------------------------------
XChanges in V2.2:
XThe 'KillXoper' routine has been put into Xoper's main program. Loaded CLI
Xcommands are always displayed, not only in the task list.
X---------------------------------------------------------------------------
X
XStarting Xoper from CLI:
X
XXoper [kill] [-b] [T] [F] [S] [L] [D] [R] [E] [M] [P] [I] [C]
X
XThese parameters are described below. For all those who like long
XStartup-Sequences, overcrowded memory and hot-keys enter
X
XXoper -b
X
XThis will install Xoper in background waiting for LeftAmiga-RightAmiga-X
Xto pop up. In both cases you don't have to RUN or RUNBACK Xoper, it will
Xalways create its own process.
X
XXoper kill
X
Xwill kill an already running Xoper task from outside, in case Xoper hangs or
Xguru's.
X
XAt startup Xoper loads and executes a file named S:Xoper.Startup if such a
Xfile is available. This startup-script is used to set default values, the
Xwindow size or the initial default list to be displayed. The Xoper-window
Xwill only be opened after the startup-script has been processed. Look at the
Xend of the document for a sample startup file.
X
XXoper Window:
X-------------
X The window (or screen if you request one) is devided into two sections: a
Xvery small input line on the bottom and a large output area on the top. If
Xthe output exceeds the size of the window you may scroll or 'page' through
Xthe text using the num-pad keys:
X
XA1000  A2000/A500
X  7	Home		Top of display
X  1	End		Bottom
X  9	Pg Up		one page up
X  3	Pg Dn		one page down
X  8	Up Arrow	one line up
X  2	Down Arrow	one line down
X  4	Left Arrow	one page left
X  6	Right Arrow	one page right
X
X The input section has some line editing facilities and a history buffer
Xcontollable with the following keys (similar to NewCon and ConMan):
X
XCursor left		cursor one character left
XShift  left		cursor to the start of the next word
XCursor right		one character right
XShift  right		previous word
XCursor Up		previous line in history buffer
XShift  Up		top of buffer
XCursor Down		next line in history buffer
XShift  Down		bottom of buffer
XDEL			DEL
XBS			backspace
XCtrl   X		delete line
XCtrl   Y		delete EOL
XIns   (numpad '0')      toggles insert mode (default is 'on')
XDel   (numpad '.')      same as DEL
X
XESC			moves the input area from the bottom into the
X			output section. Entering a command here (i.e
X			overwiting an output line), will cause Xoper to add
X			the address of that node to your command line.
X			Example: Show the hunks of a 'File.System' process:
X			type 'T' to get a list of all tasks, press <esc>,
X			move the cursor to the line displaying the
X			File.System process and type 'Hunks <enter>'. Press
X			<enter> once more to return to the usual Xoper
X			display.
XHelp			displays a help panel.
XTAB			Command line completion.
X			Example: press <c>, hit <tab> several times.
X
XThe Xoper window has, beside the usual closewindow and depth-arrange
Xgadgets, a custom gadget on its title bar, used to iconify Xoper. The icon
Xmay be moved anywhere on the screen just by dragging it, double clicking
Xthe icon will restart the program. The window itself is a simple_refresh
Xwindow, so it may look a little bit sluggish when it needs a refresh.
X
XXoper Commands:
X---------------
X
X Commands are entered in the command line at the bottom of the window,
Xthese are divided into two groups:
X
XDisplay commands: These are always single character entries and may be
Xspecified in any order, upper or lower case, after the prompt or from CLI
Xas parameters. If more than one list has to be displayed, you may enter
Xseveral commands in one line. Separating them with blanks display the lists
Xone by one instead of showing them all at once.
X
XT = Tasks (Default if Xoper is called without parameters)
XTask node (HEX), Display type, status, priority (decimal), CPU usage
X(percent), processnumber for Dos-Processes (decimal), taskname (or the
Xname of the loaded command, if a CLI process. The loaded command name
Xis enclosed in '[]').
X
XF = Task Flags
XTask node (HEX), Allocated Signals (HEX), Signals the Task is waiting for
X(HEX), Signals received (HEX), Address of the next instruction to be
Xexecuted (HEX).
X
XC = Cli Commands
XTask node (HEX), Type (interactive/batch), Mode (Background/Foreground),
XCLI number, CLI name, program it executes.
X
XL = Libraries
XBase address (HEX), open count (decimal), version (decimal), revision
X(decimal), flags (binary), libraryname.
X
XD = Devices
XBase address (HEX), open count (decimal), version (decimal), revision
X(decimal), flags (binary), devicename.
X
XE = Resident (sorry)
XBase address (HEX), priority (decimal), flags (binary), version
X(decimal), type, name.
X
XR = Resources
XBase address (HEX), open count (decimal), version (decimal), revision
X(decimal), flags (binary), resource name.
X
XM = Memory
XLower and upper bounds (HEX), bytes free (decimal), attributes, priority
X(decimal), hunk name.
X
XP = Ports
XNode address (HEX), portname, flags, signal bit (decimal), queue length
X[number of messages] (decimal), taskname.
X
XI = Interrupts
XNode address (HEX), pointer to interrupt data (HEX), pointer to interrupt
Xcode (HEX), priority (decimal),[T]ype ([S]erver/[H]andler), [S]tate
X([E]nabled/[D]isabled), type (interrupt queue the interrupt belongs to),
Xinterrupt name.
X
XS = Stack
XLower limit of the stack, stack size, currently used stacksize, taskname.
XIf you want to minimize your stack using this utility, please note that
XDOS-functions use 1500 Bytes at the bottom of the Stack frame for their own
Xpurposes and note that the stacksize is only checked one time per second by
Xthis command.
X
XH = Help ( or ?)
XShow a list of commands.
X
X; = NOP
XSkip this line (used for remarks in a script file)
X
XQ = Quit
XSame as QUIT (see below).
X
XExample: Entering TPM would display Tasks, Ports and Memory. The display
Xwould be updated after a few seconds (5 by default, may be changed
Xanytime, see below.)
X
XOther commands that do not display EXEC lists:
XThese commands may be entered upper or lower case. Parameters enclosed
Xin '<>' must be, enclosed in '[]' may be specified. Names are usually
Xentered as ascii strings, it can however happen that two or more nodes of
Xthe same name exist. On tasks you may specify the DOS-Processnumber to
Xsort them out. If everything fails, you can enter the Node-Address with a
Xleading '$'. This address will be checked first before the command is being
Xexecuted. If the check fails, you'll get an error message or a warning or
Xa prompt, depending on what went wrong. Names are always the last parameter
Xto enter. This may seem strange, but it is the simplest way to get rid of
Xembedded blanks.
X
XTime <seconds>
XSet time between updates. Minimum is 0.1 seconds, maximum is 255.9, default
Xis 5 seconds. Time 0 stops automatic update and waits for a keypress. Values
X < 0.5 are not recommended.
XExample: Time 1.5
X
XTaskpri <priority> [processnumber] <taskname>
XChange the priority of a task. Values may range from -127 to 127, better
Xuse values between -5 and 5.
XExample: Taskpri 1 New Cli
X
XMypri <priority>
XShortcut for "Taskpri Xoper <priority>"
XExample: Mypri 2
X
XPri <priority> <nodename>
XChange the priority of any other node. This command does not work for Tasks.
XIf the specified node has been found, the entire list the node belongs to
Xwill be resorted.
XExample: Pri 1 Chip Memory	  (try to allocate memory in CHIP first)
X
XBreak [processnumber] <taskname>
XSet break signals. Useful for tasks running in background or from Workbench.
XExample: Break 3 New CLI
X
XHunks [processnumber] <processname>
XShow location, BCPL-Pointers and length of memory blocks the process uses.
XExample: Hunks RAM
X
XSnoop [processnumber] <taskname>
XTrack memory allocation/deallocation of a task. Press break (CTRL-C) to
Xstop. List includes: action (alloc/free), memory requirements (CHIP/ FAST/
XPUBLIC etc), memory size, memory location (start, end) and the address from
Xwhere AllocMem() was called.
X
XFiles
XList lock, access, size and name of open files.
X
XLocks
XList any lock.
XBUG: Trying to lock the Volume "RAM Disk" crashes the machine sometimes. If
Xa Volume "RAM Disk" is found it will be replaced by the devicename "RAM:"
X(this has been fixed on WB 1.3). Make sure you don't have a disk labeled
X"RAM Disk" or you'll never see its locks:-)
X
XCurrentdir
XList current directory settings of all processes.
X
XDevices
XList name,heads,sectors,tracks,startup-buffers and handler-process of every
XDOS-device.
X
XInputhandler
XDisplay node, priority and name (if any) of the input-handlers currently in
Xuse.
X
XCapture
XShow vectors controlling the reset, i.e. CoolCapture, ColdCapture and
XWarmCapture pointers, KickMem allocations. Useful when searching
Xfor Viruses, but remember that the RAD: device in 1.3 uses the KickMem
Xpointer to recover from a reset.
X
XClrCool
XClrCold
XClrWarm
XClear one of those pointers.
X
XTimerIO
XDisplay pending timer requests. It shows the address of the
XIORequest-structure, the unit (MICROHZ or VBLANK), the time to complete (up
Xto 255 secs) and the task submitting the request.
X
XRemResident <resident module name>
XKicks the resident module out of the ResModules-List. It does not free the
Xmodule itself, but only makes sure it won't be reactivated during the next
Xreset. Removing a ROM-based module does not have any effect.
X
XRepeat <Command string>
XRepeats the command string at the current refresh rate (see 'Time').
XHowever, commands not producing any output won't be repeated, but only
Xexecuted once. Press <enter> to stop.
XExample: Time 1
X	 Repeat TimerIO
X
XTrapGuru
XActivates a trap handler similar to GOMF. It only works with a 68000
Xprocessor, as it relys on a specified stack frame (at least I think so,
Xcouldn't check it out). If an exception occurs (i.e. GURU) Xoper will
Xstop (or popup, if running in background) and display some information
Xabout what happened (the taskname causing the error, its program counter,
Xthe alert number etc.) and you'll be asked if you want to (K)ill the task
Xor (I)gnore the exception. Choosing (i)gnore will do nothing at all if the
Xerroneous program was a process (as it will stop itself displaying a
X'Task held...' requester), but force a task to execute a 'Wait(0L)' (i.e.
Xwait forever) as tasks do directly display an alert box.
X
XAlias <AliasName> <CommandName>
XDefines a new name to be used along with the original command name. The new
Xname should not contain any blanks.
XExample: Alias ih InputHandler
X
XSetFKey <key number> <string>
XAssign a string to a funktion key. 'Key number' is a value between 1-20,
X10-20 denotes shifted keys. Use '^' to simulate a <return> and '_' for
Xspace (the parser strips leading/trailing blanks).
XExample: SetFKey 1 Hunks^
X	 enter t <return>, press <escape>, move the cursor to a process,
X	 press F1
X
XLockdrive <drivename:>
XPrevent DOS, Workbench and Disk-Validator from cluttering on the drive.
XThis command isn't very useful, but I needed it myself. Please note that
Xthe drivename is case sensitive and has to end with a ':'.
X
XFreedrive <drivename:>
XRe-enable a drive.
X
XDiskChange
XShow all installed diskchange interrupts. It displays the node, data and
Xcode fields of the interrupt, the device it is attached to (df0:-df3:) and
Xthe task which added the interrupt (if available). The main purpose for
Xthis command is to check for a virus, as the diskchange interrupt is a
Xwonderful place to install them.
X
XWindows
XList address and title of all windows.
X
XScreens
XList address and title of screens.
X
XFonts
XList address,height,width,type,fist character and last character of all
Xloaded fonts.
X
XWindowfonts
XList Windows and associated fonts.
X
XSetFont [size] <fontname> <window>
XChange the default font of a window. To avoid confusion, you should use a
Xfont with the same font size as the original font, as many programs rely on
Xthe point size.
XExample: Windows
X	 Press <esc>, move the cursor to the Xoper window line and type
X	 Setfont diamond.font
X	 (now you know what I mean by 'relying on a font size' :-))
X
XFreeze [processnumber] <taskname>
XHalt a Task. The task should be READY or WAITING. Frozen tasks are queued in
Xa new list called FROZEN. When you leave Xoper, halted Task will be
Xreleased.
XExample: Freeze Killer Graphics Task
X
XWarm [processnum] <taskname>
XRestart a halted Task. Task must be FROZEN.
XExample: Warm Killer Graphics Task
X
XHide <taskname>
XThe task-list tend to be longer than the window size. You may inhibit the
Xoutput of some tasks you are not interested in using his command.
XExample: Hide trackdisk.device
X
XHidden
XTurn those hidden Tasks back on. It is actually a toggle.
X
XHeader
XToggle the (rather long) header on the task display on/off.
X
XSort
XThe tasks listing is sorted (on V1.3 and above) to avoid 'jumping' of the
Xdisplay. Sort toggles this feature on/off. (Stupid command, but was easy
Xto implement).
X
XCLICmd
XToggles between showing the loaded command and the taskname of CLI processes
Xin the tasks listing.
X
XInfo <librarynode | devicenode>
XShow additional information stored in the lib_IdString field.
XExample: Info arp.library
X
XOpenlib <libraryname>
XOpen a library. This is useful if you don't want a specified library being
X'flushed' out.
XExample: Openlib arp.library
X
XClear [longword]
XFill unused memory chunks with pattern, default is 0. Handy for debuggers.
XExample: Clear $66726565
X
XFlush
XClean up memory, flush unused libraries, devices and fonts.
X
XLastalert
XShow last Guru Meditation code or rubbish.
X
XUsage
XToggle CPUSE field on the task display between usage relative to all
Xpossible dispatches and usage relative to actually dispatched tasks.
XAhem...not very clear I think. Well, let me try again...
XIf you add all CPUSE fields together you get 100 % (more or less 1%). After
Xentering "Usage" adding the fields together will give you the same value as
Xshown in the 'CPU Activity field'. (I HATE having to write docs)
X
XTaskports
XDisable / enable a listing of taskports if ports are displayed.
X
XWindow <leftedge> [toptedge [width [height]]]
XWorks only on script files. Defines the window to be opened.
XExample: Window 0 0 550 190
X
XHistoryLines <number of lines>
XSet the maximum number of input lines the history buffer should hold.
XDefault is 10 lines.
X
XMinimumChars <number of characters>
XSet the minimum number of characters an inputline should have to be added to
Xthe history buffer.
XDefault is 2 characters.
X
XShowHistory
XShow the history buffer. (quite useless, I know)
X
XKillHistory
XDelete all lines from the history buffer. (still useless)
X
XOutputLines <number of lines>
XSet the maximum number of lines the output buffer may hold. If the buffer
Xoverflows, a line from the top of the buffer will be deleted for each new
Xline.
XThe default value is 500, using a maximum of 500 * 104 = 52000 bytes.
X
XSaveOutput <filename>
XWrite the contents of the output buffer to a file.
X
XIconifyOff
XTurns the iconifying routine off, freeing all memory associated with its
Xcode and image.
X
XBackDropIcon
XPuts the Xoper icon behind all other windows, instead of creating it on top
Xof them.
X
XUseScreen
XOpens Xoper on a screen. The new screen will take its data (width, colors,
Xviewmodes etc.) from the Workbench screen and open a borderless backdrop
Xwindow on it.
X
XUseWindow
XOpens Xoper on a window.
X
XQuit or just Q
XExit Xoper. If Xoper was started with '-b' or if 'Hold' was specified it
Xwill stay in background waiting for LeftAmiga-RightAmiga-X.
X
XHold
XExit Xoper but install a key-handler and stay in background. Window
Xsettings and display commands are saved.
X
XExit
XClean up and quit.
X
X!!!! WARNING: The next few commands are dangerous and 'dirty' !!!!!
X!!!!!!!!!!!! don't use them if not strictly necessary !!!!!!!!!!!!!
X
XKill [processnumber] <taskname>
XKill a task or a process. If the task has been called from CLI, the Task
Xitself and the CLI will be killed. Hunks, Windows, Screens  and the
Xteminal-window will be freed. Simple tasks are just RemTask()'ed. If it is
Xnot a CLI Task you'll be asked if it is a Workbench task, if the answer is
X'Yes' unloading will be done by the Workbench. If not, you will be prompted
Xif Xoper should unload the code. Enter 'No' if you don't know how the task
Xhas been started. A good example for tasks that should NEVER be unloaded are
Xprogram started by ARP'S ASyncRun (or ARun).
X
XClosewindow <title>
XCloses a Window. Please, use it only if the corresponding Task has been
X'Cancel'ed. Use the Window-Structure address if the window has no name.
X
XClosescreen <title>
Xsame as above, but for screens.
X
XUnlock <lock (BPTR)>
XUnlock a file.
X
XCloselib <libraryname>
XThis is exactly the same as CloseLibrary().
X
XCD [processnumber] <processname>
XChange the current directory of a process. You are prompted if the old
Xdirectory lock should be unlocked.
X
XSignal <mask> [processnumber] <taskname>
XSet any task-signal. Mask is a hexadecimal value with or w/o leading '$'.
XSee task's SIGWAIT field for sensible values. Tasks normally do not wait for
Xsignals only, but for messages, that's why this command may not have the
Xdesired effect, but it is quite useful for tasks hanging around and waiting
Xfor events that may never happen. Warning: Using Signal without any
Xknowledge about what you are going to signal may cause a system-crash!
XExample: Signal 10000000 PopCLI III
X
X----------------------------------------------------------------------------
X;Sample Startup Script (to be placed in s:Xoper.Startup)
X;
X; Window definition on a overscanned + PAL Workbench screen
XWindow 122 0 550 230
X;
X;don't display some Tasks
X;
XHide CON
XHide trackdisk.device
X;
X;but turn them on on Startup
X;
XHidden
X;
X;Change the default list to Ports
X;
XP
X----------------------------------------------------------------------------
XPlease send flames, bug reports and especially a list of features you would
Xlike to have included in the next version to
X
X Werner Gunther
X Wingertspfad 12
X D 6900 Heidelberg
X (Germany)
X
Xor to my EMAIL address for a fast response:
X
X G35@DHDURZ1.BITNET
END_OF_FILE
if test 20785 -ne `wc -c <'Xoper.doc'`; then
    echo shar: \"'Xoper.doc'\" unpacked with wrong size!
fi
# end of 'Xoper.doc'
fi
if test -f 'Xoper.startup' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Xoper.startup'\"
else
echo shar: Extracting \"'Xoper.startup'\" \(100 characters\)
sed "s/^X//" >'Xoper.startup' <<'END_OF_FILE'
X;silly Xoper Demo
Xtime 1.5
Xusescreen
Xt m e p l f r i s d c ?
Xalias ih inputhandler
Xsetfkey 3 exit^
X
END_OF_FILE
if test 100 -ne `wc -c <'Xoper.startup'`; then
    echo shar: \"'Xoper.startup'\" unpacked with wrong size!
fi
# end of 'Xoper.startup'
fi
echo shar: End of archive 1 \(of 4\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 4 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
	amiga@cs.odu.edu	
or	amiga@xanth.cs.odu.edu	( obsolescent mailers may need this address )
or	...!uunet!xanth!amiga	( very obsolescent mailers need this address )

Comments, questions, and suggestions s should be addressed to ``amiga-request''
(only use ``amiga'' for submissions) at the above addresses.