public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH broken] PR10257: Add support for sprint[ln](@hist_*).
@ 2009-10-10 22:26 Przemyslaw Pawelczyk
  2009-10-12 20:53 ` Josh Stone
  2009-10-13 13:12 ` [PATCH] " Przemyslaw Pawelczyk
  0 siblings, 2 replies; 7+ messages in thread
From: Przemyslaw Pawelczyk @ 2009-10-10 22:26 UTC (permalink / raw)
  To: systemtap

Currently this patch doesn't work, because tmpvar added in sprint case
in c_unparser::visit_print_format() doesn't increase number of __tmp
variables available in struct probe_XYZ_locals that is generated by
c_unparser::emit_common_header(). I certainly missed sth, but what?
Any help will be appreciated. Reviews are also welcomed.

$ stap -e 'global f; probe begin { f <<< 1 }
           probe end { a = sprint(@hist_log(f)); println(a) }'
/tmp/stapKpTfn5/stap_24131.c: In function ‘probe_1846’:
/tmp/stapKpTfn5/stap_24131.c:209: error: ‘struct probe_1846_locals’ has
no member named ‘__tmp4’
/tmp/stapKpTfn5/stap_24131.c:210: error: ‘struct probe_1846_locals’ has
no member named ‘__tmp4’

* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Add _stp_stat_print_histogram_buf and
  reprint_buf functions.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
---
 parse.cxx             |    3 +-
 runtime/stat-common.c |  171 +++++++++++++++++++++++++++++++++++++++++++++++++
 translate.cxx         |   14 ++++-
 3 files changed, 185 insertions(+), 3 deletions(-)

diff --git a/parse.cxx b/parse.cxx
index b88ef7f..025824e 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -2422,7 +2422,8 @@ parser::parse_symbol ()
 	  fmt->print_char = pf_char;
 
 	  expect_op("(");
-	  if ((name == "print" || name == "println") &&
+	  if ((name == "print" || name == "println" ||
+	       name == "sprint" || name == "sprintln") &&
 	      (peek_kw("@hist_linear") || peek_kw("@hist_log")))
 	    {
 	      // We have a special case where we recognize
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index 7dabe70..df5522f 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -61,6 +61,16 @@ static void reprint (int num, char *s)
 	}
 }
 
+static int reprint_buf(char *buf, size_t size, int num, char *s)
+{
+	char *cur_buf = buf;
+	while (num > 0) {
+		cur_buf += _stp_snprintf(cur_buf, buf + size - cur_buf, s);
+		num--;
+	}
+	return cur_buf - buf;
+}
+
 /* Given a bucket number for a log histogram, return the value. */
 static int64_t _stp_bucket_to_val(int num)
 {
@@ -299,6 +309,167 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 	_stp_print_flush();
 }
 
