Esempio n. 1
0
	std::string OutputZonesAsString(const ProfileZone *a_root, uint32_t a_count) {
		float fTicksToPc = 100.0f / a_root->data.childTicks.avg;
		std::string str;

		str.resize((1 + a_count) * (OUTPUT_WIDTH_SUM + 1) - 1);
		char *s = &str[0];

		_printHeader(s, "flat profile");
		s += OUTPUT_WIDTH_SUM;
		(*s++) = '\n';

		const ProfileZone *zone = a_root;

		do {
			snprintf(s, OUTPUT_WIDTH_NAME + TRAILING, "%-*s",
				OUTPUT_WIDTH_NAME, zone->name);

			s += OUTPUT_WIDTH_NAME;

			_printData(s, zone->data, fTicksToPc);

			s += OUTPUT_WIDTH_DATA;
			(*s++) = '\n';

			zone = zone->next;
		} while (zone);

		*(--s) = '\0';
		return str;
	}
Esempio n. 2
0
	std::string OutputNodesAsString(const ProfileNode *a_root, uint32_t a_count) {
		float fTicksToPc = 100.0f / a_root->data.childTicks.avg;
		std::string str;

		str.resize((1 + a_count) * (OUTPUT_WIDTH_SUM + 1) - 1);
		char *s = &str[0];

		_printHeader(s, "call tree");
		s += OUTPUT_WIDTH_SUM;
		(*s++) = '\n';

		const ProfileNode *node = a_root;

		do {
			int offset = node->entryLevel * 2;
			snprintf(s, OUTPUT_WIDTH_NAME + TRAILING, "%*s%-*s",
				offset, "", OUTPUT_WIDTH_NAME - offset, node->zone->name);

			s += OUTPUT_WIDTH_NAME;

			_printData(s, node->data, fTicksToPc);

			s += OUTPUT_WIDTH_DATA;
			(*s++) = '\n';

			node = node->findNextInTree();
		} while (node);

		*(--s) = '\0';
		return str;
	}
Esempio n. 3
0
void Box_printRow(T t) {
        ASSERT(t);
        if (t->index.row == 0) {
                _printBorderTop(t);
                if (t->options.header.enabled) {
                        _printHeader(t);
                        _printBorderMiddle(t);
                }
        } else {
                _printBorderMiddle(t);
        }
        boolean_t repeat = false;
        do {
                repeat = _printRow(t);
        } while (repeat);
        _resetRow(t);
}
Esempio n. 4
0
void KLTWriteFeatureTable(
  KLT_FeatureTable ft,
  char *fname, 
  char *fmt)
{
  FILE *fp;
  char format[100];
  char type;
  int i, j;

  if (KLT_verbose >= 1 && fname != NULL)  {
    fprintf(stderr,  
            "(KLT) Writing feature table to %s file: '%s'\n", 
            (fmt == NULL ? "binary" : "text"), fname);
  }

  if (fmt != NULL) {  /* text file or stderr */
    fp = _printSetupTxt(fname, fmt, format, &type);
    _printHeader(fp, format, FEATURE_TABLE, ft->nFrames, ft->nFeatures);

    for (j = 0 ; j < ft->nFeatures ; j++)  {
      fprintf(fp, "%7d | ", j);
      for (i = 0 ; i < ft->nFrames ; i++)
        _printFeatureTxt(fp, ft->feature[j][i], format, type);
      fprintf(fp, "\n");
    }
    _printShutdown(fp);
  } else {  /* binary file */
    fp = _printSetupBin(fname);
    fwrite(binheader_ft, sizeof(char), BINHEADERLENGTH, fp); 
    fwrite(&(ft->nFrames), sizeof(int), 1, fp);
    fwrite(&(ft->nFeatures), sizeof(int), 1, fp);
    for (j = 0 ; j < ft->nFeatures ; j++)  {
      for (i = 0 ; i < ft->nFrames ; i++)  {
        _printFeatureBin(fp, ft->feature[j][i]);
      }
    }
    fclose(fp);
  }
}
Esempio n. 5
0
void KLTWriteFeatureHistory(
  KLT_FeatureHistory fh,
  char *fname, 
  char *fmt)
{
  FILE *fp;
  char format[100];
  char type;
  int i;

  if (KLT_verbose >= 1 && fname != NULL)  {
    fprintf(stderr,  
            "(KLT) Writing feature history to %s file: '%s'\n", 
            (fmt == NULL ? "binary" : "text"), fname);
  }

  if (fmt != NULL) {  /* text file or stderr */
    fp = _printSetupTxt(fname, fmt, format, &type);
    _printHeader(fp, format, FEATURE_HISTORY, fh->nFrames, 0);
	
    for (i = 0 ; i < fh->nFrames ; i++)  {
      fprintf(fp, "%5d | ", i);
      _printFeatureTxt(fp, fh->feature[i], format, type);
      fprintf(fp, "\n");
    }
    _printShutdown(fp);
  } else {  /* binary file */
    fp = _printSetupBin(fname);
    fwrite(binheader_fh, sizeof(char), BINHEADERLENGTH, fp); 
    fwrite(&(fh->nFrames), sizeof(int), 1, fp);
    for (i = 0 ; i < fh->nFrames ; i++)  {
      _printFeatureBin(fp, fh->feature[i]);
    }
    fclose(fp);
  }
}