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

Geneviève Bastien gbastien+lttng at versatic.net
Mon Oct 20 10:37:26 EDT 2014


Hi Shariyar,

Can your trace be read all right if you import it in TMF (Trace Compass)
and open it normally in it? Do all events appear in the events table?
There were changes to improve the CTF reading part recently and somebody
reported a bug with traces taken on ARM where events are not read
correctly, but the bug is not due to the index files.

If the trace is read correctly by TMF, may I suggest that you use a
TmfEventRequest instead of your own iterator to read the trace events.
This is the preferred way for now, most analysis do that and you don't
have to bother about trace types, iterators, etc. For an example, see
the class TmfStateSystemAnalysisModule, at the end of the file is the
event request class and the build() method from the class that uses it.

Geneviève


On 14-10-17 11:31 AM, Shariyar wrote:
> 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
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20141020/d05b31bc/attachment-0001.html>


More information about the lttng-dev mailing list