+static void _stp_stat_print_histogram_buf(char *buf, Hist st, stat *sd)
+{
+	int scale, i, j, val_space, cnt_space;
+	int low_bucket = -1, high_bucket = 0, over = 0, under = 0;
+	int64_t val, v, max = 0;
+        int eliding = 0;
+	char *cur_buf = buf;
+
+	if (st->type != HIST_LOG && st->type != HIST_LINEAR)
+		return;
+
+	/* Get the maximum value, for scaling. Also calculate the low
+	   and high values to bound the reporting range. */
+	for (i = 0; i < st->buckets; i++) {
+		if (sd->histogram[i] > 0 && low_bucket == -1)
+			low_bucket = i;
+		if (sd->histogram[i] > 0)
+			high_bucket = i;
+		if (sd->histogram[i] > max)
+			max = sd->histogram[i];
+	}
+
+	/* Touch up the bucket margin to show up to two zero-slots on
+	   either side of the data range, seems aesthetically pleasant. */
+	for (i = 0; i < 2; i++) {
+		if (st->type == HIST_LOG) {
+			/* For log histograms, don't go negative */
+			/* unless there are negative values. */
+			if (low_bucket != HIST_LOG_BUCKET0 && low_bucket > 0)
+				low_bucket--;
+		} else {
+			if (low_bucket > 0)
+				low_bucket--;
+		}
+		if (high_bucket < (st->buckets-1))
+			high_bucket++;
+	}
+	if (st->type == HIST_LINEAR) {
+		/* Don't include under or overflow if they are 0. */
+		if (low_bucket == 0 && sd->histogram[0] == 0)
+			low_bucket++;
+		if (high_bucket == st->buckets-1 && sd->histogram[high_bucket] == 0)
+			high_bucket--;
+		if (low_bucket == 0)
+			under = 1;
+		if (high_bucket == st->buckets-1)
+			over = 1;
+	}
+
+	if (max <= HIST_WIDTH)
+		scale = 1;
+	else {
+		int64_t tmp = max;
+		int rem = do_div(tmp, HIST_WIDTH);
+		scale = tmp;
+		if (rem) scale++;
+	}
+
+	/* count space */
+	cnt_space = needed_space(max);
+
+	/* Compute value space */
+	if (st->type == HIST_LINEAR) {
+		i = needed_space(st->start) + under;
+		val_space = needed_space(st->start +  st->interval * high_bucket) + over;
+	} else {
+		i = needed_space(_stp_bucket_to_val(high_bucket));
+		val_space = needed_space(_stp_bucket_to_val(low_bucket));
+	}
+	if (i > val_space)
+		val_space = i;
+
+
+	/* print header */
+	j = 0;
+	if (val_space > 5)		/* 5 = sizeof("value") */
+		j = val_space - 5;
+	else
+		val_space = 5;
+	for ( i = 0; i < j; i++)
+		cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, " ");
+	cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "value |");
+	cur_buf += reprint_buf(cur_buf, buf + MAXSTRINGLEN - cur_buf, HIST_WIDTH, "-");
+	cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, " count\n");
+
+	eliding = 0;
+	for (i = low_bucket;  i <= high_bucket; i++) {
+		int over_under = 0;
+
+		/* Elide consecutive zero buckets.  Specifically, skip
+		   this row if it is zero and some of its nearest
+		   neighbours are also zero. Don't elide zero buckets
+		   if HIST_ELISION is negative */
+		if ((long)HIST_ELISION >= 0) {
+			int k, elide = 1;
+			/* Can't elide more than the total # of buckets */
+			int max_elide = min_t(long, HIST_ELISION, st->buckets);
+			int min_bucket = low_bucket;
+			int max_bucket = high_bucket;
+
+			if (i - max_elide > min_bucket)
+				min_bucket = i - max_elide;
+			if (i + max_elide < max_bucket)
+				max_bucket = i + max_elide;
+			for (k = min_bucket; k <= max_bucket; k++) {
+				if (sd->histogram[k] != 0)
+					elide = 0;
+			}
+			if (elide) {
+				eliding = 1;
+				continue;
+			}
+
+			/* State change: we have elided some rows, but now are
+			   about to print a new one.  So let's print a mark on
+			   the vertical axis to represent the missing rows. */
+			if (eliding) {
+				cur_buf += reprint_buf(cur_buf, buf + MAXSTRINGLEN - cur_buf, val_space, " ");
+				cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, " ~\n");
+				eliding = 0;
+			}
+		}
+
+		if (st->type == HIST_LINEAR) {
+			if (i == 0) {
+				/* underflow */
+				val = st->start;
+				over_under = 1;
+			} else if (i == st->buckets-1) {
+				/* overflow */
+				val = st->start + (i - 2) * st->interval;
+				over_under = 1;
+			} else
+				val = st->start + (i - 1) * st->interval;
+		} else
+			val = _stp_bucket_to_val(i);
+
+		cur_buf += reprint_buf(cur_buf, buf + MAXSTRINGLEN - cur_buf, val_space - needed_space(val) - over_under, " ");
+
+		if (over_under) {
+			if (i == 0)
+				cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "<%lld", val);
+			else if (i == st->buckets-1)
+				cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, ">%lld", val);
+			else
+				cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "%lld", val);
+		} else
+			cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "%lld", val);
+		cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, " |");
+
+		/* v = s->histogram[i] / scale; */
+		v = sd->histogram[i];
+		do_div(v, scale);
+
+		cur_buf += reprint_buf(cur_buf, buf + MAXSTRINGLEN - cur_buf, v, "@");
+		cur_buf += reprint_buf(cur_buf, buf + MAXSTRINGLEN - cur_buf, HIST_WIDTH - v + 1 + cnt_space - needed_space(sd->histogram[i]), " ");
+		cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "%lld\n", sd->histogram[i]);
+	}
+	cur_buf += _stp_snprintf(cur_buf, buf + MAXSTRINGLEN - cur_buf, "\n");
+}
+
 static void __stp_stat_add (Hist st, stat *sd, int64_t val)
 {
 	int n;
diff --git a/translate.cxx b/translate.cxx
index a3246d9..5470190 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4142,8 +4142,18 @@ c_unparser::visit_print_format (print_format* e)
 	o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";";
 	o->newline() << "goto out;";
         o->newline(-1) << "} else";
-	o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");";
-        o->indent(-1);
+        if (e->print_to_stream)
+          {
+            o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");";
+            o->indent(-1);
+          }
+        else
+          {
+            exp_type ty = pe_string;
+            tmpvar res = gensym (ty);
+            o->newline(1) << "_stp_stat_print_histogram_buf (" << res.value() << ", " << v->hist() << ", " << agg.value() << ");";
+            o->newline(-1) << res.value() << ";";
+          }
       }
 
       delete v;
