#include <sys/time.h>
#include <sys/resource.h>
        
#ifdef MEMO
struct    *rusage {
         struct timeval ru_utime;      /* user time used */
                (tv_sec,tv_usec)
         struct timeval ru_stime;      /* system time used */
         int  ru_maxrss;          /* maximum resident set size */
         int  ru_ixrss;      /* currently 0 */
         int  ru_idrss;      /* integral resident set size */
         int  ru_isrss;      /* currently 0 */
         int  ru_minflt;          /* page faults not requiring physical I/O */
         int  ru_majflt;          /* page faults requiring physical I/O */
         int  ru_nswap;      /* swaps */
         int  ru_inblock;         /* block input operations */
         int  ru_oublock;         /* block output operations */
         int  ru_msgsnd;          /* messages sent */
         int  ru_msgrcv;          /* messages received */
         int  ru_nsignals;        /* signals received */
         int  ru_nvcsw;      /* voluntary context switches */
         int  ru_nivcsw;          /* involuntary context switches */
};

struct timeval {
        time_t  tv_sec;         /* seconds */
        int     tv_usec;        /* microseconds */
                /* the type of the tv_usec field may be replaced by   */
                /* useconds_t in the next rev of XPG4 based on waiver */
};

#endif

void get_wcputime(laptime,splittime)
double *laptime;
double *splittime;
{
#if 0
        struct rusage x;
        double sec,microsec;

        getrusage(RUSAGE_SELF,&x);
        sec = x.ru_utime.tv_sec + x.ru_stime.tv_sec ;
        microsec = x.ru_utime.tv_usec + x.ru_stime.tv_usec ;
        *laptime = sec + microsec / 1000000.0 - *splittime;
        *splittime = sec + microsec / 1000000.0;
#endif
        struct timeval tval;
        int *dum=0;

        gettimeofday(&tval, (void*)dum);
        *laptime = tval.tv_sec + tval.tv_usec * 1.0e-6 - *splittime;
        *splittime = tval.tv_sec + tval.tv_usec * 1.0e-6 ;
        
/*      printf("sprit lap =%e %e \n",*sprittime,*laptime);*/
}
