8000 Corrected #ifdef's for UMM_STATS/UMM_STATS_FULL · esp8266/Arduino@57b65ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 57b65ab

Browse files
committed
Corrected #ifdef's for UMM_STATS/UMM_STATS_FULL
1 parent d7363e0 commit 57b65ab

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

cores/esp8266/umm_malloc/umm_info.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void *umm_info( void *ptr, int force ) {
144144

145145
DBGLOG_FORCE( force, "+--------------------------------------------------------------+\n" );
146146

147-
#ifdef UMM_STATS
147+
#if defined(UMM_STATS) || defined(UMM_STATS_FULL)
148148
if (ummHeapInfo.freeBlocks == ummStats.free_blocks) {
149149
DBGLOG_FORCE( force, "heap info Free blocks and heap statistics Free blocks match.\n");
150150
} else {
@@ -158,14 +158,14 @@ void *umm_info( void *ptr, int force ) {
158158
DBGLOG_FORCE( force, " Free Space %5u\n", ummStats.free_blocks * sizeof(umm_block));
159159
#if defined(UMM_STATS_FULL)
160160
DBGLOG_FORCE( force, " Low Watermark %5u\n", ummStats.free_blocks_min * sizeof(umm_block));
161-
DBGLOG_FORCE( force, " Low Watermark RSZ %5u\n", ummStats.free_blocks_isr_min * sizeof(umm_block));
161+
DBGLOG_FORCE( force, " Low Watermark ISR %5u\n", ummStats.free_blocks_isr_min * sizeof(umm_block));
162162
DBGLOG_FORCE( force, " MAX Alloc Request %5u\n", ummStats.alloc_max_size);
163163
DBGLOG_FORCE( force, " OOM Count %5u\n", ummStats.oom_count);
164164
#endif
165165
DBGLOG_FORCE( force, " Size of umm_block %5u\n", sizeof(umm_block));
166+
DBGLOG_FORCE( force, "+--------------------------------------------------------------+\n" );
166167
#endif
167168

168-
DBGLOG_FORCE( force, "+--------------------------------------------------------------+\n" );
169169

170170
/* Release the critical section... */
171171
UMM_CRITICAL_EXIT(id_info);
@@ -194,7 +194,7 @@ size_t umm_block_size( void ) {
194194
}
195195
#endif
196196

197-
#ifdef UMM_STATS
197+
#if defined(UMM_STATS) || defined(UMM_STATS_FULL)
198198

199199
UMM_STATISTICS ummStats;
200200

cores/esp8266/umm_malloc/umm_malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ void umm_init( void ) {
216216
/* index of the latest `umm_block` */
217217
const unsigned short int block_last = UMM_NUMBLOCKS - 1;
218218

219-
#ifdef UMM_STATS
220219
/* init ummStats.free_blocks */
220+
#if defined(UMM_STATS) || defined(UMM_STATS_FULL)
221221
#if defined(UMM_STATS_FULL)
222222
ummStats.free_blocks_min =
223223
ummStats.free_blocks_isr_min =

cores/esp8266/umm_malloc/umm_malloc_cfg.h

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,14 @@ extern char _heap_start[];
133133
* most.
134134
*/
135135
/*
136-
#define UMM_STATS_FULL
137136
*/
138137
#define UMM_STATS
139138

140-
#ifdef UMM_STATS
139+
#ifdef DEBUG_ESP_PORT
140+
#define UMM_STATS_FULL
141+
#endif
142+
143+
#if defined(UMM_STATS) || defined(UMM_STATS_FULL)
141144

142145
typedef struct UMM_STATISTICS_t {
143146
unsigned short int free_blocks;
@@ -157,11 +160,31 @@ size_t umm_free_heap_size_lw( void );
157160

158161
#define STATS__FREE_BLOCKS_UPDATE(s) ummStats.free_blocks += (s)
159162

163+
#else // not UMM_STATS or UMM_STATS_FULL
164+
#define STATS__FREE_BLOCKS_UPDATE(s) (void)(s)
165+
#endif
166+
160167
#ifdef UMM_STATS_FULL
161168
#define STATS__FREE_BLOCKS_MIN() \
162169
if (ummStats.free_blocks < ummStats.free_blocks_min) \
163170
ummStats.free_blocks_min = ummStats.free_blocks
164171

172+
//C TODO: Needs a new name. ISR is too specific to our use. For upstream
173+
//C needs to indicate it is related to a temporary low, created during a
174+
//C realloc that includes memmove/copy.
175+
#define STATS__FREE_BLOCKS_ISR_MIN() \
176+
if (ummStats.free_blocks < ummStats.free_blocks_isr_min) \
177+
ummStats.free_blocks_isr_min = ummStats.free_blocks
178+
179+
#define STATS__ALLOC_REQUEST(tag, s) \
180+
{ \
181+
ummStats.tag##_count += 1; \
182+
if (ummStats.alloc_max_size < s) \
183+
ummStats.alloc_max_size = s; \
184+
}
185+
186+
#define STATS__OOM_UPDATE() ummStats.oom_count += 1
187+
165188
static inline size_t ICACHE_FLASH_ATTR umm_free_heap_size_lw_min( void ) {
166189
return (size_t)ummStats.free_blocks_min * umm_block_size();
167190
}
@@ -195,28 +218,7 @@ static inline size_t ICACHE_FLASH_ATTR umm_get_oom_count( void ) {
195218
return ummStats.oom_count;
196219
}
197220

198-
//C TODO: Needs a new name. ISR is too specific to our use. For upstream
199-
//C needs to indicate it is related to a temporary low, created during a
200-
//C realloc that includes memmove/copy.
201-
#define STATS__FREE_BLOCKS_ISR_MIN() \
202-
if (ummStats.free_blocks < ummStats.free_blocks_isr_min) \
6D4E
203-
ummStats.free_blocks_isr_min = ummStats.free_blocks
204-
205-
#define STATS__ALLOC_REQUEST(tag, s) \
206-
{ \
207-
ummStats.tag##_count += 1; \
208-
if (ummStats.alloc_max_size < s) \
209-
ummStats.alloc_max_size = s; \
210-
}
211-
212-
#define STATS__OOM_UPDATE() ummStats.oom_count += 1
213-
#endif
214-
215-
#else // ! UMM_STATS
216-
#define STATS__FREE_BLOCKS_UPDATE(s) (void)(s)
217-
#endif
218-
219-
#if !defined(UMM_STATS_FULL)
221+
#else // Not UMM_STATS_FULL
220222
#define STATS__FREE_BLOCKS_MIN() (void)0
221223
#define STATS__FREE_BLOCKS_ISR_MIN() (void)0
222224
#define STATS__ALLOC_REQUEST(tag, s) (void)(s)

0 commit comments

Comments
 (0)
0