c-datacol4.html

来自「vxworks相关论文」· HTML 代码 · 共 257 行

HTML
257
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>    Data Collection   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-datacol.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-datacol.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-datacol3.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-datacol5.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84780">7.4  &nbsp;&nbsp;Adding Eventpoints</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84782"> </a>You can specify which level of logging to implement, but data is collected only when events are generated by the instrumented VxWorks kernel and libraries. Your application will make many calls to VxWorks routines, but sometimes you will want information on some of your application routines as well. There are two ways to do this: by setting eventpoints dynamically from the Tornado shell with the <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b>routine, or by inserting event-generating function calls into application source code. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84784">The <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b> Routine</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84786"> </a>The simplest type of user-generated event is the <i class="term">eventpoint</i>, which can be set from the shell with the <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b> routine. Eventpoints are analogous to breakpoints; they are program locations that display the <b class="eventType">defaultUser</b> event icon (<img class="figure" border="0" src="images/c-datacola1.gif">) when the instruction at that location executes. (To design your own event icons, see <a href="x-custom4.html#84127"><i class="title">F.4&nbsp;Creating Icons for User-Defined Events</i></a>.)</p><dd><p class="Body"><a name="84793"> </a>The <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b> routine has the following syntax:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84794">STATUS e     (     INSTR&nbsp;*&nbsp;&nbsp;addr,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* address to set eventpoint; */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* NULL = all eventpoints and */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* breakpoints are raised */     event_t&nbsp;&nbsp;eventNo,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* event number */     int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;taskNameOrId,&nbsp;/* task in which to raise event- */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* point; 0 = all tasks */     FUNCPTR&nbsp;&nbsp;evtRtn,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* function to be called when */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* eventpoint encountered; NULL */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* = no function, so eventpoint */     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* always raised */     int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* argument to evtRtn function */     )</a></b></pre></dl></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="87738"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE:  </font></b></a>Eventpoints follow the same rules as breakpoints, including the following: (1) Eventpoints in unbreakable tasks are not executed and thus do not appear in the view graph. (2) Eventpoints cannot be set at interrupt level.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="84816"> </a>To see how a log looks when you set an eventpoint with <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b>, follow these steps:</p></dl><dl class="margin"><p><ol class="List"><li value="1)"><a name="84820"> </a>To set an eventpoint with an ID of 10 at the address of the <b class="routine"><i class="routine">sin</i></b><b>(&nbsp;)</b> routine, click the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Launch Shell</font></b> button (<img class="figure" border="0" src="images/c-datacola2.gif">) and type:</li></ol></p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="84821"></b><tt class="output">-&gt;</tt><b> e sin, 10, 0, 0, 0 </b><tt class="output">value - 1 = 0x1</tt><b></a></b></pre></dl></dl><p><ol class="List"><li value="2)"><a name="84826"> </a>Click <img class="figure" border="0" src="images/c-datacola3.gif"> to start logging. (You can use any logging level.)</li></ol></p><p><ol class="List"><li value="3)"><a name="84827"> </a>In the shell window type:</li></ol></p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="84828"></b><tt class="output">-&gt; </tt><b>sin 1 </b><tt class="output">value = 1 = 0x1</tt><b></a></b></pre></dl></dl><p><ol class="List"><li value="4)"><a name="84835"> </a>Click <img class="figure" border="0" src="images/c-datacola4.gif">to stop logging and <img class="figure" border="0" src="images/c-datacola5.gif"> to upload data.</li></ol></p><p><ol class="List"><li value="5)"><a name="84840"> </a>Click <img class="figure" border="0" src="images/c-datacola6.gif">, locate the numeral <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">10</font></b>, and click, drag, and zoom in over this area of the graph repeatedly until you can see your user event icon with the numeral 10 beside it. Your graph will look something like <a href="c-datacol4.html#84847">Figure&nbsp;7-2</a>. &nbsp;&nbsp;&nbsp;<div class="frame"><h4 class="EntityTitle"><a name="84847"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 7-2:&nbsp;&nbsp;View Graph with User Event</font></a></h4><dl class="margin"><div class="Anchor"><a name="84856"> </a><img class="figure" border="0" src="images/c-datacola7.gif"></div></dl></div></li></ol></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84858">The <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b> Routine</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84860"> </a>The <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b> routine provides a generic event function which is always available and which has more flexibility than <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b>. </p><dd><p class="Body"><a name="84862"> </a>The <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b> routine is declared as follows:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84863">STATUS wvEvent     (     event_t&nbsp;&nbsp;&nbsp;eventNo,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* event ID */     char *&nbsp;&nbsp;&nbsp;&nbsp;buffer,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* user-supplied buffer */     size_t&nbsp;&nbsp;&nbsp;&nbsp;bufSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* buffer size */     )</a></b></pre></dl><dd><p class="Body"><a name="84869"> </a>The <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b> routine can be called from unbreakable tasks or from interrupt level.<sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup> Thus it is more flexible than the <b class="routine"><i class="routine">e</i></b><b>(&nbsp;)</b> routine. For example, you can use user-generated events for error checking, as shown in the following example:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84874">if (<i class="textVariable">something</i>)     {     ...    /* run this code */     }</a></b><dd> <b><a name="84875">else     {     ...&nbsp;/* we should never get here, but if we do, load any values */         /* of interest into event1Buff, then log using wvEvent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/          return = wvEvent (EVENT_1_ID, &amp;event1Buff, EVENT_1_BUFSIZE);     }</a></b></pre></dl><dd><p class="Body"><a name="84880"> </a>If this event is ever encountered, the <b class="eventType">defaultUser</b> event icon (<img class="figure" border="0" src="images/c-datacol8.gif">) is displayed in the view graph, with the event number just to the right of the icon. You can double-click on this icon to bring up the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Show Event</font></b> dialog box, which shows the timestamp at which the user event occurred, the context in which it occurred, and the user event number. If you customize the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Show Event</font></b> dialog box, you can also display information held in the user event buffer (<i class="textVariable">buffer</i> argument to <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b>).<sup><a href="#foot"><b class="FootnoteMarker">2</b></a></sup> </p><dd><p class="Body"><a name="84893"> </a>To see how a log looks when an eventpoint is raised by <b class="routine"><i class="routine">wvEvent</i></b><b>(&nbsp;)</b>, do the following:</p></dl><dl class="margin"><p><ol class="List"><li value="1)"><a name="84897"> </a>Click <img class="figure" border="0" src="images/c-datacol9.gif"> to start logging. (You can use any logging level.)</li></ol></p><p><ol class="List"><li value="2)"><a name="84898"> </a>In the shell window type:</li></ol></p><dl class="margin"><dl class="margin"><dd><pre class="Code3"><b><a name="84899"></b><tt class="output">-&gt; </tt><b>wvEvent (99, 0, 0) </b><tt class="output">value = 0= 0x0</tt><b></a></b></pre></dl></dl><p><ol class="List"><li value="3)"><a name="84906"> </a>Click <img class="figure" border="0" src="images/c-datacol10.gif">to stop logging and <img class="figure" border="0" src="images/c-datacol11.gif"> to upload data.</li></ol></p></dl><dl class="margin"><dd><p class="Body"><a name="84910"> </a><a href="c-datacol4.html#84932">Figure&nbsp;7-3</a> shows an example of what this might look like in the view graph. The target-agent task, <b class="task">tWdbTask</b>, spawns (<img class="figure" border="0" src="images/c-datacol12.gif">) and then resumes (<img class="figure" border="0" src="images/c-datacol13.gif">) task <b class="task">t44</b>. Task <b class="task">t44</b> makes a transition from the suspended state (<img class="figure" border="0" src="images/c-datacol14.gif">) to the ready state (<img class="figure" border="0" src="images/c-datacol15.gif">). Near time 1.66664, <b class="task">t44</b> makes a transition to the executing state (<img class="figure" border="0" src="images/c-datacol16.gif">) and user event 99 is encountered (<img class="figure" border="0" src="images/c-datacol17.gif">).<div class="frame"><h4 class="EntityTitle"><a name="84932"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 7-3:&nbsp;&nbsp;User-Generated Event </font></a></h4><dl class="margin"><div class="Anchor"><a name="84943"> </a><img class="figure" border="0" src="images/c-datacol18.gif"></div></dl></div>&nbsp;&nbsp;</p></dl></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1:&nbsp;<span class="Footnote"><a name="84873"> </a><i class="term">Unbreakable</i> tasks are those that are created with the <b class="symbol_UC">VX_UNBREAKABLE</b> bit set in the <i class="textVariable">options</i> argument of the <b class="routine"><i class="routine">taskInit</i></b><b>(&nbsp;)</b> or <b class="routine"><i class="routine">taskSpawn</i></b><b>(&nbsp;)</b> routine.</span><p class="FootnoteNumberMarker">2:&nbsp;<span class="Footnote"><a name="84886"> </a>For information on using <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Show Event</font></b>, see <a href="c-display4.html#83966"><i class="title">The </i>Show Event<i class="title"> Dialog Box</i></a>. For information on customizing the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Show Event</font></b> dialog box, see <a href="x-custom3.html#83744"><i class="title">F.3&nbsp;Customizing the Show Event Dialog Box for User Events</i></a>. For information on designing your own user event icons, see <a href="x-custom4.html#84127"><i class="title">F.4&nbsp;Creating Icons for User-Defined Events</i></a>.</span><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-datacol.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-datacol.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-datacol3.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-datacol5.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 4.0.11    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?