示例#1
0
文件: count.c 项目: Camelek/qtmoko
void WMOPS_output (Word16 dtx_mode)
{
    Word16 i;
    Word32 tot, tot_wm, tot_wc;

    /* get operations since last reset (or init),
       but do not update the counters (except the glob_wc[] maximum)
       so output CAN be called in each frame without problems.
       The frame counter is NOT updated!
     */
    tot = WMOPS_frameStat();
    tot_wm = total_wmops[currCounter] + ((float) tot) * 0.00005;

    fprintf (stdout, "%10s:WMOPS=%.3f",
	     objectName[currCounter]?objectName[currCounter]:"",
	     ((float) tot) * 0.00005);

    if (nbframe[currCounter] != 0)
        fprintf (stdout, "  Average=%.3f",
                 tot_wm / (float) nbframe[currCounter]);
    
    fprintf (stdout, "  WorstCase=%.3f",
             ((float) glob_wc[currCounter]) * 0.00005);

    /* Worst worst case printed only when not in DTX mode */
    if (dtx_mode == 0)
    {
        tot_wc = 0L;
        for (i = 0; i < funcid[currCounter]; i++)
            tot_wc += wc[currCounter][i];
        fprintf (stdout, "  WorstWC=%.3f", ((float) tot_wc) * 0.00005);
    }
    fprintf (stdout, " (%d frames)\n", nbframe[currCounter]);
}
示例#2
0
文件: count.c 项目: Camelek/qtmoko
void Reset_WMOPS_counter (void)
{
    Word32 tot = WMOPS_frameStat();
        
    /* increase the frame counter --> a frame is counted WHEN IT BEGINS */
    nbframe[currCounter]++;
    /* add wmops used in last frame to count, then reset counter */
    /* (in first frame, this is a no-op                          */
    total_wmops[currCounter] += ((float) tot) * 0.00005;
    
    /* clear counter before new frame starts */
    WMOPS_clearMultiCounter();
    LastWOper[currCounter] = 0;
    funcid[currCounter] = 0;           /* new frame, set function id to zero */
}
示例#3
0
void WMOPS_output_avg (Word16 dtx_mode, Word32 *tot_wm, Word16 *num_frames) {
#if WMOPS
    Word16 i;
    Word32 tot, tot_wc;

    /* get operations since last reset (or init),
       but do not update the counters (except the glob_wc[] maximum)
       so output CAN be called in each frame without problems.
       The frame counter is NOT updated!
     */
    tot = WMOPS_frameStat();
    *tot_wm = (Word32)(total_wmops[currCounter] + ((float) tot) * frameRate);
    *num_frames = nbframe[currCounter];

    fprintf (stdout, "%10s:WMOPS=%.3f",
	     objectName[currCounter]?objectName[currCounter]:"",
	     ((float) tot) * frameRate);

    if (nbframe[currCounter] != 0)
    {
        fprintf (stdout, "  Average=%.3f",
                 *tot_wm / (float) nbframe[currCounter]);
    }
    fprintf (stdout, "  WorstCase=%.3f",
             ((float) glob_wc[currCounter]) * frameRate);

    /* Worst worst case printed only when not in DTX mode */
    if (dtx_mode == 0)
    {
        tot_wc = 0L;
        for (i = 0; i < funcid[currCounter]; i++)
            tot_wc += wc[currCounter][i];
        fprintf (stdout, "  WorstWC=%.3f", ((float) tot_wc) * frameRate);
    }
    fprintf (stdout, " (%d frames)\n", nbframe[currCounter]);
#else
    (void)dtx_mode;
    (void)tot_wm;
    (void)num_frames;    
#endif /* ifdef WMOPS */
}
示例#4
0
void generic_WMOPS_output (Word16 dtx_mode, char *test_file_name)
{
#if WMOPS
   int		saved_value;
   Word16	i;
   Word32	tot, tot_wm, tot_wc, *ptr, *ptr2;
   Word40   grand_total;
   FILE	*WMOPS_file;

   saved_value = currCounter;

   /*Count the grand_total WMOPS so that % ratio per function group
   can be displayed. */
   grand_total = 0;
   for( currCounter = 0; currCounter <= maxCounter; currCounter++) {
      tot = WMOPS_frameStat();
      grand_total += tot;

   }


   if( (WMOPS_file=fopen(WMOPS_DATA_FILENAME,"a"))!=NULL) {

      printf( "opened file %s in order to print WMOPS for each function group.\n", WMOPS_DATA_FILENAME);

      /* Print the file header line. */
      fprintf (WMOPS_file, "Test file name\tFunction Name \tFrame\tNb Times Called\tWMOPS\t%% versus grand total");

      if (nbframe[saved_value] != 0)
         fprintf (WMOPS_file, "\tAverage");

      fprintf (WMOPS_file, "\tWorstCase");

      /* Worst worst case printed only when not in DTX mode */
      if (dtx_mode == 0)
         fprintf (WMOPS_file, "\tWorstWC");

      fprintf (WMOPS_file, "\n");

      /* Print the WMOPS for each Function Group by scanning
         all the function groups with currCounter index.*/
      for( currCounter = 0; currCounter <= maxCounter; currCounter++) {

         fprintf (WMOPS_file, "%s", test_file_name);
         fprintf (WMOPS_file, "\t%s",
                  objectName[currCounter] ? objectName[currCounter] : "");
         fprintf (WMOPS_file, "\t%d", nbframe[currCounter]);

         tot = WMOPS_frameStat();
         tot_wm = (Word32)(total_wmops[currCounter] + ((float) tot) * frameRate);

         fprintf (WMOPS_file, "\t\t%ld", nbTimeObjectIsCalled[currCounter]);
         fprintf (WMOPS_file, "\t%.6f", ((float) tot) * frameRate);
         fprintf (WMOPS_file, "\t%.3f", ((float) tot) / grand_total * 100);

         if (nbframe[currCounter] != 0)
            fprintf (WMOPS_file, "\t%.3f", tot_wm / (float) nbframe[currCounter]);

         fprintf (WMOPS_file, "\t%.3f", ((float) glob_wc[currCounter]) * frameRate);

         /* Worst worst case printed only when not in DTX mode */
         if (dtx_mode == 0) {
            tot_wc = 0L;
            for (i = 0; i < funcid[currCounter]; i++)
               tot_wc += wc[currCounter][i];
            fprintf (WMOPS_file, "\t%.3f", ((float) tot_wc) * frameRate);
         }
         fprintf (WMOPS_file, "\n");

      }

      /* Print the file Grand Total line */
      fprintf (WMOPS_file, "%s", test_file_name);
      fprintf (WMOPS_file, "\tGrand Total");
      fprintf (WMOPS_file, "\t%d", nbframe[saved_value]);
      fprintf (WMOPS_file, "\t\t%.6f", ((float) grand_total) * frameRate);
      fprintf (WMOPS_file, "\t100.000");
      fprintf (WMOPS_file, "\n");
      fclose(WMOPS_file);

   } else
      printf( "Can not open file %s for WMOPS editing\n", WMOPS_DATA_FILENAME);


   if( (WMOPS_file=fopen(WMOPS_TOTAL_FILENAME,"a"))!=NULL) {
      printf( "opened file %s in order to print application's total WMOPS.\n", WMOPS_TOTAL_FILENAME);
      fprintf (WMOPS_file, "%s", test_file_name);
      fprintf (WMOPS_file, "\tframe=%d", nbframe[currCounter]);
      fprintf (WMOPS_file, "\tWMOPS=%.6f", ((float) grand_total) * frameRate);
      fprintf (WMOPS_file, "\n");
      fclose(WMOPS_file);

   } else
      printf( "Can not open file %s for WMOPS editing.\n", WMOPS_TOTAL_FILENAME);


   if( (WMOPS_file=fopen(CODE_PROFILE_FILENAME,"a"))!=NULL) {

      printf( "opened file %s in order to print basic operation distribution statistics.\n", CODE_PROFILE_FILENAME);

      /* Print the file header line. */
      fprintf (WMOPS_file, "Test file name\tBasic Operation Name\tframe\tWMOPS\t\t%% versus grand total\n");

      /* Print the WMOPS for each Basic Operation across all the defined */
      /* Function Groups. */
      for( i = 0; i <(Word16)(sizeof(op_weight) / sizeof(Word32)); i++) {
         fprintf (WMOPS_file, "%-16s", test_file_name);
         fprintf (WMOPS_file, "\t%s", BasicOperationList[i]);
         fprintf (WMOPS_file, "\t%d", nbframe[0]);

         tot = 0;
         ptr = (Word32 *) &multiCounter[0] + i;
         ptr2 = (Word32 *) &op_weight + i;
         for( currCounter = 0; currCounter <= maxCounter; currCounter++) {
            tot += ((*ptr) * (*ptr2));
            ptr += (sizeof(op_weight) / sizeof(Word32));
         }

         fprintf (WMOPS_file, "\t%.6f", ((float) tot) * frameRate);
         fprintf (WMOPS_file, "\t%.3f", ((float) tot) / grand_total * 100);
         fprintf (WMOPS_file, "\n");
      }

      /* Print the file Grand Total line */
      fprintf (WMOPS_file, "%s", test_file_name);
      fprintf (WMOPS_file, "\tGrand Total");
      fprintf (WMOPS_file, "\t%d", nbframe[saved_value]);
      fprintf (WMOPS_file, "\t%.6f", ((float) grand_total) * frameRate);
      fprintf (WMOPS_file, "\t100.000");
      fprintf (WMOPS_file, "\n");
      fclose(WMOPS_file);

   } else
      printf( "Can not open file %s for basic operations distribution statistic editing\n", CODE_PROFILE_FILENAME);

   currCounter = saved_value;

#else
   (void)dtx_mode;
   (void)test_file_name;
#endif /* ifdef WMOPS */
}