int main(int argc, char* argv[]) {
  int log_numverts;
  unsigned int start, time_taken;
  size_t i;
  int64_t nedges, actual_nedges;
  int64_t* result;

  log_numverts = 16; /* In base GRAPHGEN_INITIATOR_SIZE */
  if (argc >= 2) log_numverts = atoi(argv[1]);

  /* Start of graph generation timing */
#pragma mta fence
  start = mta_get_clock(0);

  double initiator[] = {.57, .19, .19, .05};
  make_graph(log_numverts, 8. * pow(2., log_numverts), 1, 2, initiator, &nedges, &result);

#pragma mta fence
  time_taken = mta_get_clock(start);
  /* End of graph generation timing */

  actual_nedges = 0;
#pragma mta block schedule
  for (i = 0; i < nedges; ++i) if (result[i * 2] != (int64_t)(-1)) ++actual_nedges;

  fprintf(stderr, "%" PRIu64 " edge%s generated and permuted in %fs (%f Medges/s)\n", actual_nedges, (actual_nedges == 1 ? "" : "s"), time_taken * mta_clock_period(), 1. * actual_nedges / time_taken * 1.e-6 / mta_clock_period());

  free(result);

  return 0;
}
Example #2
0
double
toc (void)
{
  double out;
#if defined(__MTA__)
  long ts;
  MTA("mta fence")
  ts = mta_get_clock (tic_ts);
  out = ((double)ts) * mta_clock_period ();
  /*fprintf (stderr, "%ld %g %g %g\n", ts, out, mta_clock_period(), mta_clock_freq());*/
#elif defined(HAVE_MACH_ABSOLUTE_TIME)
  uint64_t ts, nanosec;
  static mach_timebase_info_data_t info = {0,0};
  if (info.denom == 0) {
    mach_timebase_info(&info);
  }
  ts = mach_absolute_time();
  nanosec = (ts - tic_ts) * (info.numer / info.denom);
  out = 1.0e-9 * nanosec;
#else
  struct timespec ts;
  clock_gettime (TICTOC_CLOCK, &ts);
  out = (ts.tv_nsec - (double)tic_ts.tv_nsec) * 1.0e-9;
  out += (ts.tv_sec - (double)tic_ts.tv_sec);
#endif

  return out;
}
Example #3
0
void
tic (void)
{
#if defined(__MTA__)
  MTA("mta fence")
  tic_ts = mta_get_clock (0);
#elif defined(HAVE_MACH_ABSOLUTE_TIME)
  tic_ts = mach_absolute_time();  
#else
  clock_gettime (TICTOC_CLOCK, &tic_ts);
#endif
}
Example #4
0
void
tic (void)
{
#if defined(__MTA__)
  MTA("mta fence")
  tic_ts = mta_get_clock (0);
#elif defined(__MacOSX__)
  tic_ts = UpTime ();
#else
  clock_gettime (TICTOC_CLOCK, &tic_ts);
#endif
}
/// "Universal" wallclock time (works at least for Mac, MTA, and most Linux)
inline double walltime(void) {
#if defined(__MTA__)
	return((double)mta_get_clock(0) / mta_clock_freq());
#elif defined(__MACH__)
	static mach_timebase_info_data_t info;
	mach_timebase_info(&info);
	uint64_t now = mach_absolute_time();
	now *= info.numer;
	now /= info.denom;
	return 1.0e-9 * (double)now;
#else
	struct timespec tp;
#if defined(CLOCK_PROCESS_CPUTIME_ID)
#define CLKID CLOCK_PROCESS_CPUTIME_ID
#elif  defined(CLOCK_REALTIME_ID)
#define CLKID CLOCK_REALTIME_ID
#endif
	clock_gettime(CLOCK_MONOTONIC, &tp);
	return (double)tp.tv_sec + (double)tp.tv_nsec / BILLION;
#endif
}
Example #6
0
double
toc (void)
{
  double out;
#if defined(__MTA__)
  long ts;
  MTA("mta fence")
  ts = mta_get_clock (tic_ts);
  out = ((double)ts) * mta_clock_period ();
  /*fprintf (stderr, "%ld %g %g %g\n", ts, out, mta_clock_period(), mta_clock_freq());*/
#elif defined(__MacOSX__)
  AbsoluteTime ts;
  ts = UpTime ();
  out = 1.0e-9 * AbsoluteDeltaToNanoseconds (ts, tic_ts);
#else
  struct timespec ts;
  clock_gettime (TICTOC_CLOCK, &ts);
  out = (ts.tv_nsec - (double)tic_ts.tv_nsec) * 1.0e-9;
  out += (ts.tv_sec - (double)tic_ts.tv_sec);
#endif

  return out;
}
Example #7
0
double
timer (void)
{
  return ((double) mta_get_clock (0) / mta_clock_freq ());
}
Example #8
0
_real64 chpl_now_time(void) {
#pragma mta fence
  return ((_real64)mta_get_clock(0)/mta_clock_freq())*1.0e+6;
}
Example #9
0
 void stop() { ticks = mta_get_clock(ticks); }
Example #10
0
 void start() { ticks = mta_get_clock(0); }