コード例 #1
0
void chpl_vdebug_start (const char *fileroot, double now) {
  const char * rootname;
  struct rusage ru;
  struct timeval tv;
  chpl_taskID_t startTask = chpl_task_getId();
  (void) gettimeofday (&tv, NULL);

  install_callbacks();

  chpl_vdebug = 0;

  // Close any open files.
  if (chpl_vdebug_fd >= 0)
    chpl_vdebug_stop ();
    
  // Initial call, open file and write initialization information
  
  // Get the root of the file name.
  rootname = (fileroot == NULL || fileroot[0] == 0) ? ".Vdebug" : fileroot; 
  
  // In case of an error, just return
  if (chpl_make_vdebug_file (rootname) < 0)
    return;
  
  // Write initial information to the file, including resource time
  if ( getrusage (RUSAGE_SELF, &ru) < 0) {
    ru.ru_utime.tv_sec = 0;
    ru.ru_utime.tv_usec = 0;
    ru.ru_stime.tv_sec = 0;
    ru.ru_stime.tv_usec = 0;
  }
  chpl_dprintf (chpl_vdebug_fd,
                "ChplVdebug: ver 1.2 nodes %d nid %d tid %d seq %.3lf %lld.%06ld %ld.%06ld %ld.%06ld \n",
                chpl_numNodes, chpl_nodeID, (int) startTask, now,
                (long long) tv.tv_sec, (long) tv.tv_usec,
                (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
                (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec  );

  // Dump file names
  if (chpl_nodeID == 0) {
    int ix;
    chpl_dprintf (chpl_vdebug_fd, "Tablesize: %d\n", chpl_filenameTableSize);
    for (ix = 0; ix < chpl_filenameTableSize ; ix++) {
      if (chpl_filenameTable[ix][0] == 0) {
        chpl_dprintf (chpl_vdebug_fd, "fname: 0 <unknown>\n");
      } else if (chpl_filenameTable[ix][0] == '<' &&
                 chpl_filenameTable[ix][1] == 'c') {
        chpl_dprintf (chpl_vdebug_fd, "fname: %d <command_line>\n", ix);
      } else {
        chpl_dprintf (chpl_vdebug_fd, "fname: %d %s\n", ix,
                      chpl_filenameTable[ix]);
      }
    }
  }
  
  chpl_vdebug = 1;
}
コード例 #2
0
ファイル: chpl-visual-debug.c プロジェクト: ct-clmsn/chapel
void chpl_vdebug_start (const char *fileroot, double now) {
  const char * rootname;
  struct rusage ru;
  struct timeval tv;
  chpl_taskID_t startTask = chpl_task_getId();
  (void) gettimeofday (&tv, NULL);

  install_callbacks();

  chpl_vdebug = 0;

  // Close any open files.
  if (chpl_vdebug_fd >= 0)
    chpl_vdebug_stop ();
    
  // Initial call, open file and write initialization information
  
  // Get the root of the file name.
  rootname = (fileroot == NULL || fileroot[0] == 0) ? ".Vdebug" : fileroot; 
  
  // In case of an error, just return
  if (chpl_make_vdebug_file (rootname) < 0)
    return;
  
  // Write initial information to the file, including resource time
  if ( getrusage (RUSAGE_SELF, &ru) < 0) {
    ru.ru_utime.tv_sec = 0;
    ru.ru_utime.tv_usec = 0;
    ru.ru_stime.tv_sec = 0;
    ru.ru_stime.tv_usec = 0;
  }
  chpl_dprintf (chpl_vdebug_fd,
                "ChplVdebug: ver 1.1 nodes %d nid %d tid %d seq %.3lf %lld.%06ld %ld.%06ld %ld.%06ld \n",
                chpl_numNodes, chpl_nodeID, (int) startTask, now,
                (long long) tv.tv_sec, (long) tv.tv_usec,
                (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
                (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec  );
  chpl_vdebug = 1;
}
コード例 #3
0
ファイル: chpl-visual-debug.c プロジェクト: jcazzie/chapel
void chpl_vdebug_start (const char *fileroot, double now) {
  const char * rootname;
  struct rusage ru;
  struct timeval tv;
  chpl_taskID_t startTask = chpl_task_getId();
  char buff[CHPL_TASK_ID_STRING_MAX_LEN];
  (void) gettimeofday (&tv, NULL);

  install_callbacks();

  chpl_vdebug = 0;

  // Close any open files.
  if (chpl_vdebug_fd >= 0)
    chpl_vdebug_stop ();
    
  // Initial call, open file and write initialization information
  
  // Get the root of the file name.
  rootname = (fileroot == NULL || fileroot[0] == 0) ? ".Vdebug" : fileroot; 
  
  // In case of an error, just return
  if (chpl_make_vdebug_file (rootname) < 0)
    return;
  
  // Write initial information to the file, including resource time
  if ( getrusage (RUSAGE_SELF, &ru) < 0) {
    ru.ru_utime.tv_sec = 0;
    ru.ru_utime.tv_usec = 0;
    ru.ru_stime.tv_sec = 0;
    ru.ru_stime.tv_usec = 0;
  }
  chpl_dprintf (chpl_vdebug_fd,
                "ChplVdebug: ver 1.3 nodes %d nid %d tid %s seq %.3lf %lld.%06ld %ld.%06ld %ld.%06ld \n",
                chpl_numNodes, chpl_nodeID, TID_STRING(buff, startTask), now,
                (long long) tv.tv_sec, (long) tv.tv_usec,
                (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
                (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec  );

  // Dump directory names, file names and function names
  if (chpl_nodeID == 0) {
    int ix;
    int numFIDnames;

    chpl_dprintf (chpl_vdebug_fd, "CHPL_HOME: %s\n", CHPL_HOME);
    chpl_dprintf (chpl_vdebug_fd, "DIR: %s\n", chpl_compileDirectory);
    chpl_dprintf (chpl_vdebug_fd, "SAVEC: %s\n", chpl_saveCDir);

    chpl_dprintf (chpl_vdebug_fd, "Tablesize: %d\n", chpl_filenameTableSize);
    for (ix = 0; ix < chpl_filenameTableSize ; ix++) {
      if (chpl_filenameTable[ix][0] == 0) {
        chpl_dprintf (chpl_vdebug_fd, "fname: 0 <unknown>\n");
      } else if (chpl_filenameTable[ix][0] == '<' &&
                 chpl_filenameTable[ix][1] == 'c') {
        chpl_dprintf (chpl_vdebug_fd, "fname: %d <command_line>\n", ix);
      } else {
        chpl_dprintf (chpl_vdebug_fd, "fname: %d %s\n", ix,
                      chpl_filenameTable[ix]);
      }
    }
    for (numFIDnames = 0; chpl_finfo[numFIDnames].name != NULL; numFIDnames++);
    chpl_dprintf (chpl_vdebug_fd, "FIDNsize: %d\n", numFIDnames);
    for (ix = 0; ix < numFIDnames; ix++)
      chpl_dprintf (chpl_vdebug_fd, "FIDname: %d %d %d %s\n", ix,
                    chpl_finfo[ix].lineno, chpl_finfo[ix].fileno,
                    chpl_finfo[ix].name);
  }
  
  chpl_vdebug = 1;
}