<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Webdings;
panose-1:5 3 1 2 1 5 9 6 7 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle18
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ES" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Joel Sherrill [mailto:joel@rtems.org]
<br>
<b>Sent:</b> 10 December 2019 17:36<br>
<b>To:</b> Fernando Domínguez Pousa <fdpousa@gmv.com><br>
<b>Subject:</b> Re: Print stack info using rtems_stack_checker_report_usage_with_plugin()<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 10, 2019, 8:37 AM Fernando Domínguez Pousa <<a href="mailto:fdpousa@gmv.com">fdpousa@gmv.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi all,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">static int logPlugin(void *context, const char *format, va_list ap)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">{</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> (void) context;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> return addLog(INFO, STACK,format, ap); /* First two arguments are used to classify message at reception*/</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">}</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Then at rtems_stack_checker_report_usage_with_plugin calling scope:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> rtems_printer printer;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> printer.context = NULL;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> printer.printer = logPlugin;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> rtems_stack_checker_report_usage_with_plugin(&printer);</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">When stack checker report usage is called, only the information header is printed: " STACK USAGE BY THREAD\n"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> "ID NAME LOW HIGH CURRENT AVAIL USED\n"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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><o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Did you add CONFIGURE_ENABLE_STACK_CHECKER?<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Yes, it was enabled.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;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?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Thanks in advance,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Regards,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<div>
<div>
<div class="MsoNormal">
<hr size="2" width="100%" noshade="" style="color:silver" align="left">
</div>
</div>
</div>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<table class="MsoNormalTable" border="0" cellspacing="10" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="212" valign="top" style="width:150.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><img border="0" width="185" height="68" id="m_8934936826656376648Picture_x0020_2" src="cid:image001.gif@01D5AF6C.02B3BC40"><o:p></o:p></p>
</td>
<td width="252" valign="top" style="width:210.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;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><o:p></o:p></p>
</td>
<td width="235" valign="top" style="width:165.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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/" target="_blank"><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:#999999;text-decoration:none">www.gmv.com
</span></a><o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="0" style="width:165.0pt">
<tbody>
<tr>
<td width="15" style="width:11.25pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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=" target="_blank"><span style="text-decoration:none"><img border="0" width="15" height="30" id="m_8934936826656376648Picture_x0020_3" src="cid:image002.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
<td width="24" style="width:18.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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=" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="m_8934936826656376648Picture_x0020_4" src="cid:image003.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
<td width="24" style="width:18.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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=" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="m_8934936826656376648Picture_x0020_5" src="cid:image004.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
<td width="24" style="width:18.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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=" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="m_8934936826656376648Picture_x0020_6" src="cid:image005.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
<td width="24" style="width:18.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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=" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="m_8934936826656376648Picture_x0020_7" src="cid:image006.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a href="http://www.gmv.com/en/RSS" target="_blank"><span style="text-decoration:none"><img border="0" width="24" height="30" id="m_8934936826656376648Picture_x0020_8" src="cid:image007.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a href="http://www.gmv.com/blog_gmv/language/en/" target="_blank"><span style="text-decoration:none"><img border="0" width="96" height="24" id="m_8934936826656376648Picture_x0020_9" src="cid:image008.png@01D5AF6C.02B3BC40"></span></a><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<span style="font-size:18.0pt;font-family:Webdings;color:green">P </span><span style="font-size:7.0pt;font-family:"Arial",sans-serif;color:green">Please consider the environment before printing this e-mail.</span>
<o:p></o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" 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=" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
<span style=""><br>
</span><span style="font-size:18.0pt; line-height:125%; font-family:Webdings; color:green">P<span style=""></span>
<span style="font-size:7.0pt; line-height:125%; font-family:"Arial","sans-serif"; color:green">
Please consider the environment before printing this e-mail.</span></span><span style=""></span>
</body>
</html>