implement minimalistic talloc_report(); add 't' command on UART

This helps when debugging the firmware, as it shows the current
utliization of the 10-msgb-talloc pool.

Change-Id: Ib10c4396cd4c9c4a6257cf45886e367214787927
Related: OS#4251
This commit is contained in:
Harald Welte
2019-12-14 21:11:39 +01:00
parent 7c1d85eb4d
commit 63c9e1f402
3 changed files with 21 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*/
#include <stdint.h>
#include <stdio.h>
#include "talloc.h"
#include "trace.h"
@@ -76,6 +77,20 @@ int _talloc_free(void *ptr, const char *location)
return -1;
}
void talloc_report(const void *ptr, FILE *f)
{
unsigned int i;
fprintf(f, "talloc_report(): ");
for (i = 0; i < ARRAY_SIZE(msgb_inuse); i++) {
if (msgb_inuse[i])
fputc('X', f);
else
fputc('_', f);
}
fprintf(f, "\r\n");
}
void talloc_set_name_const(const void *ptr, const char *name)
{
/* do nothing */