home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / cachc105.zip / CACHECHK.INS < prev   
Text File  |  1995-06-29  |  6KB  |  118 lines

  1.    Cache test (c) 1995 Graham C. Norris
  2.  
  3.    -*-
  4.  
  5.    This program is copyright. It is not public domain. You may freely use it but
  6.    may not disassemble or modify it. By running the program you assume all
  7.    responsibility for any adverse result arising. The program is not warranteed,
  8.    guarenteed, or in any other way assured to produce the correct result. Use at
  9.    your own risk.
  10.  
  11.    -*-
  12.  
  13.    This program is intended to determine how much memory cache is present in
  14.    a system. It is also intended to determine whether the cache is write-back
  15.    or write-through.
  16.  
  17.    Only cache sizes known (by me) to be used are tested. These are 1K, 8K, 16K,
  18.    32K, 64K, 128K, 256K, 512K and 1M. A cache line size of 16 bytes is assumed.
  19.  
  20.    The reason this program was written was because of the discovery that at
  21.    least one motherboard supplier has found a way of selling defective cache
  22.    without it being noticable. The motherboard in question had what appeared to
  23.    be 256K of 15-ns cache. Removing the "Removing this label will void the
  24.    warranty" label showed that all the chips whose speed was visible were 15ns,
  25.    but those which weren't were 20ns. Rip-off number one.
  26.  
  27.    When the cache was moved to another motherboard, it would not work. Half of
  28.    it was found to be defective: it would not work on any motherboard, or in the
  29.    first bank on the original motherboard. A different BIOS on the original
  30.    motherboard showed 128K of cache: the original BIOS still reported 256K. Rip-
  31.    off number two. Ripped-off twice in one purchase!
  32.  
  33.    Why write this for OS/2, not DOS? First, I am no archaeologist, second I need
  34.    to work with up to 1M memory at a time. The program should be run from an
  35.    OS/2 command line either after booting from a floppy, or Alt-F1,C under Warp.
  36.    If any other threads are active the results will be wrong.
  37.  
  38.    -*-
  39.  
  40.    The program requires OS/2 2.0 or higher and is a non-PM application. It takes
  41.    no parameters and generates about 40 lines of output. The results of the 
  42.    program may be piped to a file.
  43.  
  44.    On a fast system with at least 256K cache the test will take less than five
  45.    minutes. If you disable all the cache even a fast Pentium will take about
  46.    15 minutes to complete the test. A 20MHz 486 with all cache disabled could 
  47.    take an hour. A DX2-80 takes about 2.5 minutes, a DX2-50 about 5, both with
  48.    write-back level two caching.
  49.  
  50.    In case you don't know what level one or level two caches are, level one
  51.    cache (L1) is the on-chip cache found in 486 and Pentium processors. Level
  52.    two cache (L2) is the extra cache found on a motherboard. L1 is 8K on most
  53.    486 processors and L2 is frequently 256K. Pentiums have a split 8K data and
  54.    8K instruction cache; this program only measures the data cache. There are
  55.    variations such as the 1K cache on Cyrix 486SLC processors and 16K on Intel
  56.    486DX4 processors. 386's (other than IBM's 386SLC's which have 16K) don't 
  57.    have on-board cache so any external cache is L1 cache and there is no L2.
  58.  
  59.    -*-
  60.    
  61.    If the program reports L3 cache then you either have an unusual system, or
  62.    other threads are interfering with the results. The program will run in an
  63.    OS/2 window, but will not give reliable results: it can usually tell if the
  64.    cache is write-back or write-through even under these conditions.
  65.  
  66.    Normally the program cannot determine whether write-back caching is provided
  67.    by L1 or L2 cache (or both). If you think (or know) you have write-back L1
  68.    cache (for example an Intel DX4-100), you can tell if you also have L2 write
  69.    back caching by using your BIOS settings to set the L1 (or internal) cache to
  70.    write-through. If the program still reports write-back caching you either
  71.    have write-back L2 cache or a defective BIOS which did not disable L1.
  72.  
  73.    Talking of defective BIOSes, some allow L1 (internal) cache to be disabled
  74.    with L2 (external) enabled. This may result in both being disabled despite
  75.    what the BIOS claims. Compare the results of the program with all cache
  76.    disabled and with L1 disabled with L2 enabled to check this.
  77.  
  78.    -*-
  79.  
  80.    1.01 - changed tests to improve analysis on fast CPUs
  81.    1.02 - new test strategy to improve analysis on all CPU types and to
  82.       reduce test run times (complete tests on DX2-66 with all cache
  83.       disabled now take less than 25 minutes). Results are displayed
  84.       after tests are complete instead of between tests to reduce
  85.       interference with tests. Piped standard output will now include just 
  86.       heading and results, progress messages still go to the screen
  87.    1.03 - minor changes to tests with new algorithm for determining whether
  88.       cache is write through or write back. Added a beep when it's done
  89.    1.04 - changed to improve on defective compiler optimisations (it uses
  90.       registers for the outer loop control variables of nested loops rather 
  91.       than the control variables of the inner loops, which isn't what I call 
  92.       optimisation). Added builtin switch to 43/50 lines and colour.
  93.    1.05 - changed to minimise impact of external threads. You've heard much of
  94.       pre-emptive and co-operative multitasking. Well, this adds a new
  95.       flavour, un-co-operative multitasking. If you try to run this
  96.       alongside anything else you'll get to see how well a few lines of
  97.       code can take over your machine. Don't try to run any type of
  98.       communication program or anything important alongside it. Comms.
  99.       programs will drop data, others may timeout. Try running it in
  100.       an OS/2 window with the analog OS/2 clock or Pulse next to it.
  101.       The results will still usually be incorrect if run from under the
  102.       WPS.
  103.  
  104.    -*-
  105.  
  106.    If you have any constructive comments I would like to hear them, especially
  107.    if the test gives you a result you regard as incorrect. I reserve the right
  108.    to ignore you however.
  109.  
  110.    -*-
  111.  
  112.    Graham C. Norris. norrisg@ibm.net
  113.  
  114.    -*-
  115.  
  116.    All names are trademarks of their respective owners.
  117.  
  118.