source: git/factory/libfac/factor/timing.h @ dccceb

spielwiese
Last change on this file since dccceb was dccceb, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
moved libfac under factory/ CHG: moved libfac/ under factory/ Note: starting to merge libfac into factory (as a private library)
  • Property mode set to 100644
File size: 1.4 KB
Line 
1////////////////////////////////////////////////////////////
2// emacs edit mode for this file is -*- C++ -*-
3// $Id$
4////////////////////////////////////////////////////////////
5// It is possible to include this file multiple times for different
6// settings of TIMING (but now this isn't used)
7
8#undef TIMING_START
9#undef TIMING_END
10#undef TIMING_DEFINE_PRINT
11#undef TIMING_DEFINE_PRINTPROTO
12#undef TIMING_PRINT
13
14#ifdef TIMING
15#include <time.h>
16#include <sys/times.h>
17#ifdef HAVE_IOSTREAM
18#include <iostream>
19#define OSTREAM std::ostream
20#define ISTREAM std::istream
21#elif defined(HAVE_IOSTREAM_H)
22#include <iostream.h>
23#define OSTREAM ostream
24#define ISTREAM istream
25#endif
26#define TIMING_START(t) { struct tms timing_ ## t ## _start, timing_ ## t ## _end; \
27  times( &timing_ ## t ## _start );
28#define TIMING_END(t) times( &timing_ ## t ## _end ); \
29  timing_ ## t ## _time += timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime; }
30#define TIMING_DEFINE_PRINT(t) long timing_ ## t ## _time; \
31void timing_print_ ## t ( char * msg ) { CERR.setf( ios::fixed, ios::floatfield); CERR.precision(2); \
32  CERR << msg << float(timing_ ## t ## _time) / 60 << " sec" << "\n"; }
33#define TIMING_PRINT(t,msg) timing_print_ ## t ( msg );
34#define TIMING_DEFINE_PRINTPROTO(t) void timing_print_ ## t ( char * );
35#else
36#define TIMING_START(t)
37#define TIMING_END(t)
38#define TIMING_DEFINE_PRINT(t)
39#define TIMING_PRINT(t,msg)
40#define TIMING_DEFINE_PRINTPROTO(t)
41#endif /* TIMING */
42
Note: See TracBrowser for help on using the repository browser.