Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Problem: XML analysis - state provider

Hey Geneviève,

 

Yes, I already messaged you some weeks ago but it seems you forget to send your reply J

 

But thanks for your answer now! Really appreciate your help.

Although I couldn’t make it work yet.

Could be an issue that I still have some problems to fully understand that patterns even though you gave me an extensive example.

 

My custom text parser raises an event with the name “alarm_” but if he can find a new alarm he appends “raised”, so the name of the event should be “alarm_raised”. (Reason behind this is, I have more events beginning with “alarm_”.) But I guess it shouldn’t make any difference to the pattern if I do it this way or directly create an event called “alarm_raised”.

 

In your example, instead of…

 

       <action id="reset_alarm">
         
<stateChange>
                <stateAttribute type="constant" value="s16" />
                <stateAttribute type="constant" value="alarm" />
                <stateAttribute type="query">
                     <stateAttribute type="constant" value="#CurrentScenario" />
                     <stateAttribute type="constant" value="alarmID" />               
                </stateAttribute>
               
<stateValue type="int" value="1" />
            </stateChange>

       </action>

 

shouldn’t it be… to reset the alarm?

 

       <action id="reset_alarm">
         
<stateChange>
                <stateAttribute type="constant" value="s16" />
                <stateAttribute type="constant" value="alarm" />
                <stateAttribute type="query">
                     <stateAttribute type="constant" value="#CurrentScenario" />
                     <stateAttribute type="constant" value="alarmID" />               
                </stateAttribute>
               
<stateValue type="null" />
            </stateChange>

       </action>

 

 

Thanks for the help so far! I will keep on trying to make it work.

 

Best regards,

Norman

 

 

From: tracecompass-dev-bounces@xxxxxxxxxxx [mailto:tracecompass-dev-bounces@xxxxxxxxxxx] On Behalf Of Geneviève Bastien
Sent: Dienstag, 29. August 2017 15:33
To: tracecompass-dev@xxxxxxxxxxx
Subject: Re: [tracecompass-dev] Problem: XML analysis - state provider

 

Hi Norman,

I have a vague souvenir of having seen this question and replying to it, but I can't find it anywhere in my outbox, maybe I dreamed it?

I'd suggest you use patterns to do the state machine of an alarm. This way, the alarm is in a state such that it can wait for a system start event and reset its state. For instance, you could do like this

<pattern version="0" id="alarm.analysis">
    <patternHandler initial="alarm">

       <action id="set_alarm">
             <stateChange>
                <stateAttribute type="constant" value="s16" />
                <stateAttribute type="constant" value="alarm" />
                <stateAttribute type="eventField" value="ID" />
                <stateValue type="int" value="1" />
            </stateChange>

        
<stateChange>
                <stateAttribute type="constant" value="#CurrentScenario" />
                <stateAttribute type="constant" value="alarmID" />
                <stateValue type="eventField" value="ID" />
            </stateChange>

       </action>

       <action id="reset_alarm">
         
<stateChange>
                <stateAttribute type="constant" value="s16" />
                <stateAttribute type="constant" value="alarm" />
                <stateAttribute type="query">
                     <stateAttribute type="constant" value="#CurrentScenario" />
                     <stateAttribute type="constant" value="alarmID" />               
                </stateAttribute>
                <stateValue type="int" value="1" />
            </stateChange>

       </action>

       <fsm id="alarm">
            <initial>
                <transition event="
alarm_raised" target="alarm_raised" action="" />
            </initial>
            <state id="alarm_raised">
                <transition event="system_start" target="alarm_resetted" action="" />
            </state>
            <final id="alarm_resetted"/>
        </fsm>
    </patternHandler>
</pattern>

Notice that the first action sets a variable in the scenario, that is then used by the reset_alarm action to reset the alarm corresponding to this scenario. You can also add any other state change you may need to update the alarms. You can also add conditions to the transition. For example, if you want to make sure an event is for the right alarm, then the following condition could work and you would add cond="same_alarm" to the transition attributes.

        <test id="same_alarm">
            <if>
                <condition>
                    <stateValue type="eventField" value="ID"/>
                    <stateValue type="query">
                        <stateAttribute type="constant" value="#CurrentScenario" />
                        <stateAttribute type="constant" value="alarmID" />
                    </stateValue>
                </condition>
            </if>
        </test>

I hope this helps,
Cheers,
Geneviève

On 08/29/2017 04:36 AM, Bentzin, Norman wrote:

Hello there,

 

I could need some help.

I am working with Trace Compass and I am facing a problem in my XML analysis at the moment.

There might have been a similar problem in this mailing list some weeks ago (submitted by Konrad Kokosa?) but I am not 100% sure if you could find a solution!

 

I am raising alarms with different ID’s:

 

1        <eventHandler eventName="alarm_raised">
2            <stateChange>
3                <stateAttribute type="constant" value="s16" />
4                <stateAttribute type="constant" value="alarm" />
5                <stateAttribute type="eventField" value="ID" />
6                <stateValue type="int" value="1" />
7            </stateChange>
8        </eventHandler>

 

On system start I want to reset all alarms (set them to null). Basically what I want to do is the following:

 

1        <eventHandler eventName="system_start">
2            <stateChange>
3                <stateAttribute type="constant" value="s16" />
4                <stateAttribute type="constant" value="alarm" />
5                <stateAttribute value="*" />
6                <stateValue type="null" />
7            </stateChange> 
8        </eventHandler>

 

Obviously this won’t work without a stateAttribute type in line 5. But neither type=”constant” nor type=”eventField” will work.

 

Is there any proper solution to affect all alarms without knowing their specific ID’s?

 

I am really hoping for a solution! J

Thanks in advance.

 

Best regards,

Norman

---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthaelt vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfaenger dieser E-mail sein, senden Sie bitte diese an den Absender zurueck und loeschen Sie die E-mail aus Ihrem System.


_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tracecompass-dev

 


Back to the top