summaryrefslogtreecommitdiff
path: root/lib/librte_timer
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2014-05-02 16:42:56 -0700
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-05-16 16:02:55 +0200
commit591a9d7985c1230652d9f7ea1f9221e8c66ec188 (patch)
treeb040ceef0f3aa5905d814d7cf249af415a53891e /lib/librte_timer
parentc738c6a644e5a07fa98ede668775c08ec5321273 (diff)
downloaddpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.zip
dpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.tar.gz
dpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.tar.xz
add FILE argument to debug functions
The DPDK dump functions are useful for remote debugging of an applications. But when application runs as a daemon, stdout is typically routed to /dev/null. Instead change all these functions to take a stdio FILE * handle instead. An application can then use open_memstream() to capture the output. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> [Thomas: fix quota_watermark example] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'lib/librte_timer')
-rwxr-xr-xlib/librte_timer/rte_timer.c14
-rwxr-xr-xlib/librte_timer/rte_timer.h6
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index a3d5cca..884ee0e 100755
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -582,7 +582,7 @@ done:
}
/* dump statistics about timers */
-void rte_timer_dump_stats(void)
+void rte_timer_dump_stats(FILE *f)
{
#ifdef RTE_LIBRTE_TIMER_DEBUG
struct rte_timer_debug_stats sum;
@@ -595,12 +595,12 @@ void rte_timer_dump_stats(void)
sum.manage += priv_timer[lcore_id].stats.manage;
sum.pending += priv_timer[lcore_id].stats.pending;
}
- printf("Timer statistics:\n");
- printf(" reset = %"PRIu64"\n", sum.reset);
- printf(" stop = %"PRIu64"\n", sum.stop);
- printf(" manage = %"PRIu64"\n", sum.manage);
- printf(" pending = %"PRIu64"\n", sum.pending);
+ fprintf(f, "Timer statistics:\n");
+ fprintf(f, " reset = %"PRIu64"\n", sum.reset);
+ fprintf(f, " stop = %"PRIu64"\n", sum.stop);
+ fprintf(f, " manage = %"PRIu64"\n", sum.manage);
+ fprintf(f, " pending = %"PRIu64"\n", sum.pending);
#else
- printf("No timer statistics, RTE_LIBRTE_TIMER_DEBUG is disabled\n");
+ fprintf(f, "No timer statistics, RTE_LIBRTE_TIMER_DEBUG is disabled\n");
#endif
}
diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h
index c5f936b..70f0573 100755
--- a/lib/librte_timer/rte_timer.h
+++ b/lib/librte_timer/rte_timer.h
@@ -63,6 +63,7 @@
* design of this library.
*/
+#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
@@ -321,8 +322,11 @@ void rte_timer_manage(void);
/**
* Dump statistics about timers.
+ *
+ * @param f
+ * A pointer to a file for output
*/
-void rte_timer_dump_stats(void);
+void rte_timer_dump_stats(FILE *f);
#ifdef __cplusplus
}