|Re: [tracecompass-dev] Getting duration for intervals in CallStackView|
Hi David, Sorry for the late reply, I recently came back from vacation.Glad to hear you were able to solve your problem. The state system DB is indeed quite flexible, you can do all sorts of little hacks to track additional information. I've done it a lot ;)
One trick that I think is worth mentioning that few people know about is the ITmfStateSystemBuilder#updateOngoingState() method. It is very useful if you want to create a state but you only know its real value at the end event. The "ongoing state" is always stored in memory, and only gets committed to the database whenever a new modfiyAttribute() or similar overwrites it. So you can always change it before it gets committed. Think of it like a "git commit --amend".
So for example, if you want a state interval that begins at startTime and ends at endTime, but you will only know its value at the endTime event, you could do:
modifyAttribute(startTime, tempValue, attribute); updateOngoingState(realValue, attribute); modifyAttribute(endTime, nextValue, attribute);This will make "realValue" last from startTime to endTime. "tempValue" could be a null value, or a specific custom value that is only meant to be used temporarily. A separate verification pass could check that there are none of these temporary values left in the final state database.
Hope this helps! Alexandre On 2016-08-17 09:35 AM, David Wootton wrote:
I'm able to update the state system to add additional attributes that I want to appear in the popup that appears when I hover the mouse over an interval in my extension of CallStackView. This works if I have an attribute I know the value of an attribute at the start event of the interval, where I push and pop the quark with this value. I have some attributes that I know the value of only at the end event for the interval that I want to display similarly. If I push and pop a quark that contains the value, then that value appears in the State System Explorer view for the time/duration between the push and pop of the quark. The problem is that I don't seem to have either the start time or the duration for the interval at the time that the end event is being processed. I can make this work by creating another attribute/quark that contains the interval start time, and push the quark for that attribute in the processing for the entry event then get that quark in the exit event processing, use the value and pop the quark. I'm wondering if there's a better way to do this. Thanks Dave
Back to the top