Log memory usage diagnostics, fix test_not, add ability to compile in debug mode
This commit is contained in:
parent
b6cb84df15
commit
3504bde301
5 changed files with 44 additions and 11 deletions
|
|
@ -54,11 +54,17 @@
|
|||
#define g_check_parse_ok(parser, input, inp_len, result) { \
|
||||
parse_result_t *res = parse(parser, (const uint8_t*)input, inp_len); \
|
||||
if (!res) { \
|
||||
g_test_message("Parse failed on line %d", __LINE__); \
|
||||
g_test_message("Parse failed on line %d", __LINE__); \
|
||||
g_test_fail(); \
|
||||
} else { \
|
||||
char* cres = write_result_unamb(res->ast); \
|
||||
g_check_string(cres, ==, result); \
|
||||
arena_stats_t stats; \
|
||||
allocator_stats(res->arena, &stats); \
|
||||
g_test_message("Parse used %zd bytes, wasted %zd bytes. " \
|
||||
"Inefficiency: %5f%%", \
|
||||
stats.used, stats.wasted, \
|
||||
stats.wasted * 100. / (stats.used+stats.wasted)); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue