File tree Expand file tree Collapse file tree 5 files changed +30
-33
lines changed Expand file tree Collapse file tree 5 files changed +30
-33
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,13 @@ static __inline__ void atomic_dec(atomic_t *v)
212
212
213
213
#endif
214
214
215
+ #if defined(NO_ATOMIC_OPS ) && defined(HAVE_STDATOMIC )
216
+ #undef NO_ATOMIC_OPS
217
+ #include <stdatomic.h>
218
+
219
+ typedef _Atomic (unsigned long ) atomic_t ;
220
+ #else
221
+
215
222
/* C11 stdatomics wrappers */
216
223
#define atomic_init (a , v ) atomic_set(a, v)
217
224
#define atomic_store (a , v ) atomic_set(a, v)
@@ -221,5 +228,6 @@ static __inline__ void atomic_dec(atomic_t *v)
221
228
atomic_add(v, a);\
222
229
else \
223
230
atomic_sub(-(v), a);
231
+ #endif
224
232
225
233
#endif
Original file line number Diff line number Diff line change @@ -39,6 +39,16 @@ extern void *rpm_block;
39
39
#define INLINE_ALLOC
40
40
#endif
41
41
42
+ enum osips_mm {
43
+ MM_NONE ,
44
+ MM_F_MALLOC ,
45
+ MM_Q_MALLOC ,
46
+ MM_HP_MALLOC ,
47
+ MM_F_MALLOC_DBG ,
48
+ MM_Q_MALLOC_DBG ,
49
+ MM_HP_MALLOC_DBG ,
50
+ };
51
+
42
52
#if defined F_MALLOC
43
53
#include "f_malloc.h"
44
54
#endif
@@ -56,16 +66,6 @@ extern char *mem_warming_pattern_file;
56
66
extern int mem_warming_percentage ;
57
67
extern enum osips_mm mem_allocator ;
58
68
59
- enum osips_mm {
60
- MM_NONE ,
61
- MM_F_MALLOC ,
62
- MM_Q_MALLOC ,
63
- MM_HP_MALLOC ,
64
- MM_F_MALLOC_DBG ,
65
- MM_Q_MALLOC_DBG ,
66
- MM_HP_MALLOC_DBG ,
67
- };
68
-
69
69
/* returns -1 if @mm_name is unrecognized */
70
70
int set_global_mm (const char * mm_name );
71
71
Original file line number Diff line number Diff line change 26
26
27
27
#include <sys/time.h>
28
28
29
- #include "../statistics.h"
30
29
#include "../config.h"
31
30
#include "../globals.h"
32
31
#include "common.h"
@@ -40,15 +39,6 @@ struct hp_frag;
40
39
struct hp_frag_lnk ;
41
40
struct hp_block ;
42
41
43
- #ifndef HP_MALLOC_FAST_STATS
44
- extern stat_var * shm_used ;
45
- extern stat_var * shm_rused ;
46
- extern stat_var * shm_frags ;
47
- #endif
48
- extern stat_var * rpm_used ;
49
- extern stat_var * rpm_rused ;
50
- extern stat_var * rpm_frags ;
51
-
52
42
#include "hp_malloc_stats.h"
53
43
#include "meminfo.h"
54
44
@@ -71,6 +61,17 @@ extern stat_var *rpm_frags;
71
61
72
62
#define HP_TOTAL_HASH_SIZE (HP_HASH_SIZE + HP_EXTRA_HASH_SIZE)
73
63
64
+ #include "../statistics.h"
65
+
66
+ #ifndef HP_MALLOC_FAST_STATS
67
+ extern stat_var * shm_used ;
68
+ extern stat_var * shm_rused ;
69
+ extern stat_var * shm_frags ;
70
+ #endif
71
+ extern stat_var * rpm_used ;
72
+ extern stat_var * rpm_rused ;
73
+ extern stat_var * rpm_frags ;
74
+
74
75
/* get the fragment which corresponds to a pointer */
75
76
#define HP_FRAG (p ) \
76
77
((struct hp_frag *)(p) - 1)
Original file line number Diff line number Diff line change 34
34
* \brief Statistics support
35
35
*/
36
36
37
- #ifdef HAVE_STDATOMIC
38
- #include <stdatomic.h>
39
- #else
40
- #include "atomic.h"
41
- #endif
42
37
#include <string.h>
43
38
39
+ #include "atomic.h"
44
40
#include "mem/shm_mem.h"
45
41
#include "mem/rpm_mem.h"
46
42
#include "mi/mi.h"
Original file line number Diff line number Diff line change 34
34
#ifndef _STATISTICS_H_
35
35
#define _STATISTICS_H_
36
36
37
- #ifdef HAVE_STDATOMIC
38
- #include <stdatomic.h>
39
- #else
40
37
#include "atomic.h"
41
- #endif
42
38
43
39
#include "hash_func.h"
44
40
59
55
#ifdef NO_ATOMIC_OPS
60
56
typedef unsigned int stat_val ;
61
57
#else
62
- # ifdef HAVE_STDATOMIC
63
- typedef _Atomic (unsigned long ) stat_val ;
64
- # else
65
58
typedef atomic_t stat_val ;
66
- # endif
67
59
#endif
68
60
69
61
typedef unsigned long (* stat_function )(void * );
You can’t perform that action at this time.
0 commit comments