]> err.no Git - sope/blob - sope-mime/NGImap4/imTimeMacros.h
synced with latest additions and bumped framework versions
[sope] / sope-mime / NGImap4 / imTimeMacros.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 #if 0
22
23 #include <sys/time.h>
24
25 #define TIME_START(_timeDescription) \
26 { \
27   struct timeval tv; \
28   double ti; \
29   char *timeDescription; \
30   unsigned int vm, vm1; \
31   \
32   *(&vm) = 0; \
33   *(&ti) = 0; \
34   {\
35     NSAutoreleasePool *p__1; \
36     p__1 = [NSAutoreleasePool new]; \
37     vm = [[NSProcessInfo processInfo] virtualMemorySize]; \
38     [p__1 release];\
39   }\
40   timeDescription = _timeDescription; \
41   gettimeofday(&tv, NULL); \
42   ti =  (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0 ); \
43   fprintf(stderr, "{"); \
44
45
46 #define TIME_END gettimeofday(&tv, NULL); \
47   gettimeofday(&tv, NULL); \
48   { \
49     NSAutoreleasePool *p__1 = [NSAutoreleasePool new]; \
50     vm1 = [[NSProcessInfo processInfo] virtualMemorySize]; \
51     [p__1 release]; \
52   }; \
53   ti = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0) - ti; \
54   fprintf(stderr,\
55           "}%s: <%s> : time needed: %4.4fs memory wasted %d absolut"\
56           " %d\n", __PRETTY_FUNCTION__, timeDescription, \
57           ti < 0.0 ? -1.0 : ti, vm1 - vm, vm1); \
58 }
59
60 #else
61
62 #define TIME_START(_timeDescription)
63
64 #define TIME_END
65
66 #endif