1 // *********************************************************************
2 // Copyright 2000-2004, Princeton University. All rights reserved.
3 // By using this software the USER indicates that he or she has read,
4 // understood and will comply with the following:
6 // --- Princeton University hereby grants USER nonexclusive permission
7 // to use, copy and/or modify this software for internal, noncommercial,
8 // research purposes only. Any distribution, including commercial sale
9 // or license, of this software, copies of the software, its associated
10 // documentation and/or modifications of either is strictly prohibited
11 // without the prior consent of Princeton University. Title to copyright
12 // to this software and its associated documentation shall at all times
13 // remain with Princeton University. Appropriate copyright notice shall
14 // be placed on all software copies, and a complete copy of this notice
15 // shall be included in all copies of the associated documentation.
16 // No right is granted to use in advertising, publicity or otherwise
17 // any trademark, service mark, or the name of Princeton University.
20 // --- This software and any associated documentation is provided "as is"
22 // PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS
23 // OR IMPLIED, INCLUDING THOSE OF MERCHANTABILITY OR FITNESS FOR A
24 // PARTICULAR PURPOSE, OR THAT USE OF THE SOFTWARE, MODIFICATIONS, OR
25 // ASSOCIATED DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS,
26 // TRADEMARKS OR OTHER INTELLECTUAL PROPERTY RIGHTS OF A THIRD PARTY.
28 // Princeton University shall not be liable under any circumstances for
29 // any direct, indirect, special, incidental, or consequential damages
30 // with respect to any claim by USER or any third party on account of
31 // or arising from the use, or inability to use, this software or its
32 // associated documentation, even if Princeton University has been advised
33 // of the possibility of those damages.
34 // *********************************************************************
41 #include <sys/resource.h>
43 int _global_debug_leveli = 0;
45 int _global_check_level = 0;
47 void fatal(char * fun, char * file, int lineno, char * fmt, ...) {
49 fprintf(stderr, "***");
51 fprintf(stderr, " in %s", fun);
53 fprintf(stderr, " at %s", file);
55 fprintf(stderr, ":%d", lineno);
58 vfprintf(stderr, fmt, ap);
64 void warning(char * fun, char * file, int lineno, char * fmt, ...) {
66 fprintf(stderr, "***");
68 fprintf(stderr, " in %s", fun);
70 fprintf(stderr, " at %s", file);
72 fprintf(stderr, ":%d", lineno);
76 vfprintf(stderr, fmt, ap);
81 double get_cpu_time(void) {
84 getrusage(RUSAGE_SELF, &usage);
85 res = usage.ru_utime.tv_usec + usage.ru_stime.tv_usec;
87 res += usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;