[lttng-dev] Regarding CtfTmfTrace reader in TMF and LTTng's new trace format

Shariyar syed.shariyar at gmail.com
Fri Oct 17 11:31:46 EDT 2014


Hi,

I am trying to read the traces  generated in the latest format by
LTTng--i.e.,  a trace having an index folder (with index files) and the
files for every channel. I am reading these type of traces in my Java
program by using the CtfTmfTrace class that exists in TMF. I have been
using this class and its associated classes (e.g., CtfIterator
and CtfTmfEvent) to successfully read the traces in previous trace format
of LTTng (i.e., the trace with only files for channels and no index
folder/files).

 Now, I cannot read the latest trace format with these classes. In fact, I
am only able to read 10-20 events from the latest trace format.  These
events are namely power_cpu_idle, exit_syscall, and sys_ioctl. Can you
 kindly tell me which classes to use to read both kind of trace formats;
old ones and the new ones?

I have also pasted below my current source code to read LTTng traces.

/**
     * Constructor to initialize the trace
     * @param filePath file Name
     * @throws TmfTraceException An exception during trace reading
     */
    public CTFSystemCallIterator(String filePath) throws TmfTraceException {
        fTrace = new CtfTmfTrace();
        fTrace.initTrace(null, filePath, CtfTmfEvent.class);
        fTraceIterator = fTrace.createIterator();
    }

    /**
     * Moves Iterator to the next event, and returns true if the iterator
     * can advance or false if the iterator cannot advance
     **/
    @Override
    public boolean advance() {
        boolean isAdvance = true;
        fSyscall = ""; //$NON-NLS-1$
        do {
            CtfTmfEvent event = fTraceIterator.getCurrentEvent();
            System.out.println(event);
            fSyscall = handleSysEntryEvent(event);
            isAdvance = fTraceIterator.advance();
        } while (fSyscall.isEmpty() && isAdvance);

        if (!isAdvance) {
            fIsDispose = true;
            fTrace.dispose();
        }

        return isAdvance;

    }

Thanks,
Shariyar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20141017/ed6c5711/attachment.html>


More information about the lttng-dev mailing list