2 4ti2 -- A software package for algebraic, geometric and combinatorial
3 problems on linear spaces.
5 Copyright (C) 2006 4ti2 team.
6 Main author(s): Matthias Walter.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 #include <sys/resource.h>
42 getrusage(RUSAGE_SELF
, &usage
);
44 return (double)usage
.ru_utime
.tv_sec
+ 1e-6*usage
.ru_utime
.tv_usec
;
46 return (double) clock() / CLOCKS_PER_SEC
;
52 void fprintCPUTime(FILE *stream
, CPUTime time
)
55 fprintf(stream
, "%.2f days", time
/ 86400.0);
56 else if (time
>=3600.0)
57 fprintf(stream
, "%.2f hours", time
/ 3600.0);
59 fprintf(stream
, "%.2f mins", time
/ 60.0);
61 fprintf(stream
, "%.2f secs", time
);
66 void printCPUTime(CPUTime time
)
68 fprintCPUTime(stdout
, time
);