[lttng-dev] Extracting System Call IDs By Using TMF

Shariyar syed.shariyar at gmail.com
Thu Nov 28 19:29:30 EST 2013


Hi,

I need information on how to extract system call ids from a kernel level
trace by using TMF.
For example, a sample code to iterate through a kernel trace in CTF format
is given below.

In this code, I am able to extract the system call name and its return
value. However, from the *event.getContent()* function, I could not get the
system call id for the corresponding system call name.

Kindly let me know, how to extract the system call id? By system call id I
mean the actual system call id assigned by Linux to a system call as shown
on this site: http://syscalls.kernelgrok.com/

///////////////////////////////////////////////Code
//////////////////////////////////////
public void readTrace(){

        CtfIterator  traceIterator=trace.createIterator();

        while (traceIterator.advance()){

            CtfTmfEvent event = traceIterator.getCurrentEvent();
            ITmfEventField content = event.getContent();
            String eventName=event.getEventName();

            ITmfEventField sys_exit=content.getField("ret");

            if (sys_exit != null)
                System.out.println("Ret: "+sys_exit.getValue());

            if (eventName.startsWith(LttngStrings.SYSCALL_PREFIX)
                ||
eventName.startsWith(LttngStrings.COMPAT_SYSCALL_PREFIX)) {

                        System.out.println(eventName);
             }
        }

    }
///////////////////////////////////////////////Code
//////////////////////////////////////

Regards,
Shariyar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20131128/46db208f/attachment.html>


More information about the lttng-dev mailing list