-- 
1.5.6.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH broken] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-10 22:26 [PATCH broken] PR10257: Add support for sprint[ln](@hist_*) Przemyslaw Pawelczyk
@ 2009-10-12 20:53 ` Josh Stone
  2009-10-12 21:29   ` Przemysław Pawełczyk
  2009-10-13 13:12 ` [PATCH] " Przemyslaw Pawelczyk
  1 sibling, 1 reply; 7+ messages in thread
From: Josh Stone @ 2009-10-12 20:53 UTC (permalink / raw)
  To: Przemyslaw Pawelczyk; +Cc: systemtap

First, I'm skeptical of how useful sprint for histograms will be -- it 
seems like it will quite easily exceed MAXSTRINGLEN.  I'm pretty sure 
this is why we haven't already enabled it.  Did you have some specific 
use in mind?

On 10/10/2009 02:51 PM, Przemyslaw Pawelczyk wrote:
> Currently this patch doesn't work, because tmpvar added in sprint case
> in c_unparser::visit_print_format() doesn't increase number of __tmp
> variables available in struct probe_XYZ_locals that is generated by
> c_unparser::emit_common_header(). I certainly missed sth, but what?
> Any help will be appreciated. Reviews are also welcomed.

There is also c_tmpcounter which needs to mirror the tmp allocations. 
This is a sort of pre-visitor which creates the tmps in the context struct.

> +static void _stp_stat_print_histogram_buf(char *buf, Hist st, stat *sd)

So much duplication with _stp_stat_print_histogram is not ok -- can you 
make one a function of the other?  It may help you to know that these 
are equivalent:

   _stp_printf(fmt, ...args...);
   _stp_snprintf(NULL, 0, fmt, ...args...);


Josh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH broken] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-12 20:53 ` Josh Stone
@ 2009-10-12 21:29   ` Przemysław Pawełczyk
  0 siblings, 0 replies; 7+ messages in thread
From: Przemysław Pawełczyk @ 2009-10-12 21:29 UTC (permalink / raw)
  To: Josh Stone; +Cc: systemtap

On Mon, Oct 12, 2009 at 22:53, Josh Stone <jistone@redhat.com> wrote:
> First, I'm skeptical of how useful sprint for histograms will be -- it seems
> like it will quite easily exceed MAXSTRINGLEN.  I'm pretty sure this is why
> we haven't already enabled it.  Did you have some specific use in mind?

Yes, I have, but it's tightly connected with PR10690 - statistics on
demand via procfs. Sometimes running stap scripts in daemon mode is
just more convenient.

> On 10/10/2009 02:51 PM, Przemyslaw Pawelczyk wrote:
>>
>> Currently this patch doesn't work, because tmpvar added in sprint case
>> in c_unparser::visit_print_format() doesn't increase number of __tmp
>> variables available in struct probe_XYZ_locals that is generated by
>> c_unparser::emit_common_header(). I certainly missed sth, but what?
>> Any help will be appreciated. Reviews are also welcomed.
>
> There is also c_tmpcounter which needs to mirror the tmp allocations. This
> is a sort of pre-visitor which creates the tmps in the context struct.

I see...

>
>> +static void _stp_stat_print_histogram_buf(char *buf, Hist st, stat *sd)
>
> So much duplication with _stp_stat_print_histogram is not ok -- can you make
> one a function of the other?  It may help you to know that these are
> equivalent:
>
>  _stp_printf(fmt, ...args...);
>  _stp_snprintf(NULL, 0, fmt, ...args...);

I'm an idiot, it's obvious. Still nobuf version will be then slightly
bloated with unnecessary code, but I agree that DRY-ness and
maintainability are more important here, so this trade-off is fully
acceptable. I'll send new patch later.

> Josh

Thank you for your help and review.

-- 
Przemysław Pawełczyk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-10 22:26 [PATCH broken] PR10257: Add support for sprint[ln](@hist_*) Przemyslaw Pawelczyk
  2009-10-12 20:53 ` Josh Stone
