source: git/Singular/omSingularConfig.h @ 00d2a4

spielwiese
Last change on this file since 00d2a4 was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*******************************************************************
2 *  File:    omSingularConfig.h
3 *  Purpose: declaration of External Config stuff for omalloc
4 *           This file is inlcuded by omDefaultConfig.h, i.e., at the the time
5 *           the omalloc library is built. Any changes to the default config
6 *           of omalloc should be done here (and, of course, you need to
7 *           rebuilt the library).
8 *  Author:  obachman@mathematik.uni-kl.de (Olaf Bachmann)
9 *  Created: 8/00
10 *******************************************************************/
11#ifndef OM_SINGULAR_CONFIG_H
12#define OM_SINGULAR_CONFIG_H
13
14#ifdef __cplusplus
15extern "C"
16{
17#endif
18
19#include <stdlib.h>
20#include <stdio.h>
21
22#define OM_MALLOC_HOOK(size)                OM_SINGULAR_HOOK
23#define OM_FREE_HOOK(size)                  OM_SINGULAR_HOOK
24#define OM_ALLOC_BINPAGE_HOOK               OM_SINGULAR_HOOK
25#define OM_FREE_BINPAGE_HOOK                OM_SINGULAR_HOOK
26
27#ifdef OM_ALLOC_SYSTEM_C
28int om_sing_opt_show_mem = 0;
29size_t om_sing_last_reported_size = 0;
30#else
31extern int om_sing_opt_show_mem;
32extern size_t om_sing_last_reported_size;
33#endif
34
35/* number of bytes for difference to report: every 1 MByte */
36#define SING_REPORT_THRESHOLD 1000*1024
37#define OM_SINGULAR_HOOK                                                        \
38do                                                                            \
39{                                                                             \
40  if (om_sing_opt_show_mem)                                                   \
41  {                                                                           \
42    size_t _current_bytes = om_Info.CurrentBytesFromMalloc +                  \
43                            (om_Info.UsedPages << LOG_BIT_SIZEOF_SYSTEM_PAGE);\
44    size_t _diff = (_current_bytes > om_sing_last_reported_size ?             \
45                   _current_bytes - om_sing_last_reported_size :              \
46                   om_sing_last_reported_size - _current_bytes);              \
47    if (_diff >= SING_REPORT_THRESHOLD)                                       \
48    {                                                                         \
49      fprintf(stdout, "[%ldk]", (long)(_current_bytes + 1023)/1024);                \
50      fflush(stdout);                                                         \
51      om_sing_last_reported_size = _current_bytes;                            \
52    }                                                                         \
53  }                                                                           \
54}                                                                             \
55while (0)
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif /* OM_SINGULAR_CONFIG_H */
Note: See TracBrowser for help on using the repository browser.