   Cache test (c) 1995 Graham C. Norris

   -*-

   This program is copyright. It is not public domain. You may freely use it but
   may not disassemble or modify it. By running the program you assume all
   responsibility for any adverse result arising. The program is not warranteed,
   guarenteed, or in any other way assured to produce the correct result. Use at
   your own risk.

   -*-

   This program is intended to determine how much memory cache is present in
   a system. It is also intended to determine whether the cache is write-back
   or write-through.

   Only cache sizes known (by me) to be used are tested. These are 1K, 8K, 16K,
   32K, 64K, 128K, 256K, 512K and 1M. The program will erroneously report that
   a machine which has no cache has 1M because all tested memory will be the
   same speed, and appear to be cached. A cache line size of 16 bytes is
   assumed.

   The reason this program was written was because of the discovery that at
   least one motherboard supplier has found a way of selling defective cache
   without it being noticable. The motherboard in question had what appeared to
   be 256K of 15-ns cache. Removing the "Removing this label will void the
   warranty" label showed that all the chips whose speed was visible were 15ns,
   but those which weren't were 20ns. Rip-off number one.

   When the cache was moved to another motherboard, it would not work. Half of
   it was found to be defective: it would not work on any motherboard, or in the
   first bank on the original motherboard. A different BIOS on the original
   motherboard showed 128K of cache: the original BIOS still reported 256K. Rip-
   off number two. Ripped-off twice in one purchase!

   Why write this for OS/2, not DOS? First, I am no archaeologist, second I need
   to work with up to 1M memory at a time. The program should be run from an
   OS/2 command line either after booting from a floppy, or Alt-F1,C under Warp.
   If any other threads are active the results will be wrong.

   -*-

   The program requires OS/2 2.0 or higher and is a non-PM application. It takes
   no parameters and generates about 55 lines of output. I suggest you use
   MODE CO80,60 before you run it. The output of the program may be piped to a
   file.

   On a fast system with at least 256K cache the test will take less than five
   minutes. If you disable the on-chip cache even a fast Pentium will take about
   an hour to complete the test. A 20MHz 486 with all cache disabled could take
   several hours. A DX2-80 takes about 3 minutes, a DX2-50 about 6, both with
   write-back level two caching.

   In case you don't know what level one or level two caches are, level one
   cache (L1) is the on-chip cache found in 486 and Pentium processors. Level
   two cache (L2) is the extra cache found on a motherboard. L1 is 8K on most
   486 processors and L2 is frequently 256K. Pentiums have a split 8K data and
   8K instruction cache; this program only measures the data cache. There are
   variations such as the 1K cache on Cyrix 486SLC processors and 16K on Intel
   486DX4 processors. 386's don't have on-board cache so any external cache is
   L1 cache and there is no L2.

   -*-

   If you have any constructive comments I would like to hear them, especially
   if the test gives you a result you regard as incorrect. I reserve the right
   to ignore you however.

   -*-

   Graham C. Norris. norrisg@ibm.net

   -*-

   All names are trademarks of their respective owners.

