SVF
Functions
cpu_time.c File Reference
#include <stdio.h>
#include "CUDD/util.h"

Go to the source code of this file.

Functions

long util_cpu_time ()
 

Function Documentation

◆ util_cpu_time()

long util_cpu_time ( void  )

Definition at line 34 of file cpu_time.c.

35 {
36  long t = 0;
37 
38 #ifdef BSD
39  struct rusage rusage;
40  (void) getrusage(RUSAGE_SELF, &rusage);
41  t = (long) rusage.ru_utime.tv_sec*1000 + rusage.ru_utime.tv_usec/1000;
42 #endif
43 
44 #ifdef IBMPC
45  long ltime;
46  (void) time(&ltime);
47  t = ltime * 1000;
48 #endif
49 
50 #ifdef UNIX60 /* times() with 60 Hz resolution */
51  struct tms buffer;
52  times(&buffer);
53  t = buffer.tms_utime * 16.6667;
54 #endif
55 
56 #ifdef UNIX100
57  struct tms buffer; /* times() with 100 Hz resolution */
58  times(&buffer);
59  t = buffer.tms_utime * 10;
60 #endif
61 
62 #ifdef __CYGWIN32__
63  /* Works under Windows NT but not Windows 95. */
64  struct tms buffer; /* times() with 1000 Hz resolution */
65  times(&buffer);
66  t = buffer.tms_utime;
67 #endif
68 
69 #ifdef vms
70  tbuffer_t buffer; /* times() with 100 Hz resolution */
71  times(&buffer);
72  t = buffer.proc_user_time * 10;
73 #endif
74 
75  return t;
76 }