コード例 #1
0
ファイル: etime.c プロジェクト: abumaryam/gcc
void
etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
{
  GFC_REAL_4 tu, ts, tt, *tp;
  long user_sec, user_usec, system_sec, system_usec;

  if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2)
    runtime_error ("Insufficient number of elements in TARRAY.");

  if (gf_cputime (&user_sec, &user_usec, &system_sec, &system_usec) == 0)
    {
      tu = (GFC_REAL_4)(user_sec + 1.e-6 * user_usec);
      ts = (GFC_REAL_4)(system_sec + 1.e-6 * system_usec);
      tt = tu + ts;
    }
  else
    {
      tu = (GFC_REAL_4)-1.0;
      ts = (GFC_REAL_4)-1.0;
      tt = (GFC_REAL_4)-1.0;
    }

  tp = t->base_addr;

  *tp = tu;
  tp += GFC_DESCRIPTOR_STRIDE(t,0);
  *tp = ts;
  *result = tt;
}
コード例 #2
0
static void
__cpu_time_1 (long *sec, long *usec)
{
  long user_sec, user_usec, system_sec, system_usec;
  if (gf_cputime (&user_sec, &user_usec, &system_sec, &system_usec) == 0)
    {
      *sec = user_sec + system_sec;
      *usec = user_usec + system_usec;
    }
  else
    {
      *sec = -1;
      *usec = 0;
    }
}
コード例 #3
0
ファイル: dtime.c プロジェクト: 0day-ci/gcc
void
dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
{
  GFC_REAL_4 *tp;
  long user_sec, user_usec, system_sec, system_usec;
  static long us = 0, uu = 0, ss = 0 , su = 0;
  GFC_REAL_4 tu, ts, tt;

  if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2)
    runtime_error ("Insufficient number of elements in TARRAY.");

  __gthread_mutex_lock (&dtime_update_lock);
  if (gf_cputime (&user_sec, &user_usec, &system_sec, &system_usec) == 0)
    {
      tu = (GFC_REAL_4) ((user_sec - us) + 1.e-6 * (user_usec - uu));
      ts = (GFC_REAL_4) ((system_sec - ss) + 1.e-6 * (system_usec - su));
      tt = tu + ts;
      us = user_sec;
      uu = user_usec;
      ss = system_sec;
      su = system_usec;
    }
  else
    {
      tu = -1;
      ts = -1;
      tt = -1;
    }

  tp = t->base_addr;

  *tp = tu;
  tp += GFC_DESCRIPTOR_STRIDE(t,0);
  *tp = ts;
  *result = tt;
  __gthread_mutex_unlock (&dtime_update_lock);
}