@ 2009-10-13 13:12 ` Przemyslaw Pawelczyk
  2009-10-14  2:24   ` Josh Stone
  1 sibling, 1 reply; 7+ messages in thread
From: Przemyslaw Pawelczyk @ 2009-10-13 13:12 UTC (permalink / raw)
  To: systemtap

* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Replace reprint with new reprint_buf, add more
  generic _stp_stat_print_histogram_buf and call it from the older one.
  Also correct some formatting issues.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
---
 parse.cxx             |    3 +-
 runtime/stat-common.c |   74 +++++++++++++++++++++++++++---------------------
 translate.cxx         |   22 +++++++++++++-
 3 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/parse.cxx b/parse.cxx
index 5b3506f..1496e9b 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -2422,7 +2422,8 @@ parser::parse_symbol ()
 	  fmt->print_char = pf_char;
 
 	  expect_op("(");
-	  if ((name == "print" || name == "println") &&
+	  if ((name == "print" || name == "println" ||
+	       name == "sprint" || name == "sprintln") &&
 	      (peek_kw("@hist_linear") || peek_kw("@hist_log")))
 	    {
 	      // We have a special case where we recognize
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index 7dabe70..db85c35 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -53,12 +53,15 @@ static int needed_space(int64_t v)
 	return space;
 }
 
-static void reprint (int num, char *s)
+static int reprint_buf(char *buf, size_t size, int num, char *s)
 {
+	char *cur_buf = buf, *fake = buf;
+	char **ptr = (buf == NULL ? &fake : &cur_buf);
 	while (num > 0) {
-		_stp_print(s);
+		*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, s);
 		num--;
 	}
+	return *ptr - buf;
 }
 
 /* Given a bucket number for a log histogram, return the value. */
@@ -138,12 +141,14 @@ static int _stp_val_to_bucket(int64_t val)
 #endif
 
 
-static void _stp_stat_print_histogram (Hist st, stat *sd)
+static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat *sd)
 {
 	int scale, i, j, val_space, cnt_space;
 	int low_bucket = -1, high_bucket = 0, over = 0, under = 0;
 	int64_t val, v, max = 0;
-        int eliding = 0;
+	int eliding = 0;
+	char *cur_buf = buf, *fake = buf;
+	char **ptr = (buf == NULL ? &fake : &cur_buf);
 
 	if (st->type != HIST_LOG && st->type != HIST_LINEAR)
 		return;
@@ -185,23 +190,23 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 		if (high_bucket == st->buckets-1)
 			over = 1;
 	}
-	
+
 	if (max <= HIST_WIDTH)
 		scale = 1;
 	else {
 		int64_t tmp = max;
-		int rem = do_div (tmp, HIST_WIDTH);
+		int rem = do_div(tmp, HIST_WIDTH);
 		scale = tmp;
 		if (rem) scale++;
 	}
 
 	/* count space */
-	cnt_space = needed_space (max);
+	cnt_space = needed_space(max);
 
 	/* Compute value space */
 	if (st->type == HIST_LINEAR) {
-		i = needed_space (st->start) + under;
-		val_space = needed_space (st->start +  st->interval * high_bucket) + over;
+		i = needed_space(st->start) + under;
+		val_space = needed_space(st->start +  st->interval * high_bucket) + over;
 	} else {
 		i = needed_space(_stp_bucket_to_val(high_bucket));
 		val_space = needed_space(_stp_bucket_to_val(low_bucket));
@@ -217,13 +222,13 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 	else
 		val_space = 5;
 	for ( i = 0; i < j; i++)
-		_stp_print(" ");
-	_stp_print("value |");
-	reprint (HIST_WIDTH, "-");
-	_stp_print(" count\n");
+		*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, " ");
+	*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "value |");
+	*ptr += reprint_buf(cur_buf, buf + size - cur_buf, HIST_WIDTH, "-");
+	*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, " count\n");
 
