0
#if defined(HAVE_TIMES)
#include <unistd.h>
static double cycles_diff(struct tms *a,struct tms *b)
{

      clock_t aa = a->tms_utime  +
                   a->tms_stime  +
                   a->tms_cutime +
                   a->tms_cstime;

      clock_t bb = b->tmstms_utime
            +      b->tms_stime
            +      b->tms_cutime
            +      b->tms_cstime;

      return (aa-bb)/(double)sysconf(_SC_CLK_TCK);
  }
}

这给出了错误

结构体类型声明不完整

未声明 sysconf

4

1 回答 1

1

根据你需要的手册#include <sys/times.h>

于 2011-07-27T07:43:37.093 回答