home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume21 / cloops / part01 / tick.c < prev    next >
C/C++ Source or Header  |  1991-07-25  |  2KB  |  102 lines

  1. /*
  2.  * This file is part of the Livermore Loops transliteration into C.
  3.  * Copyright (C) 1991 by Martin Fouts
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 1, or (at your option)
  8.  * any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #include <stdio.h>
  21.  
  22. #include "types.h"
  23. #include "externs.h"
  24.  
  25. #define TEST(x) if ((DoTest & (1<<(x-1))) == (1<<(x-1)))
  26.  
  27. extern long int DoTest;
  28.  
  29.  
  30. Void test();
  31. Void valid();
  32. Void stats();
  33.  
  34. Float tick(logio, iter)
  35. Int logio, iter;
  36. {
  37.   Int k, neff;
  38.   Float tsec[16], stat[12], tickvalue;
  39.   Int map[47];
  40.  
  41.   ion= logio;
  42.   kr = iter;
  43.   n  = 0;
  44.   lp = 0;
  45.   k2 = 0;
  46.   k3 = 0;
  47.   j5 = 23456;
  48.   m  = 0;
  49.  
  50.   test((Int)0);
  51.   test((Int)1);
  52.   test((Int)2);
  53.   test((Int)3);
  54.   test((Int)4);
  55.   test((Int)5);
  56.   test((Int)6);
  57.   test((Int)7);
  58.   test((Int)8);
  59.   test((Int)9);
  60.   test((Int)10);
  61.   test((Int)11);
  62.   test((Int)12);
  63.   test((Int)13);
  64.   test((Int)14);
  65.   test((Int)15);
  66.   test((Int)16);
  67.   j5 = 0;
  68.   for (k = 0; k < 15; k++) {
  69.     tsec[k] = Time[k];
  70.   }
  71.  
  72.   valid( Time,map,&neff,  (Float)1.0e-6, tsec, (Float)1.0e+4, (Int)15);
  73.   stats( stat, Time, neff);
  74.   tickvalue = stat[0];
  75.   for (k = 0; k < 47; k++) {
  76.     Time[k] = 0.0;
  77.     csum[k] = 0.0;
  78.   }
  79.   if (logio < 0) return(tickvalue);
  80.  
  81. #ifdef STATS
  82.   fprintf(stdout," clock overhead:\n");
  83.   fprintf(stdout,"              Average        Standev        ");
  84.   fprintf(stdout,"Minimum        Maximum\n");
  85.   fprintf(stdout," tick ");
  86.   for (k = 0; k < 4; k++)
  87.     fprintf(stdout,"%15.6f", stat[k]);
  88.   fprintf(stdout,"\n");
  89.   stats( stat,u,nt1);
  90.   fprintf(stdout," data ");
  91.   for (k = 0; k < 4; k++)
  92.     fprintf(stdout,"%15.6f", stat[k]);
  93.   fprintf(stdout,"\n");
  94.   stats( stat,&p[0][0],nt2);
  95.   fprintf(stdout," data ");
  96.   for (k = 0; k < 4; k++)
  97.     fprintf(stdout,"%15.6f", stat[k]);
  98.   fprintf(stdout,"\n");
  99. #endif
  100.   return(tickvalue);
  101. }
  102.