Commit 41076927 authored by Jim Cromie's avatar Jim Cromie Committed by Greg Kroah-Hartman

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: default avatarJim Cromie <jim.cromie@gmail.com>
Acked-by: default avatarJason Baron <jbaron@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent af442399
...@@ -970,7 +970,8 @@ static int __init dynamic_debug_init(void) ...@@ -970,7 +970,8 @@ static int __init dynamic_debug_init(void)
const char *modname = NULL; const char *modname = NULL;
char *cmdline; char *cmdline;
int ret = 0; int ret = 0;
int n = 0; int n = 0, entries = 0, modct = 0;
int verbose_bytes = 0;
if (__start___verbose == __stop___verbose) { if (__start___verbose == __stop___verbose) {
pr_warn("_ddebug table is empty in a " pr_warn("_ddebug table is empty in a "
...@@ -981,7 +982,12 @@ static int __init dynamic_debug_init(void) ...@@ -981,7 +982,12 @@ static int __init dynamic_debug_init(void)
modname = iter->modname; modname = iter->modname;
iter_start = iter; iter_start = iter;
for (; iter < __stop___verbose; iter++) { for (; iter < __stop___verbose; iter++) {
entries++;
verbose_bytes += strlen(iter->modname) + strlen(iter->function)
+ strlen(iter->filename) + strlen(iter->format);
if (strcmp(modname, iter->modname)) { if (strcmp(modname, iter->modname)) {
modct++;
ret = ddebug_add_module(iter_start, n, modname); ret = ddebug_add_module(iter_start, n, modname);
if (ret) if (ret)
goto out_err; goto out_err;
...@@ -996,6 +1002,10 @@ static int __init dynamic_debug_init(void) ...@@ -996,6 +1002,10 @@ static int __init dynamic_debug_init(void)
goto out_err; goto out_err;
ddebug_init_success = 1; ddebug_init_success = 1;
vpr_info("%d modules, %d entries and %d bytes in ddebug tables,"
" %d bytes in (readonly) verbose section\n",
modct, entries, (int)( modct * sizeof(struct ddebug_table)),
verbose_bytes + (int)(__stop___verbose - __start___verbose));
/* apply ddebug_query boot param, dont unload tables on err */ /* apply ddebug_query boot param, dont unload tables on err */
if (ddebug_setup_string[0] != '\0') { if (ddebug_setup_string[0] != '\0') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment