Skip to content

Commit 4107692

Browse files
jimcgregkh
authored andcommitted
dynamic_debug: print ram usage by ddebug tables if verbose
Print ram usage of dynamic-debug tables and verbose section so user knows cost of enabling CONFIG_DYNAMIC_DEBUG. This only counts the size of the _ddebug tables for builtins and the __verbose section that they refer to, not those used in loadable modules. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent af44239 commit 4107692

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎lib/dynamic_debug.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,8 @@ static int __init dynamic_debug_init(void)
970970
const char *modname = NULL;
971971
char *cmdline;
972972
int ret = 0;
973-
int n = 0;
973+
int n = 0, entries = 0, modct = 0;
974+
int verbose_bytes = 0;
974975

975976
if (__start___verbose == __stop___verbose) {
976977
pr_warn("_ddebug table is empty in a "
@@ -981,7 +982,12 @@ static int __init dynamic_debug_init(void)
981982
modname = iter->modname;
982983
iter_start = iter;
983984
for (; iter < __stop___verbose; iter++) {
985+
entries++;
986+
verbose_bytes += strlen(iter->modname) + strlen(iter->function)
987+
+ strlen(iter->filename) + strlen(iter->format);
988+
984989
if (strcmp(modname, iter->modname)) {
990+
modct++;
985991
ret = ddebug_add_module(iter_start, n, modname);
986992
if (ret)
987993
goto out_err;
@@ -996,6 +1002,10 @@ static int __init dynamic_debug_init(void)
9961002
goto out_err;
9971003

9981004
ddebug_init_success = 1;
1005+
vpr_info("%d modules, %d entries and %d bytes in ddebug tables,"
1006+
" %d bytes in (readonly) verbose section\n",
1007+
modct, entries, (int)( modct * sizeof(struct ddebug_table)),
1008+
verbose_bytes + (int)(__stop___verbose - __start___verbose));
9991009

10001010
/* apply ddebug_query boot param, dont unload tables on err */
10011011
if (ddebug_setup_string[0] != '\0') {

0 commit comments

Comments
 (0)