home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
24b
/
kcount.zip
/
KCOUNT.DOC
< prev
Wrap
Text File
|
1986-11-01
|
17KB
|
442 lines
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 1
KCOUNT Keywords
TSR KEYBOARD USAGE ACTIVITY CPU TIME MEASUREMENT MONITOR
KCOUNT Introduction
KCOUNT V1.10 is a small (4k) resident program that measures the
percentage of "active" PC usage by monitoring the keyboard
interrupt. It is offered free -- this is not shareware. It can
write monitor reports to a file, and can be used in a CED SYN or
.BAT file to automate statistics collection. Source avail. on
request. 1k bytes stay resident. Self-removable. Online help.
(C)Graeme W. McRae 1986 [73307,2453]
The motivation for writing this program was the desire to
determine whether or not a PC is being used, and at what
level of activity. Various schemes were suggested to measure the
"CPU activity" of the 8088. The trouble with these schemes is
that many programs loop continously when they are idle. This
would be reflected as 100% CPU activity, when in fact no work is
being done. It is not possible to objectively identify such
"idle looping", so these CPU activity schemes are not effective.
Another way to determine whether the PC is being used would be to
monitor an interrupt or interrupts that are used only when the PC
is being used. The keyboard interrupt was an obvious choice,
since a person must be actually hitting the keys to drive that
interrupt. A mere count of keystrokes, however, is not a good
measure of the level of usage of the PC, because of differences
in typing speed and application design. Simply browsing a file,
for example, is a fine use of the PC that generates very few
keystrokes. To correct this shortcoming, KCOUNT measures the
percentage of *minutes* in which there was one or more
keystrokes. Using this scheme, the power-typist and the browser
should come out even in measured usage.
Care should be taken when using the results of KCOUNT's
measurement. KCOUNT does not measure a person's performance nor
the overall usefullness of the computer. It only measures
"active" use of the computer. Passive uses, such as long-running
compiles, printing, or communications are not measured by KCOUNT.
KCOUNT Compatibility
KCOUNT is compatible with most drivers and TSRs. If you use
SideKick, you should initialize KCOUNT first, then SideKick.
Although KCOUNT offers the /E switch to de-install itself,
this is not possible unless KCOUNT was the last TSR loaded.
Thus the /E switch can not be used if you are running SideKick
due to the way SideKick re-installs itself.
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 2
KCOUNT Usage
To begin measurement, KCOUNT must be initialized using the /I
option. Thereafter, activity reports may be generated by using
the KCOUNT command with no options. The reports may be written
to a file using the redirection character (">") on the command
line. See "Collecting Statistics", below for more information
about using files.
The /I option may be used to override the interrupt number used
by KCOUNT. If the interrupt number is overridden at
initialization, it must also be overridden each time a report is
desired.
The /R option will display the current report, then reset the
statistics, in effect re-initializing KCOUNT.
The /P option may be used to override the default length of each
measurement period. The default is 60 seconds. Any value from
10 to 3600 seconds may be used.
The /B option may be used for Brief output. /Bxxxxxxxx attaches
a name (I call it the B-Name) to the output. See "Collecting
Statistics", below, for more information on using the B-Name.
Any of the above options may be combined in one command. The
order of the options is not significant. See the examples, below.
The /E option prints the final report, then shuts down KCOUNT,
returning the storage formerly occupied by KCOUNT to DOS.
It may be combined with /B.
The /H option will give a brief summary of command line syntax.
KCOUNT Usage Examples
KCOUNT /I -- Initialize KCOUNT
KCOUNT /I104 -- Initialize KCOUNT using interrupt 104 (decimal)
KCOUNT /R -- Reset statistics back to zero
KCOUNT /I104/R -- Reset statistics, using interrupt 104 (decimal)
KCOUNT /R/BAutoSig -- Reset statistics, assign name to reports
KCOUNT /P300 -- Initialize or reset the period length (seconds)
KCOUNT -- Print the current activity report
KCOUNT /B>>KSTATS.DAT -- Append the report to a file, brief mode
KCOUNT /I104/B/E -- Print brief report using interrupt 103, then
end collection for that interrupt.
KCOUNT /H -- Get help
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 3
KCOUNT Collecting Statistics
Monitor reports can be directed to a file using the UNIX/DOS
redirection symbols ">" (write) and ">>" (append). Later, these
reports can be printed or processed by a program of your
devising. The "Brief" mode facilitates this processing by writing
exactly one line in a set format each time statistics are
requested. The "Title" parameter can be used to provide a title
line as the first line of the file, if you wish.
If you are merging output collected from different computers or
while running different applications, this name can be used to
give more meaning to the data. Normally, the B-Name supplied by
/Bxxxxxxxx is used for the current report only. But if /Bxxxxxxxx
is combined with /I or /R, the B-Name becomes permanent, and will
be used for all subsequent reports. REMEMBER: If you use /R
and /Bxxxxxxxx, the report will be issued using the *old* B-name,
then the B-name (and other statistics) will be reset.
If you wish to compare the active use of two different programs,
prog1 and prog2, you may wish to attach a B-Name to the
statistics that are gathered while these programs are running.
Later, SORT can be used to organize the statistics by program
name. Here is one scenario that will gather statistics using
Brief mode:
In AUTOEXEC.BAT
------------
KCOUNT /I/T>>b:\kstats.dat Write just the title line
In the BAT file for PROG1
-------------------------
KCOUNT /R/Bprog1>b:\kstats.dat Flush residual statistics
prog1
KCOUNT /R/B>>b:\kstats.dat Write PROG1's statistics
(The BAT file for PROG2 would be similar.)
Generalized KCOUNT reset CED SYN
--------------------------------
syn k kcount/R/B%1>>b:\kstats.dat
syn ed ^k Edlin^a:edlin %1^k
Here, the "ed" syn invokes EDLIN, and keeps track of
keystrokes during the EDLIN session.
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 4
KCOUNT Adjustable Interrupt Number
The interrupt (102 decimal, by default) is used both as a pointer
to the data area used by the resident portion and as the
programming interface to KCOUNT (See "Programming Interface"
below). If another program is using this interrupt, KCOUNT will not
attempt to initialize itself. In this case, you can tell KCOUNT
to use a different interrupt number with the /Innn option, where
nnn is the (decimal) interrupt number. See "Changing the Default
Interrupt Number", below for more information.
Multiple copies of KCOUNT can be run simultaneously using
different interrupt numbers. That way, monitoring can be done
using two different recording periods at once. Here's an
example:
KCOUNT /I103 -- Initialize KCOUNT using the default period.
KCOUNT /I104/P300 -- Initialize a new copy of KCOUNT with a
period of five minutes (300 seconds).
KCOUNT /I103 -- Display the report of 60-second periods.
KCOUNT /I104 -- Display the report of five-minute periods.
If you later use the /E switch to end KCOUNT, be sure to end in
the reverse order that you initialized them. Also, be sure to
read "KCOUNT Compatibility", above. To continue this example,
you should issue end in this order:
KCOUNT /I104/E
KCOUNT /I103/E
KCOUNT Report, normal mode
Application or computer name: bname.
KCOUNT (V1.10) status at: YY/MM/DD HH:MM:SS.
KCOUNT has been running since YY/MM/DD HH:MM:SS.
Keystrokes so far: nnnnn.
Number of seconds per period: nnnnn.
Periods in which PC was used: nnnnn.
Total number of time periods: nnnnn.
Usage quotient: nnn%
If a B-Name was set at initialization or reset, this
name is printed, for your information.
The current date and time and the date and time of
initialization are printed first, followed by the number of
keystrokes since initialization. A "keystroke" is
considered to be a press of any key (including shift keys
and "dead" keys) or a typamatic repeat of any key. If the
period was changed from the default of 60 seconds, the
number of seconds per period is printed. Then, the number
of periods in which there was one or more keystrokes is
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 5
printed, followed by the total number of periods. The ratio
of these last two numbers is the "Usage Quotient".
The following rules pertain to the period of time that
elapses between keystrokes. If the user sets the clock
back, or if the "BIOS tick count" is adjusted backwards (See
the explanation under "Warning: BIOS tick count was
adjusted", below) then the period of negative length is
ignored, and doesn't figure into the "Usage Quotient". Any
period that spans midnight is ignored, because it is not
possible to distinguish this case from setting the clock
back. (The date is not available to the resident portion.
It is printed for information purposes only)
KCOUNT Report, Brief mode
B-Name Last keystroke Initialization Keystrokes Per. Used Total Percent
bname date/time date/time nnnnnnnn nnn nnnnn nnnnn nnn
Shown here is the title line, followed by the general form of the
Brief-mode report. It is scrunched a bit here, to fit into the
format of this text file, but in reality, the lines are almost 80
characters long. The same statistics are printed, in the same
order, as the normal-mode report. But they are printed on one
line. This mode is designed primarily to simplify collection and
processing of statistics.
KCOUNT Messages
Error: interrupt nnn is already in use. Use /Innn option.
The interrupt is used by some software other than KCOUNT,
possibly a different version of KCOUNT or another TSR. Use
the /Innn option, specifying an available interrupt.
KCOUNT is now installed.
This message should be received after initialization of
KCOUNT, and at no other time.
Warning: BIOS tick count was adjusted from HH:MM:SS.hh to HH:MM:SS.hh
This is an informational message, which can be safely
ignored. Some PCs have clocks that are independent of the
BIOS tick count, which is stored at location 46C through
46F. Typically, the DOS that runs on these PCs ignore the
BIOS tick count, leaving an incorrect value there. KCOUNT
must rely on this value, however, because it isn't permitted
to use the DOS "time" service. So during initialization,
KCOUNT corrects this tick count if necessary, and issues
this message. This correction is also done whenever a
monitor report is requested.
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 6
/Pnnnn value must be 10 to 3600.
The number of seconds per period must be in this range.
/Innn value must be 1 to 255.
The interrupt number must be in this range, although it is
highly recommended that you either take the default or
choose a number from 96 through 111. All numbers are
decimal.
Counter overflow: Reset using KCOUNT /R.
The running count of recording periods can reach at most
65535. This happens after 7 days using the shortest
recording period (10 seconds), or after 6 weeks using the
default recording period (60 seconds). If this does happen,
issue the command KCOUNT /R to reset the counters.
Bad parm syntax.
For help, use KCOUNT /H
Probably you forgot the slash, or made some other typing
error.
KCOUNT 1.10 (C)Copyright Graeme W. McRae 1986
For help, use KCOUNT /H
If KCOUNT was never installed, and you enter the KCOUNT command
with no operands, this message appears. Or it appears when
you try to use parameters that would be valid if KCOUNT were
initialized.
Checksum error. Get a new copy of KCOUNT.
There was a bad download or copy of KCOUNT. Try downloading
it again, or obtain a new copy from the author.
KCOUNT ended.
The /E parameter was specified, so the resident portion of
KCOUNT was freed, and the interrupt vector hooks were removed.
Error: memory not released.
The /E parameter was specified, and the interrupt vector hooks
were probably removed, but the memory blocks owned by the
resident portion of KCOUNT were corrupted, and thus not freed.
Error: /E not possible.
The /E parameter was specified, but the interrupt vector table
was modified after KCOUNT was installed, so the information
KCOUNT needs to end is not available.
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 7
KCOUNT Programming Interface
Programs may access the KCOUNT numbers directly, by invoking the
KCOUNT interrupt. Seven functions are available. The function
number must be stored in the AH register prior to invoking the
interrupt. The values returned are accurate up to the most
recent keystroke.
Function 1: Return the total number of keystrokes in DX:AX
Function 2: Return the total periods and used periods. The
number of total periods is returned in DX, and the number of
used periods is returned in AX.
Function 3: Return the time KCOUNT was initialized. The
time is returned in DH:DL:AH:AL as hours, minutes, seconds,
and hundredths of seconds.
Function 4: Return the number of seconds per period in AX.
Function 5: Re-initialize KCOUNT. The time of
initialization is reset to the time the last keystroke
occurred.
Function 6: Returns a segmented pointer in DS:SI to the name
specified by the last permanent /Bxxxxxxxx parameter. The
format is a one-byte length followed by an 8-character
blank-padded ASCIIZ string. The choice of DS:SI made KCOUNT
programming easier, sorry.
Function 7: Returns the date KCOUNT was initialized, in
the same format as DOS function 2Ah. CX=Year, DH=Month,
DL=Day of month, and AL=Day of week.
KCOUNT Changing the Default Interrupt Number
The default interrupt number used by KCOUNT is 66h (102 decimal).
If this interrupt number interferes with one of your existing
TSRs, you can change it permanently. When you do this, the /Help
message will automatically change as well. It is recommended that
you choose an available interrupt in the range 60h through 6Fh.
Here's how you would change it to 6Eh:
A>debug kcount.com
-e 103 6E
-g
Checksum error. Get a new copy of KCOUNT.
Program terminated normally.
-w
Writing 0FEE bytes
-q
A>
KCOUNT V1.10 (C)Copyright Graeme W. McRae, November 1, 1986 Page 8
Similarly, to change the default measurement interval from 60
seconds to some other number, the "e" command becomes "e 104 xx
yy" where xx is the least significant byte and yy is the most
significant byte of the default measurement interval in hex.
Note that you must G>o (run the program) under debug after making
a change before writing the changed version back to disk.
Running the program automatically re-calculates the checksum.
So even though the error message was issued, W>riting fixes it.
KCOUNT History of Revisions
86/10/08 V1.00 Initial release supported /I, /Innn, /P, /R, and /H.
86/10/20 V1.01 Added self-checksum support to guard against a
possible bad download or bad copy of the program. Total size
of KCOUNT.COM is under 3K.
86/10/31 V1.10 Added /B, /T, and /E. The date was added to the
display, but it is not used in calculations. The /R and /P
switches were changed to show the report *before* rather than
*after* the reset of statistics. Total size of KCOUNT.COM is
under 4K.
IBM is a registered trademark of International Business Machines
Corporation.
Sidekick is a trademark of Borland International, Inc.
MS-DOS is a trademark of Microsoft Corporation.
UNIX is a trademark of AT&T Bell Laboratories.
CED is Copyright 1985 by Christopher J. Dunford
If you have any questions about this program, feel free to send
me EMAIL on CompuServe. You may distribute KCOUNT, but you must
include this documentation, you may not sell it (you may charge
for materials, handling, and postage), and you may not distribute
a modified version of KCOUNT nor its documentation.
Graeme W. McRae [73307,2453].