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]

[Bug translator/7053] automatic global printing of statistic needs to check @count>0


------- Additional Comments From wenji dot huang at oracle dot com  2008-12-02 03:35 -------
Created an attachment (id=3085)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=3085&action=view)
patch for checking empty aggregate and adding default print

Add checking empty aggregate and default print where @count==0. It's not
necessary to check empty aggregate in Array case. The generated foreach 
can eliminate the possibly of printing empty aggregate.

Sample script:
$ sudo stap -ve 'global var; probe never{ var<<<2}' -p2
Pass 1: parsed user script and 47 library script(s) in 540usr/60sys/603real ms.

# globals
var:stats
# probes
never /* <- never */
(var) <<< (2)
end /* <- end */
{
if ((@count(var)) > (0)) printf("var @count=%#x @min=%#x @max=%#x @sum=%#x
@avg=%#x\\n", @count(var), @min(var), @max(var), @sum(var), @avg(var))
else printf("var @count=0x0\\n")

}
Pass 2: analyzed script: 2 probe(s), 0 function(s), 0 embed(s), 1 global(s) in
10usr/20sys/26real ms.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=7053

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


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