Newbie question -- arrays

Om Narasimhan om.turyx@gmail.com
Thu Aug 21 06:39:00 GMT 2008


Just started with systemtap, going with the tutorial exercises.

--script begin--

[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) {
                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());
}
--script  end --
--errors start --
[om@testserv /space/stap]$ sudo stap -vv -u ./open-count.stp
SystemTap translator/driver (version 0.6.2/0.127 built 2008-03-27)
Copyright (C) 2005-2008 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
Created temporary directory "/tmp/stap4iW4ix"
Searched '/usr/share/systemtap/tapset/x86_64/*.stp', found 1
Searched '/usr/share/systemtap/tapset/*.stp', found 37
Pass 1: parsed user script and 38 library script(s) in 
120usr/10sys/249real ms.
probe sys_open@fs/open.c:1048 kernel section=.text pc=0xffffffff810964f3
probe compat_sys_open@fs/compat.c:1212 kernel section=.text 
pc=0xffffffff810c1874
semantic error: probe_1064 with unresolved type: identifier 'op_id' at 
./open-count.stp:9:13
semantic error: probe_1064 with unresolved type: identifier 'op_name' at 
./open-count.stp:9:20
semantic error: probe_1064 with unresolved type: identifier 'op_count' 
at ./open-count.stp:9:29
semantic error: probe_1067 with unresolved type: identifier 'op_uid_a' 
at ./open-count.stp:5:8
Pass 2: analyzed script: 3 probe(s), 139 function(s), 14 embed(s), 1 
global(s) in 290usr/70sys/361real ms.
Pass 2: analysis failed.  Try again with more '-v' (verbose) options.
Running rm -rf /tmp/stap4iW4ix

--errors end--



More information about the Systemtap mailing list