-	eliding=0;
-	for (i = low_bucket;  i <= high_bucket; i++) {
+	eliding = 0;
+	for (i = low_bucket; i <= high_bucket; i++) {
 		int over_under = 0;
 
 		/* Elide consecutive zero buckets.  Specifically, skip
@@ -231,7 +236,7 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 		   neighbours are also zero. Don't elide zero buckets
 		   if HIST_ELISION is negative */
 		if ((long)HIST_ELISION >= 0) {
-			int k, elide=1;
+			int k, elide = 1;
 			/* Can't elide more than the total # of buckets */
 			int max_elide = min_t(long, HIST_ELISION, st->buckets);
 			int min_bucket = low_bucket;
@@ -254,8 +259,8 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 			   about to print a new one.  So let's print a mark on
 			   the vertical axis to represent the missing rows. */
 			if (eliding) {
-				reprint (val_space, " ");
-				_stp_print(" ~\n");
+				*ptr += reprint_buf(cur_buf, buf + size - cur_buf, val_space, " ");
+				*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, " ~\n");
 				eliding = 0;
 			}
 		}
@@ -269,33 +274,38 @@ static void _stp_stat_print_histogram (Hist st, stat *sd)
 				/* overflow */
 				val = st->start + (i - 2) * st->interval;
 				over_under = 1;
-			} else				
+			} else
 				val = st->start + (i - 1) * st->interval;
 		} else
 			val = _stp_bucket_to_val(i);
 
-		reprint (val_space - needed_space(val) - over_under, " ");
+		*ptr += reprint_buf(cur_buf, buf + size - cur_buf, val_space - needed_space(val) - over_under, " ");
 
 		if (over_under) {
 			if (i == 0)
-				_stp_printf("<%lld", val);
+				*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "<%lld", val);
 			else if (i == st->buckets-1)
-				_stp_printf(">%lld", val);
+				*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, ">%lld", val);
 			else
-				_stp_printf("%lld", val);
+				*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "%lld", val);
 		} else
-			_stp_printf("%lld", val);
-		_stp_print(" |");
-		
+			*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "%lld", val);
+		*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, " |");
+
 		/* v = s->histogram[i] / scale; */
 		v = sd->histogram[i];
-		do_div (v, scale);
-		
-		reprint (v, "@");
-		reprint (HIST_WIDTH - v + 1 + cnt_space - needed_space(sd->histogram[i]), " ");
-		_stp_printf ("%lld\n", sd->histogram[i]);
+		do_div(v, scale);
+
+		*ptr += reprint_buf(cur_buf, buf + size - cur_buf, v, "@");
+		*ptr += reprint_buf(cur_buf, buf + size - cur_buf, HIST_WIDTH - v + 1 + cnt_space - needed_space(sd->histogram[i]), " ");
+		*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "%lld\n", sd->histogram[i]);
 	}
-	_stp_print_char('\n');
+	*ptr += _stp_snprintf(cur_buf, buf + size - cur_buf, "\n");
+}
+
+static void _stp_stat_print_histogram(Hist st, stat *sd)
+{
+	_stp_stat_print_histogram_buf(NULL, 0, st, sd);
 	_stp_print_flush();
 }
 
diff --git a/translate.cxx b/translate.cxx
index a3246d9..c2c030c 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4080,6 +4080,14 @@ c_tmpcounter::visit_print_format (print_format* e)
 	      arr->indexes[i]->visit(this);
 	    }
 	}
+
+      // And the result for sprint[ln](@hist_*)
+      if (!e->print_to_stream)
+        {
+          exp_type ty = pe_string;
+          tmpvar res = parent->gensym(ty);
+          res.declare(*parent);
+        }
     }
   else
     {
@@ -4142,8 +4150,18 @@ c_unparser::visit_print_format (print_format* e)
 	o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";";
 	o->newline() << "goto out;";
         o->newline(-1) << "} else";
-	o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");";
-        o->indent(-1);
+        if (e->print_to_stream)
+          {
+            o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");";
+            o->indent(-1);
+          }
+        else
+          {
+            exp_type ty = pe_string;
+            tmpvar res = gensym (ty);
+            o->newline(1) << "_stp_stat_print_histogram_buf (" << res.value() << ", MAXSTRINGLEN, " << v->hist() << ", " << agg.value() << ");";
+            o->newline(-1) << res.value() << ";";
+          }
       }
 
       delete v;
