]> www.ginac.de Git - cln.git/blob - src/timing/cl_t_c2.cc
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / timing / cl_t_c2.cc
1 // constructor cl_timing(cl_ostream).
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/timing.h"
8
9
10 // Implementation.
11
12 namespace cln {
13
14 static void report_stream (const cl_timing& t)
15 {
16         var const cl_time_consumption usage_end = cl_current_time_consumption();
17         var const cl_time_consumption& usage_start = t.tmp;
18         var cl_time_consumption usage;
19         usage.realtime = usage_end.realtime - usage_start.realtime;
20         usage.usertime = usage_end.usertime - usage_start.usertime;
21
22         var cl_ostream destination = *(std::ostream*) t.report_destination;
23         if (t.comment)
24                 fprint(destination,t.comment);
25         cl_timing_report(destination,usage);
26         fprint(destination,"\n");
27 }
28
29 cl_timing::cl_timing (cl_ostream destination)
30 {
31         report_fn = report_stream;
32         report_destination = &destination;
33         comment = NULL;
34         tmp = cl_current_time_consumption();
35 }
36
37 cl_timing::cl_timing (const char * msg, cl_ostream destination)
38 {
39         report_fn = report_stream;
40         report_destination = &destination;
41         comment = msg;
42         tmp = cl_current_time_consumption();
43 }
44
45 }  // namespace cln