pmm  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
pmm_util.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008-2010 Robert Higgins
3  Author: Robert Higgins <robert.higgins@ucd.ie>
4 
5  This file is part of PMM.
6 
7  PMM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  PMM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with PMM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef PMM_UTIL_H_
21 #define PMM_UTIL_H_
22 
23 #if HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 
28 /*extern struct timeval tstart;
29 extern struct timeval tend;
30 extern struct timeval tret;*/
31 
32 /*
33  * exit codes
34  */
35 #define PMM_EXIT_SUCCESS 0
36 #define PMM_EXIT_ARGFAIL 1 //TODO rename ARGNFAIL
37 #define PMM_EXIT_ARGPARSEFAIL 2
38 #define PMM_EXIT_ALLOCFAIL 3
39 #define PMM_EXIT_EXEFAIL 4
40 #define PMM_EXIT_GENFAIL 5
41 
42 /*
43 #define pmm_timersub(a, b, result) { \
44  do { \
45  (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
46  (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
47  if ((result)->tv_usec < 0) { \
48  --(result)->tv_sec; \
49  (result)->tv_usec += 1000000; \
50  } \
51  } while (0)
52 }
53 */
54 //
55 //#define pmm_rusagesub(a, b, result)
56 // do {
57 // pmm_timersub((a)->ru_utime, (b)->ru_utime, (result)->ru_utime);
58 // pmm_timersub((a)->ru_stime, (b)->ru_stime, (result)->ru_stime);
59 // (result)->ru_maxrss = (a)->ru_maxrss;
60 // (result)->ru_ixrss = (a)->ru_ixrss;
61 // (result)->ru_isrss = (a)->ru_isrss;
62 // ()
63 // }
64 
65 void pmm_timer_init(long long complexity);
66 void pmm_timer_destroy();
67 void pmm_timer_start();
68 void pmm_timer_stop();
69 void pmm_timer_result();
70 //void pmm_rusagesub(struct rusage a, struct rusage b, struct rusage result);
71 //
72 #endif /*PMM_UTIL_H_*/