-- 
1.6.3.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-13 13:12 ` [PATCH] " Przemyslaw Pawelczyk
@ 2009-10-14  2:24   ` Josh Stone
  2009-10-14 10:03     ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Stone @ 2009-10-14  2:24 UTC (permalink / raw)
  To: Przemyslaw Pawelczyk; +Cc: systemtap

On 10/13/2009 05:44 AM, Przemyslaw Pawelczyk wrote:
> * parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
> * runtime/stat-common.c: Replace reprint with new reprint_buf, add more
>    generic _stp_stat_print_histogram_buf and call it from the older one.
>    Also correct some formatting issues.
> * translate.cxx (c_unparser::visit_print_format): Add sprint case.

I committed this patch, and then also did some refactoring of my own. 
Let me know if I broke it... :)

Josh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-14  2:24   ` Josh Stone
@ 2009-10-14 10:03     ` Mark Wielaard
  2009-10-14 23:45       ` Josh Stone
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2009-10-14 10:03 UTC (permalink / raw)
  To: Josh Stone; +Cc: Przemyslaw Pawelczyk, systemtap

Hi Josh,

On Tue, 2009-10-13 at 19:24 -0700, Josh Stone wrote:
> I committed this patch, and then also did some refactoring of my own. 
> Let me know if I broke it... :)

I am afraid something in your last cleanup broke some of the vars.exp
and uprobes.exp tests:
FAIL: uprobes -p5 (0)
FAIL: vars
FAIL: vars parms/locals

d5e178c1d6eb0e7c1a317b925687050aa1cb6c1b is first bad commit
commit d5e178c1d6eb0e7c1a317b925687050aa1cb6c1b
Author: Josh Stone <jistone@redhat.com>
Date:   Tue Oct 13 16:57:38 2009 -0700

    Consolidate print_format creation
    
    We almost had a factory in print_format::parse_print, so let's take
that
    the rest of the way.  This way we don't have so much duplication in
    initializing the print flags.
    
    * staptree.cxx (print_format::parse_print): Replaced with...
      (print_format::create): New factory to parse and create
print_formats.
    * elaborate.cxx (add_global_var_display): Use this factory.
    * parse.cxx (parser::parse_symbol): Ditto.
    * tapset-mark.cxx
      (mark_var_expanding_visitor::visit_target_symbol_context): Ditto.
    * tapset-utrace.cxx
      (utrace_var_expanding_visitor::visit_target_symbol_arg): Ditto.
    * tapsets.cxx
      (dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto.
      (tracepoint_var_expanding_visitor::visit_target_symbol_context)
Ditto.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PR10257: Add support for sprint[ln](@hist_*).
  2009-10-14 10:03     ` Mark Wielaard
@ 2009-10-14 23:45       ` Josh Stone
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Stone @ 2009-10-14 23:45 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Przemyslaw Pawelczyk, systemtap

On 10/14/2009 03:03 AM, Mark Wielaard wrote:
> Hi Josh,
>
> On Tue, 2009-10-13 at 19:24 -0700, Josh Stone wrote:
>> I committed this patch, and then also did some refactoring of my own.
>> Let me know if I broke it... :)
>
> I am afraid something in your last cleanup broke some of the vars.exp
> and uprobes.exp tests:

Sorry for the oversight -- it should be fixed in b393f6f2.

Josh

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-14 23:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-10 22:26 [PATCH broken] PR10257: Add support for sprint[ln](@hist_*) Przemyslaw Pawelczyk
2009-10-12 20:53 ` Josh Stone
2009-10-12 21:29   ` Przemysław Pawełczyk
2009-10-13 13:12 ` [PATCH] " Przemyslaw Pawelczyk
2009-10-14  2:24   ` Josh Stone
2009-10-14 10:03     ` Mark Wielaard
2009-10-14 23:45       ` Josh Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).