summaryrefslogtreecommitdiffstats
path: root/runtime/print.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-06-18 07:24:42 +0000
committerhunt <hunt>2005-06-18 07:24:42 +0000
commite5d2abb56ca57a613e4ef9398a6499190b2265be (patch)
tree083465047d73bc498f2278d2eb3dc8514b455ad3 /runtime/print.c
parentef0e92b0335077884edd5ac9997a203bec1839b0 (diff)
downloadsystemtap-steved-e5d2abb56ca57a613e4ef9398a6499190b2265be.tar.gz
systemtap-steved-e5d2abb56ca57a613e4ef9398a6499190b2265be.tar.xz
systemtap-steved-e5d2abb56ca57a613e4ef9398a6499190b2265be.zip
2005-06-18 Martin Hunt <hunt@redhat.com>
* counter.c: New file. Counter aggregations. * stat.c: New file. Stat aggregations. * stat.h: Header file for stats. * map-int.c: New file. Support for int64 values. * map-stat.c: New file. Support for stat values. * map-str.c: New file. Support for string values. * map-values.c: Now just includes the necessary map-*.c files. * stat-common.c: New file. Stats stuff common to Stats and maps containing stats. * Doxyfile: Bumped version to 0.6. * README: Renamed README.doc and reorganized.
Diffstat (limited to 'runtime/print.c')
-rw-r--r--runtime/print.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/runtime/print.c b/runtime/print.c
index e7e97d27..3c09e105 100644
--- a/runtime/print.c
+++ b/runtime/print.c
@@ -2,12 +2,14 @@
#define _PRINT_C_
#include <linux/config.h>
-
+#include "string.h"
#include "io.c"
/** @file print.c
- * @addtogroup print Print Buffer
- * Print Buffer Functions.
+ * Printing Functions.
+ */
+
+/** @addtogroup print Print Functions
* The print buffer is for collecting output to send to the user daemon.
* This is a per-cpu static buffer. The buffer is sent when
* _stp_print_flush() is called.
@@ -127,6 +129,38 @@ void _stp_print_flush (void)
*/
#define _stp_print_string(str) _stp_string_cat_string(_stp_stdout,str)
+/* This function is used when printing maps or stats. */
+/* Probably belongs elsewhere, but is here for now. */
+/* It takes a format specification like those used for */
+/* printing maps and stats. It prints chars until it sees */
+/* a special format char (beginning with '%'. Then it */
+/* returns a pointer to that. */
+static char *next_fmt(char *fmt, int *num)
+{
+ char *f = fmt;
+ int in_fmt = 0;
+ dbug ("next_fmt %s\n", fmt);
+ *num = 0;
+ while (*f) {
+ if (in_fmt) {
+ if (*f == '%') {
+ _stp_string_cat_char(_stp_stdout,'%');
+ in_fmt = 0;
+ } else if (*f > '0' && *f <= '9') {
+ *num = *f - '0';
+ f++;
+ return f;
+ } else
+ return f;
+ } else if (*f == '%')
+ in_fmt = 1;
+ else
+ _stp_string_cat_char(_stp_stdout,*f);
+ f++;
+ }
+ return f;
+}
+
/** Write a String or C string into the print buffer.
* This macro selects the proper function to call.
* @param str A String or C string (char *)