Dealing with empty aggregates?
Frank Ch. Eigler
fche@redhat.com
Thu May 19 14:37:00 GMT 2011
"Bryn M. Reeves" <bmr@redhat.com> writes:
> [...]
> ERROR: empty aggregate near identifier '@sum' at <input>:1:42
> [...]
> probe timer.ms(1000) {
> if (have_stuff) {
> printf("Sum of stuff: %d\n", @sum(stuff))
> } else {
> print("Sum of stuff: n/a\n")
> }
> }
The canonical construct doesn't require a hand-maintained flag:
probe timer.ms(1000) {
if (@count(stuff))
printf("Sum of stuff: %d\n", @sum(stuff))
else
printf("No stuff.")
}
- FChE
More information about the Systemtap
mailing list