This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Histogram elision changes


I was preparing to document the recent histogram elision changes and found a few problems:

- There's no way to turn off elision.  Specifying -DHIST_ELISION=<some-large-number> sort of does it, but that can cause other problems.
- Depending on the value of HIST_ELISION, the code can iterate way outside the range of actual buckets, doing lots of unnecessary work.  In fact, one time I specified a ridiculously large HIST_ELISION and the script essentially hung.  I couldn't even kill staprun and stapio.

I rewrote some of the elision code to fix these issues (see patch below). The changes turn off elision if HIST_ELISION is negative and make sure only valid buckets are scanned. I also made a few formatting changes to match the rest of the file.

Please sanity check the changes (especially Frank) before I check them in.

Thanks,
Mike


--- stat-common.c 2007-10-24 15:12:45.000000000 -0700 +++ stat-common.c.new 2007-10-24 14:48:27.000000000 -0700 @@ -222,36 +222,43 @@ reprint (HIST_WIDTH, "-"); _stp_print(" count\n");

-        eliding=0;
+	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. */
- int k;
- int elide=1;
- for (k=i-HIST_ELISION; k<=i+HIST_ELISION; k++)
- {
- if (k >= 0 && k < st->buckets && 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)
- {
- reprint (val_space, " ");
- _stp_print(" ~\n");
- eliding = 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) {
+ reprint (val_space, " ");
+ _stp_print(" ~\n");
+ eliding = 0;
+ }
+ }


		if (st->type == HIST_LINEAR) {
			if (i == 0) {
@@ -266,8 +273,8 @@
				val = st->start + (i - 1) * st->interval;
		} else
			val = _stp_bucket_to_val(i);
-		
-		
+
+
		reprint (val_space - needed_space(val) - over_under, " ");

if (over_under) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]