<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I want to use the babeltrace C library to read a CTF trace in my program, but I’m facing some problems.</div><div class=""><br class=""></div><div class=""><div class="">I was able to create a bt_context and load a trace (I can get the begin and end timestamps).</div><div class="">But then, it seems some functions are missing in the library headers:</div></div><div class=""><br class=""></div><div class="">The API.txt file in the doc folder says:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">A CTF event is obtained from an iterator via the bt_ctf_iter_read_event()<br class="">function or via the call_data parameter of a callback. To read the data of a<br class="">CTF event :<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>* bt_ctf_event_name() <span class="Apple-tab-span" style="white-space:pre"> </span>returns the name of the event;<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>* bt_ctf_get_timestamp() <span class="Apple-tab-span" style="white-space:pre"> </span>returns the timestamp of the event<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>offsetted with the system clock<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>source (in ns);<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>* bt_ctf_get_cycles() <span class="Apple-tab-span" style="white-space:pre"> </span>returns the timestamp of the event as<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>written in the packet (in cycles).</blockquote></div><div class=""><br class=""></div><div class="">Those functions were defined in the include/babeltrace/ctf/events.h file but they were moved in file include/babeltrace/ctf/events-internal.h (commit 9a19a512f564cbb301b0b5f1377d64e3b3f0a851) which is not part of the include files when installing babeltrace.</div><div class="">Is it normal and the way to access events data has changed ? (The the API.txt file is quite old)</div><div class="">I read on babeltrace website that the version 2 will provide a new API.</div><div class=""><br class=""></div><div class="">Also when I iterate over events the event pointer never changes:</div><div class=""><br class=""></div><div class=""></div><blockquote type="cite" class=""><div class=""> // get iterator of events<br class=""> struct bt_ctf_iter *envents_iter = bt_ctf_iter_create(ctx, nullptr, nullptr);</div><div class=""> //event pointer<br class=""> struct bt_ctf_event *ev_ptr = nullptr;<br class=""> <br class=""> while(true){<br class=""> ev_ptr = bt_ctf_iter_read_event(envents_iter);<br class=""></div></blockquote><blockquote type="cite" class=""><div class=""> if(! ev_ptr)</div><div class=""> break;</div><div class=""> bt_iter_next(bt_ctf_get_iter(envents_iter));</div></blockquote><blockquote type="cite" class=""><div class=""> }</div></blockquote><div class=""> <br class=""></div><div class="">Can you tell me if I misuse this library ?</div><div class="">Thanks!</div><div class="">—</div><div class=""><div class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Alexis Martin<br class="">PhD. Student</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">INRIA / LIG POLARIS-Team</div></div></div></div></div>
</div>
<br class=""></div></body></html>