Esempio n. 1
0
File: lms.c Progetto: ks07/beebs
int main()
{
    int n;

    initialise_board();
    start_trigger();

    for(n = 0; n < SCALE_FACTOR; ++n)
    {
        benchmark();
    }
    stop_trigger();
    return 0;
}
Esempio n. 2
0
int
main (void)
{
  int i;

  initialise_trigger ();
  start_trigger ();

  for (i = 0; i < SCALE_FACTOR; i++)
    benchmark ();

  stop_trigger ();
  return 0;
}
Esempio n. 3
0
int
main (void)
{
  int i;

  initialise_board ();
  start_trigger ();

  for (i = 0; i < REPEAT_FACTOR; i++)
    benchmark ();

  stop_trigger ();
  return 0;
}
Esempio n. 4
0
/*
 * Behave depending on current operation mode, the main part of FSM.
 */
static __inline void __noprof do_profile(void *this_fn, void *call_site, u8 type)
{
check_mode:
	switch (mode) {
		/* doing something uninterruptible;
		 * kindly apologise and return immediately */
		case PROFILER_BUSY:
			return;

		/* during bootup we only count calls */
		case PROFILER_BOOTUP:
			if (mach_state == MACH_RUNNING) {
				npkprintf("\nFunction calls during early bootup: %d\n", bootup_fn);
				mode = PROFILER_STOPPED;
				goto check_mode;
			} else
				bootup_fn += type == PROF_ENTRY;
			break;

		/* in a stopped state, check if we have corresponding
		 * start trigger */
		case PROFILER_STOPPED:
			if (start_trigger(this_fn, type)) {
				mode = PROFILER_RUNNING;
				goto check_mode;
			}
			break;

		/* the event log is full, yet we have an function call
		 * to log, thus no break here */
		case PROFILER_NEEDFLUSH:
			flush_events();

		/* in a running state the only thing we care about is
		 * a stop trigger, but we log_event() first */
		case PROFILER_RUNNING:
			log_event(this_fn, call_site, type);

			/* log_event() might have changed the mode */
			if (mode == PROFILER_NEEDFLUSH)
				flush_events();

			if (stop_trigger(this_fn, type))
				mode = PROFILER_STOPPED;
			break;
		
		default:
			break;
	}
}
Esempio n. 5
0
int main()
{
   int i;
   long int n;
   /* We can only do a check with 1 or 4096 transformations. */
   short int check_block_1 [64] =
     { 699, 164, -51,- 16,  31, -15, -19,   8,
        71,  14, -61,  -2,  11, -12,   7,  12,
       -58, -55,  13,  28, -20,  -7,  14, -18,
        29,  22,   3,   3, -11,   7,  11, -22,
        -1, -28, -27,  10,   0,  -7,  11,   6,
         7,   6,  21,  21, -10,  -8,   2, -14,
         1,  -7, -15, -15, -10,  15,  16, -10,
         0,  -1,   0,  15,   4, -13,  -5,   4 };
   short int check_block_4096 [64] =
     { -2480,  -665,  -689,   44,   -350,    26,  -272,  -535,
        -628, -2044,  -544,   141,   300,  -147,    -1,    89,
        -676,  -551, -1820,   224,   267,  -154,  -281,  -290,
          52,   149,   262, -1508,  -228,  -102,    58,   100,
        -425,   342,   148,  -185, -2485,   802,   227,  -750,
          34,   -62,  -225,   -84,   829, -1495,  -172,   319,
        -171,   -14,  -367,    67,   323,  -127, -1400,    28,
        -546,    38,  -355,   159,  -750,   316,    -4, -1849 };
   short int *check_block;
   int to_return;

   initialise_board ();
   start_trigger();

   for(n = 0; n < SCALE_FACTOR; ++n)
      fdct (block, 8);  /* 8x8 Blocks, DC precision value = 0,
			   Quantization coefficient (mquant) = 64 */
   stop_trigger();

   /* Verify if we can */
   to_return = 0;
   check_block = (1 == SCALE_FACTOR) ? check_block_1
     : (4096 == SCALE_FACTOR) ? check_block_4096 : NULL;

   if (NULL != check_block)
     for (i = 0; i < 64; i++)
       if (block[i] != check_block[i])
	 {
	   to_return = -1;
	   break;
	 }

   return to_return;
}
Esempio n. 6
0
int main() {
   int i,j,n;

   int output[NUM_NODES * NUM_NODES];
   int output_count = 0;

   int check_output[NUM_NODES * NUM_NODES] = {
      0,  7, 38, 23, 14, 36,  3, 29,  7, 14,
      28,  0, 31, 16,  7, 34, 31, 28,  1, 39,
      39, 25,  0, 32, 14,  3, 32,  9, 26, 43,
      12, 14, 40,  0, 21, 43, 15, 12, 15, 26,
      40, 36, 48, 28,  0, 27, 43, 33, 12, 39,
      36, 22, 21, 29, 29,  0, 29,  6, 23, 40,
      8,  4, 35, 20, 11, 33,  0, 26,  5, 11,
      30, 16, 47, 32, 23, 35, 23,  0, 17, 34,
      28, 24, 55, 16,  8, 35, 31, 28,  0, 38,
      23, 19, 41, 16,  8, 35, 15, 28,  0,  0};

   initialise_trigger();
   start_trigger();

   /* finds 10 shortest paths between nodes */
   for(n = 0; n < REPEAT_FACTOR >> 9; ++n) {
      output_count = 0;
      for(j = 0; j < NUM_NODES; j++) {
         for (i=0; i < NUM_NODES; i++) {
            output[output_count] = dijkstra(i,j);
            output_count++;
         }
      }
   }

   stop_trigger();

   int to_return = 0;
   for (i = 0; i < output_count; i++) {
      if (output[i] != check_output[i]) {
         to_return = -1;
         break;
      }
   }

   return to_return;
}
Esempio n. 7
0
File: bf.c Progetto: T-J-Teru/beebs
int main(int argc, char *argv[])
{
   unsigned char ukey[8];

   unsigned char indata[40],outdata[40],ivec[8] = {0};
   unsigned char check_outdata[40] = {
      -11, 25, 13, -69, -45, -32, 31, 46,
      -77, -34, 57, -26, 1, -125, -65, 119,
      67, -82, -23, -42, -47, 51, 15, 71,
      83, 30, 89, -58, 33, 67, -97, 87,
      -61, -114, -87, -42, -111, -45, 15, 71
   };

   int num;
   int by=0,i=0;
   int encordec=-1;
   char *cp,ch;
   int n, n2;

   initialise_board();
   start_trigger();

   for(n = 0; n < SCALE_FACTOR; ++n)
   {
      encordec = 1;
      num=0;

      /* Read the key */
      cp = ckey;
      while(i < 64 && *cp)    /* the maximum key length is 32 bytes and   */
      {                       /* hence at most 64 hexadecimal digits      */
         ch = *cp++;            /* process a hexadecimal digit  */
         if(ch >= '0' && ch <= '9')
            by = (by << 4) + ch - '0';
         else if(ch >= 'A' && ch <= 'F')
            by = (by << 4) + ch - 'A' + 10;
         else                            /* error if not hexadecimal     */
         {
            // printf("key must be in hexadecimal notation\n");
            exit(-1);
         }

         /* store a key byte for each pair of hexadecimal digits         */
         if(i++ & 1)
            ukey[i / 2 - 1] = by & 0xff;
      }

      BF_set_key(&key,8,ukey);

      if(*cp)
      {
         //printf("Bad key value.\n");
         exit(-1);
      }

      i=0;
      for(n2 = 0; n2 < 256; ++n2)
      {
         while(i<40)
            indata[i++]=rand();

         BF_cfb64_encrypt(indata,outdata,i,&key,ivec,&num,encordec);
         encordec = 1-encordec;
         BF_cfb64_encrypt(outdata,indata,i,&key,ivec,&num,encordec);

         i=0;
      }
   }

   stop_trigger();

   /* Verify that we have the correct result. */
   int to_return = 0;
   for (i = 0; i < 40; i++) {
      if (outdata[i] != check_outdata[i]) {
         to_return = -1;
         break;
      }
   }

   return to_return;
}
Esempio n. 8
0
int main(void)
{
   double  a1 = 1.0, b1 = -10.5, c1 = 32.0, d1 = -30.0;
   double  a2 = 1.0, b2 = -4.5, c2 = 17.0, d2 = -30.0;
   double  a3 = 1.0, b3 = -3.5, c3 = 22.0, d3 = -31.0;
   double  a4 = 1.0, b4 = -13.7, c4 = 1.0, d4 = -35.0;
   int     solutions;
   int i;
   long n = 0;

   double output[48] = {0};
   double *output_pos = &(output[0]);
   int output_count = 0;
   int check_output[48] = {-9, 0, -0, -9,
      0, -0, -9, 0,
      -0, -9, 0, -0,
      -8, 0, -0, -8,
      0, -0, -8, 0,
      -0, -8, 0, -0,
      -4, 0, -0, -4,
      0, -0, -4, 0,
      -0, -4, 0, -0,
      -3, 0, -0, -3,
      0, -1, -3, 0,
      -0, -3, 0, -1};

   initialise_board();
   start_trigger();

   for(n = 0; n < SCALE_FACTOR; ++n)
   {
      /* solve some cubic functions */
      /* should get 3 solutions: 2, 6 & 2.5   */
      SolveCubic(a1, b1, c1, d1, &solutions, output);
      /* should get 1 solution: 2.5           */
      SolveCubic(a2, b2, c2, d2, &solutions, output);
      SolveCubic(a3, b3, c3, d3, &solutions, output);
      SolveCubic(a4, b4, c4, d4, &solutions, output);
      /* Now solve some random equations */
      for(a1=1;a1<3;a1++) {
         for(b1=10;b1>8;b1--) {
            for(c1=5;c1<6;c1+=0.5) {
               for(d1=-1;d1>-3;d1--) {
                  SolveCubic(a1, b1, c1, d1, &solutions, output_pos);
                  output_pos += solutions;
                  output_count += solutions;
               }
            }
         }
      }
   }

   stop_trigger();

   /* Verify that we have the correct result. */
   int to_return = 0;
   for (i = 0; i < output_count; i++) {
      if ((int) output[i] != check_output[i]) {
         to_return = -1;
         break;
      }
   }

   return to_return;
}