<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 12, 2019 at 7:08 AM Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 12, 2019, 7:21 AM Fernando Domínguez Pousa <<a href="mailto:fdpousa@gmv.com" target="_blank">fdpousa@gmv.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="ES">
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> Joel Sherrill [mailto:<a href="mailto:joel@rtems.org" rel="noreferrer" target="_blank">joel@rtems.org</a>]
<br>
<b>Sent:</b> 10 December 2019 17:36<br>
<b>To:</b> Fernando Domínguez Pousa <<a href="mailto:fdpousa@gmv.com" rel="noreferrer" target="_blank">fdpousa@gmv.com</a>><br>
<b>Subject:</b> Re: Print stack info using rtems_stack_checker_report_usage_with_plugin()<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 10, 2019, 8:37 AM Fernando Domínguez Pousa <<a href="mailto:fdpousa@gmv.com" rel="noreferrer" target="_blank">fdpousa@gmv.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">I’m interested in getting stack information via an UDP message with an ASCII log trace inside. Basically, I cannot get the information using a printf. I found
the function rtems_stack_checker_report_usage_with_plugin(rtems_printer* printer) in order to get the information and send it using my UDP log function. So first of all I created a function called logPlugin (I used as exampled the plugin at printf_plugin.c):</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">static int logPlugin(void *context, const char *format, va_list ap)</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">{</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> (void) context;</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> return addLog(INFO, STACK,format, ap); /* First two arguments are used to classify message at reception*/</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">}</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">Then at rtems_stack_checker_report_usage_with_plugin calling scope:</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> rtems_printer printer;</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> printer.context = NULL;</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> printer.printer = logPlugin;</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> rtems_stack_checker_report_usage_with_plugin(&printer);</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">It is important to say that addLog puts the message in a circular buffer that other task will read and send the content using UDP.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">When stack checker report usage is called, only the information header is printed: " STACK USAGE BY THREAD\n"</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> "ID NAME LOW HIGH CURRENT AVAIL USED\n"</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">Next, stack values are not printed correctly and I can only get a value that is constant and equal to the same memory location (in decimal). It is a correct
guide to implement this? I do not know how to use the printer struct context variable, can this cause my problem?</span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Did you add CONFIGURE_ENABLE_STACK_CHECKER?<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif">Yes, it was enabled.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Also it would be handy to have methods for obtain cpu and stack usage without relying on the printf hook<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11pt;font-family:Calibri,sans-serif">I developed a code to gather all the tasks stack information into a struct that can be retrieved via function. Then I pack this struct and sent it via Ethernet.
Can I add my code to check.c in order to retrieve stack information without print it? Is this an intersesting feature for the community?</span></p></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes it is interesting. File a ticket so there is one to track this addition.</div><div dir="auto"><br></div><div dir="auto">It also will need a test and some documentation. I'm not sure how the test will check the function behaves correctly.</div><div dir="auto"><br></div><div dir="auto">Looking forward to seeing your submission.</div><div dir="auto"><br></div></div></blockquote><div><br></div><div>We've had this feature request before. It was somewhat captured in <a href="https://devel.rtems.org/wiki/Developer/Projects/Open/StackChecker">https://devel.rtems.org/wiki/Developer/Projects/Open/StackChecker</a></div><div><br></div><div>and the related: <a href="https://devel.rtems.org/wiki/Developer/Projects/Open/CPU_Statistics">https://devel.rtems.org/wiki/Developer/Projects/Open/CPU_Statistics</a></div><div><br></div><div>It's not clear it is enough work for a GSoC, but it seems too much work for someone to do voluntarily :)</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"></div><div dir="auto">--joel</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="ES"><div><div><div><p class="MsoNormal"><span lang="EN-GB" style="font-size:11pt;font-family:Calibri,sans-serif"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11pt;font-family:Calibri,sans-serif">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span lang="EN-GB"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thanks in advance,</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB">Regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-GB"> </span><u></u><u></u></p>
<div>
<div>
<div class="MsoNormal">
<hr size="2" width="100%" noshade style="color:silver" align="left">
</div>
</div>
</div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%">
<tbody>
<tr>
<td style="padding:0cm">
<table border="0" cellspacing="10" cellpadding="0" width="100%" style="width:100%">
<tbody>
<tr>
<td width="212" valign="top" style="width:150pt;padding:0cm">
<p class="MsoNormal"><img border="0" width="185" height="68" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_2"><u></u><u></u></p>
</td>
<td width="252" valign="top" style="width:210pt;padding:0cm">
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:Verdana,sans-serif;color:black">Fernando Domínguez Pousa<br>
</span></b><span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:black">Ingeniero de Software</span><br>
<span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:black">Software Engineer</span><u></u><u></u></p>
</td>
<td width="235" valign="top" style="width:165pt;padding:0cm">
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:black">GMV
<br>
Isaac Newton, 11<br>
P.T.M. Tres Cantos<br>
E-28760 Madrid<br>
Tel. +34 91 807 21 00<br>
Fax +34 91 807 21 99 <br>
</span><a href="http://www.gmv.com/" rel="noreferrer" target="_blank"><span style="font-size:7.5pt;font-family:Verdana,sans-serif;color:rgb(153,153,153);text-decoration:none">www.gmv.com
</span></a><u></u><u></u></p>
<table border="0" cellspacing="0" cellpadding="0" width="0" style="width:165pt">
<tbody>
<tr>
<td width="15" style="width:11.25pt;padding:0cm">
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.facebook.com_infoGMV&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=TVgsYD5kZtUVH9LulD6BpnRsdJjK7KKhwm0gExv79V0&e=" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="15" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_3"></span></a><u></u><u></u></p>
</td>
<td width="24" style="width:18pt;padding:0cm">
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.twitter.com_infoGMV-5Fes&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=AKhuDTIEG9B5SSppSI9W2IZbCtlVN6Xxghmhqw_8xrs&e=" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_4"></span></a><u></u><u></u></p>
</td>
<td width="24" style="width:18pt;padding:0cm">
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__plus.google.com_-2BGmvcompany&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=aH_sTC6ItBsWu6XvQPqgmMi4brzX7wBHmPqFQ2FbfSc&e=" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_5"></span></a><u></u><u></u></p>
</td>
<td width="24" style="width:18pt;padding:0cm">
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.youtube.com_infoGMV&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=LeXn3Vd6znq0lx28JCcO0BUCbRxzg36aodelZfSy_QE&e=" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_6"></span></a><u></u><u></u></p>
</td>
<td width="24" style="width:18pt;padding:0cm">
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__www.linkedin.com_company_gmv&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=qQvn0q84_7QaJIvkgK7wpqkfzr7YoJNDa9KIA6w0TVQ&e=" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_7"></span></a><u></u><u></u></p>
</td>
<td style="padding:0cm">
<p class="MsoNormal"><a href="http://www.gmv.com/en/RSS" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_8"></span></a><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> <u></u><u></u></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:0cm">
<p class="MsoNormal"><a href="http://www.gmv.com/blog_gmv/language/en/" rel="noreferrer" target="_blank"><span style="text-decoration:none"><img border="0" width="96" height="24" id="gmail-m_-5436037096879523705m_5042165738769443241m_8934936826656376648Picture_x0020_9"></span></a><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal">
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<span style="font-size:18pt;font-family:Webdings;color:green">P </span><span style="font-size:7pt;font-family:Arial,sans-serif;color:green">Please consider the environment before printing this e-mail.</span>
<u></u><u></u></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" rel="noreferrer" target="_blank">users@rtems.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.rtems.org_mailman_listinfo_users&d=DwMFaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=JJRyTkGL8xI4YFJLjo7JWw&m=ZnGDe8CiC5tUJJuEodtypPFjSXET23uigE7l-uSzLMY&s=dGxmP2gK5vUyNRX5UQVoMbmLLQ1K6M-QpFkFJfVYVEY&e=" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
<span><br>
</span><span style="font-size:18pt;line-height:125%;font-family:Webdings;color:green">P<span></span>
<span style="font-size:7pt;line-height:125%;font-family:Arial,sans-serif;color:green">
Please consider the environment before printing this e-mail.</span></span><span></span>
</div>
</blockquote></div></div></div>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a></blockquote></div></div>