source: git/libfac/factor/timing.h @ e2ca88

spielwiese
Last change on this file since e2ca88 was e2ca88, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes: gcc 4.1 fixes git-svn-id: file:///usr/local/Singular/svn/trunk@9142 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/* Copyright 1996 Michael Messollen. All rights reserved. */
2////////////////////////////////////////////////////////////
3// emacs edit mode for this file is -*- C++ -*-
4// static char * rcsid = "$Id: timing.h,v 1.4 2006-05-16 14:46:50 Singular Exp $";
5////////////////////////////////////////////////////////////
6// It is possible to include this file multiple times for different
7// settings of TIMING (but now this isn't used)
8
9#undef TIMING_START
10#undef TIMING_END
11#undef TIMING_DEFINE_PRINT
12#undef TIMING_DEFINE_PRINTPROTO
13#undef TIMING_PRINT
14
15#ifdef TIMING
16#include <time.h>
17#include <sys/times.h>
18#ifdef HAVE_IOSTREAM
19#include <iostream>
20#define OSTREAM std::ostream
21#define ISTREAM std::istream
22#elif defined(HAVE_IOSTREAM_H)
23#include <iostream.h>
24#define OSTREAM ostream
25#define ISTREAM istream
26#endif
27#define TIMING_START(t) { struct tms timing_ ## t ## _start, timing_ ## t ## _end; \
28  times( &timing_ ## t ## _start );
29#define TIMING_END(t) times( &timing_ ## t ## _end ); \
30  timing_ ## t ## _time += timing_ ## t ## _end.tms_utime - timing_ ## t ## _start.tms_utime; }
31#define TIMING_DEFINE_PRINT(t) long timing_ ## t ## _time; \
32void timing_print_ ## t ( char * msg ) { CERR.setf( ios::fixed, ios::floatfield); CERR.precision(2); \
33  CERR << msg << float(timing_ ## t ## _time) / 60 << " sec" << "\n"; }
34#define TIMING_PRINT(t,msg) timing_print_ ## t ( msg );
35#define TIMING_DEFINE_PRINTPROTO(t) void timing_print_ ## t ( char * );
36#else
37#define TIMING_START(t)
38#define TIMING_END(t)
39#define TIMING_DEFINE_PRINT(t)
40#define TIMING_PRINT(t,msg)
41#define TIMING_DEFINE_PRINTPROTO(t)
42#endif /* TIMING */
43
44/*
45$Log: not supported by cvs2svn $
46Revision 1.3  1997/09/12 07:19:59  Singular
47* hannes/michael: libfac-0.3.0
48
49Revision 1.2  1997/04/25 22:13:56  michael
50Version for libfac-0.2.1
51
52Revision 1.1  1996/01/17 06:22:05  michael
53Initial revision
54
55*/
Note: See TracBrowser for help on using the repository browser.