home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / mach / doc / netmemory / bcopy2.c.Z / bcopy2.c
Encoding:
C/C++ Source or Header  |  1992-09-02  |  1.1 KB  |  59 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * All rights reserved.  The CMU software License Agreement specifies
  5.  * the terms and conditions for use and redistribution.
  6.  */
  7. /*
  8.  * HISTORY
  9.  * $Log$
  10.  */
  11. /*
  12.  *    File:    bcopy.c
  13.  *    Author:    Joseph S. Barrera III
  14.  *
  15.  *    Copyright (C) 1989, Joseph S. Barrera III
  16.  *
  17.  *    Test of byte-copying speed.
  18.  *
  19.  */
  20.  
  21. char src[102400];
  22. char dst[102400];
  23.  
  24. /*
  25.  *   Does 1000 copies of 100 KB each.
  26.  *   Divide running time in seconds by 100 to get msec/KB.
  27.  */
  28. main()
  29. {
  30.     register unsigned long *l1;
  31.     register unsigned long *l2;
  32.     register i, j;
  33.  
  34.     for (i = 0; i < 1000; i++) {
  35.     l1 = (unsigned long *) dst;
  36.     l2 = (unsigned long *) src;
  37.     for (j = 0; j < 1600; j++) {
  38.         l1[ 0] = l2[ 0];
  39.         l1[ 1] = l2[ 1];
  40.         l1[ 2] = l2[ 2];
  41.         l1[ 3] = l2[ 3];
  42.         l1[ 4] = l2[ 4];
  43.         l1[ 5] = l2[ 5];
  44.         l1[ 6] = l2[ 6];
  45.         l1[ 7] = l2[ 7];
  46.         l1[ 8] = l2[ 8];
  47.         l1[ 9] = l2[ 9];
  48.         l1[10] = l2[10];
  49.         l1[11] = l2[11];
  50.         l1[12] = l2[12];
  51.         l1[13] = l2[13];
  52.         l1[14] = l2[14];
  53.         l1[15] = l2[15];
  54.         l1 += 16;
  55.         l2 += 16;
  56.     }
  57.     }
  58. }
  59.