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]

Re: Newbie question -- arrays


Hi, 

Where did you get this script?

>
> [om@testserv /space/stap]$ cat open-count.stp
> # establish a timer for 3 seconds, in the meantime traces open() and counts 
> who
> # does it most and prints top 10
>
> global op_uid_a # keeps the open counts by uid
>
> probe timer.ms(3000)
> {
>      # foreach ( [op_id, op_name, op_count-] in op_uid_a limit 10) {
	foreach ( [op_id -, op_name] in op_uid_a limit 10) {
	# op_uid_a should take same number of index in the tuple. 
>                printf ("%s issued sys_open %d times\n", name, count)
>        }
>        exit()
> }
>
> probe syscall.open
> {
>        op_uid_a[uid(), execname()]++
>        printf ("%s(%d): sys_open, uid = %d\n", execname(), pid(), uid());
> }

--
Thanks and Regards
Srikar


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