<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Yehuda,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
The trigger mechanism is asynchroneous. The applications (or the kernel) won't block until the session daemon has processed the actions of the trigger.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
As such, it is likely that you will lose events between the moment the trigger is triggered and when the session is started.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
We have been considering implementing synchroneous start/stop actions, but no one has sponsored that work for the moment.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
In your case, a work-around you could consider is to:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<ul data-editing-info="{"orderedStyleType":1,"unorderedStyleType":2}">
<li style="list-style-type: "- ";"><span>setup a snapshot session with the same events</span></li><li style="list-style-type: "- ";"><span>set the trigger's actions to record a snapshot on that session, and start your existing session</span></li></ul>
<div><span><br>
</span></div>
<div><span>In that setup, you would most likely see the events that led to the "start" (since they are captured in the in-memory buffers of the snapshot session), and you would capture the follow-up events in the on-disk session.</span></div>
<div><span><br>
</span></div>
<div><span>I hope that helps,</span></div>
<div><span>Jérémie</span></div>
</div>
<div class="elementToProof">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jérémie Galarneau</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div>EfficiOS Inc.</div>
<a href="https://www.efficios.com">https://www.efficios.com</a><br>
</div>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> lttng-dev <lttng-dev-bounces@lists.lttng.org> on behalf of Yitschak, Yehuda via lttng-dev <lttng-dev@lists.lttng.org><br>
<b>Sent:</b> May 23, 2023 08:17<br>
<b>To:</b> lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org><br>
<b>Subject:</b> [lttng-dev] delay between trigger and action</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
{color:#954F72;
text-decoration:underline}
span.x_EmailStyle17
{font-family:"Calibri",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-family:"Calibri",sans-serif}
@page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal">Hi everyone <br>
<br>
I am experimenting with enabling trace for a specific iteration of a loop in my application.
<br>
I created 2 trace points at the start and end of the loop which log the iteration number.<br>
the loop itself creates thousands of trace points. It runs for ~5ms. <br>
<br>
on lttng side I created 2 triggers to start and stop my session in case the loop tracepoint registers a specific iteration number.<br>
the triggers seem to work since there is another session entry created under the session folder but there are very few tracepoints.<br>
<br>
is it possible that the delay between the event happening and the session trace starting causes loss of events ?
<br>
If yes, is there a way around this ? <br>
<br>
here is my setup :<br>
<br>
#lttng-status<br>
Recording session session: [inactive]</p>
<p class="x_MsoNormal"> Trace output: /home/user/lttng-traces/session-20230523-113537</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">=== Domain: User space ===</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Buffering scheme: per-user</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Tracked process attributes</p>
<p class="x_MsoNormal"> Virtual process IDs: all</p>
<p class="x_MsoNormal"> Virtual user IDs: all</p>
<p class="x_MsoNormal"> Virtual group IDs: all</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Channels:</p>
<p class="x_MsoNormal">-------------</p>
<p class="x_MsoNormal">- user-channel: [enabled]</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"> Attributes:</p>
<p class="x_MsoNormal"> Event-loss mode: discard</p>
<p class="x_MsoNormal"> Sub-buffer size: 16777216 bytes</p>
<p class="x_MsoNormal"> Sub-buffer count: 128</p>
<p class="x_MsoNormal"> Switch timer: inactive</p>
<p class="x_MsoNormal"> Read timer: inactive</p>
<p class="x_MsoNormal"> Monitor timer: 1000000 us</p>
<p class="x_MsoNormal"> Blocking timeout: 0 us</p>
<p class="x_MsoNormal"> Trace file count: 1 per stream</p>
<p class="x_MsoNormal"> Trace file size: unlimited</p>
<p class="x_MsoNormal"> Output mode: mmap</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"> Statistics:</p>
<p class="x_MsoNormal"> Discarded events: 0</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"> Recording event rules:</p>
<p class="x_MsoNormal"> trace_events* (type: tracepoint) [enabled]</p>
<p class="x_MsoNormal"> loop* (type: tracepoint) [enabled]</p>
<p class="x_MsoNormal"><br>
#lttng list-triggers<br>
<br>
- name: iter-start</p>
<p class="x_MsoNormal"> owner uid: 1000</p>
<p class="x_MsoNormal"> condition: event rule matches</p>
<p class="x_MsoNormal"> rule: loop:iteration (type: user tracepoint, filter: iter==2 && start == 1)</p>
<p class="x_MsoNormal"> errors: none</p>
<p class="x_MsoNormal"> actions:</p>
<p class="x_MsoNormal"> start session `session`</p>
<p class="x_MsoNormal"> errors: none</p>
<p class="x_MsoNormal"> errors: none</p>
<p class="x_MsoNormal">- name: iter-stop</p>
<p class="x_MsoNormal"> owner uid: 1000</p>
<p class="x_MsoNormal"> condition: event rule matches</p>
<p class="x_MsoNormal"> rule: loop:iteration (type: user tracepoint, filter: iter==2 && start == 0)</p>
<p class="x_MsoNormal"> errors: none</p>
<p class="x_MsoNormal"> actions:</p>
<p class="x_MsoNormal"> stop session `session`</p>
<p class="x_MsoNormal"> errors: none</p>
<p class="x_MsoNormal"> errors: none<br>
<br>
<br>
Thanks <br>
<br>
Yehuda </p>
</div>
</div>
</body>
</html>