Minsky
anonymous_namespace{addon.cc}::Times Struct Reference
Collaboration diagram for anonymous_namespace{addon.cc}::Times:
Collaboration graph

Public Member Functions

 Times ()
 
void start ()
 
void stop ()
 

Public Attributes

unsigned long counts
 
double elapsed
 
double user
 
double system
 
clock_t start_e
 
clock_t start_u
 
clock_t start_s
 
bool started
 

Detailed Description

Definition at line 100 of file addon.cc.

Constructor & Destructor Documentation

◆ Times()

anonymous_namespace{addon.cc}::Times::Times ( )
inline

Member Function Documentation

◆ start()

void anonymous_namespace{addon.cc}::Times::start ( )
inline

Definition at line 108 of file addon.cc.

109  {
110  if (started) return;
111  started = true;
112  counts++;
113 
114 #ifdef _WIN32
115  start_e=clock();
116 #else
117  struct tms tbuf;
118  start_e = times(&tbuf);
119  start_u = tbuf.tms_utime;
120  start_s = tbuf.tms_stime;
121 #endif
122  }

◆ stop()

void anonymous_namespace{addon.cc}::Times::stop ( )
inline

Definition at line 124 of file addon.cc.

125  {
126  if (!started) return;
127  started = false;
128 
129 #ifdef _WIN32
130  static const double seconds=1.0/CLOCKS_PER_SEC;
131  elapsed+=(clock()-start_e)*seconds;
132 #else
133 #ifdef __linux__
134  static const double seconds=1.0/sysconf(_SC_CLK_TCK);
135 #else
136  static const double seconds=1.0/CLK_TCK;
137 #endif
138  struct tms tbuf;
139  elapsed += (times(&tbuf)-start_e)*seconds;
140  user += (tbuf.tms_utime-start_u)*seconds;
141  system += (tbuf.tms_stime-start_s)*seconds;
142 #endif
143  }

Member Data Documentation

◆ counts

unsigned long anonymous_namespace{addon.cc}::Times::counts

Definition at line 102 of file addon.cc.

◆ elapsed

double anonymous_namespace{addon.cc}::Times::elapsed

Definition at line 103 of file addon.cc.

◆ start_e

clock_t anonymous_namespace{addon.cc}::Times::start_e

Definition at line 104 of file addon.cc.

◆ start_s

clock_t anonymous_namespace{addon.cc}::Times::start_s

Definition at line 104 of file addon.cc.

◆ start_u

clock_t anonymous_namespace{addon.cc}::Times::start_u

Definition at line 104 of file addon.cc.

◆ started

bool anonymous_namespace{addon.cc}::Times::started

Definition at line 105 of file addon.cc.

◆ system

double anonymous_namespace{addon.cc}::Times::system

Definition at line 103 of file addon.cc.

◆ user

double anonymous_namespace{addon.cc}::Times::user

Definition at line 103 of file addon.cc.


The documentation for this struct was generated from the following file: