174 &_starting_system_time);
175 }
176 }
177
178 TraceCPUTime::~TraceCPUTime() {
179 if (_active) {
180 bool valid = false;
181 if (!_error) {
182 double real_secs; // walk clock time
183 double system_secs; // system time
184 double user_secs; // user time for all threads
185
186 double real_time, user_time, system_time;
187 valid = os::getTimesSecs(&real_time, &user_time, &system_time);
188 if (valid) {
189
190 user_secs = user_time - _starting_user_time;
191 system_secs = system_time - _starting_system_time;
192 real_secs = real_time - _starting_real_time;
193
194 _logfile->print(" [Times: user=%3.2f sys=%3.2f, real=%3.2f secs] ",
195 user_secs, system_secs, real_secs);
196
197 } else {
198 _logfile->print("[Invalid result in TraceCPUTime]");
199 }
200 } else {
201 _logfile->print("[Error in TraceCPUTime]");
202 }
203 if (_print_cr) {
204 _logfile->print_cr("");
205 }
206 _logfile->flush();
207 }
208 }
|
174 &_starting_system_time);
175 }
176 }
177
178 TraceCPUTime::~TraceCPUTime() {
179 if (_active) {
180 bool valid = false;
181 if (!_error) {
182 double real_secs; // walk clock time
183 double system_secs; // system time
184 double user_secs; // user time for all threads
185
186 double real_time, user_time, system_time;
187 valid = os::getTimesSecs(&real_time, &user_time, &system_time);
188 if (valid) {
189
190 user_secs = user_time - _starting_user_time;
191 system_secs = system_time - _starting_system_time;
192 real_secs = real_time - _starting_real_time;
193
194 _logfile->print(" [Times: user=%3.2f sys=%3.2f real=%3.2f secs] ",
195 user_secs, system_secs, real_secs);
196
197 } else {
198 _logfile->print("[Invalid result in TraceCPUTime]");
199 }
200 } else {
201 _logfile->print("[Error in TraceCPUTime]");
202 }
203 if (_print_cr) {
204 _logfile->print_cr("");
205 }
206 _logfile->flush();
207 }
208 }
|