[PATCH 11/16] dynamic_debug: print ram usage by ddebug tables if verbose

From: jim . cromie
Date: Sun Mar 25 2012 - 19:28:26 EST


From: Jim Cromie <jim.cromie@xxxxxxxxx>

Print ram usage of dynamic-debug so user knows cost of enabling
CONFIG_DYNAMIC_DEBUG. Only counts cost of pr_debug in builtins, not
those in loadable modules.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
---
lib/dynamic_debug.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 5f0d31f..38bd4d66 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -970,7 +970,7 @@ static int __init dynamic_debug_init(void)
const char *modname = NULL;
char *cmdline;
int ret = 0;
- int n = 0;
+ int n = 0, entries = 0, modct = 0;

if (__start___verbose == __stop___verbose) {
pr_warn("_ddebug table is empty in a "
@@ -981,7 +981,9 @@ static int __init dynamic_debug_init(void)
modname = iter->modname;
iter_start = iter;
for (; iter < __stop___verbose; iter++) {
+ entries++;
if (strcmp(modname, iter->modname)) {
+ modct++;
ret = ddebug_add_module(iter_start, n, modname);
if (ret)
goto out_err;
@@ -996,6 +998,9 @@ static int __init dynamic_debug_init(void)
goto out_err;

ddebug_init_success = 1;
+ vpr_info("%d modules, %d entries in ddebug tables, %d bytes used\n",
+ modct, entries, modct * sizeof(struct ddebug_table)
+ + __stop___verbose - __start___verbose);

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/