I have a custom Instrument with a os-signpost-interval-schema that captures a "state" string. I would like the final plot value to be <state>: <duration>
, but I don't know how to get the duration into the string.
My working schema is the following, which just stores the state itself in the column:
<os-signpost-interval-schema> <id>state-interval</id> <title>State Interval</title> <subsystem>"..."</subsystem> <category>"..."</category> <name>"state"</name> <start-pattern> <message>?state</message> </start-pattern> <column> <mnemonic>state</mnemonic> <title>State</title> <type>string</type> <expression>?state</expression> </column> </os-signpost-interval-schema>
I would like to change the expression in the column to (str-cat ?state ": " ?duration)
, but that fails with:
Variable '?duration' must appear in a pattern element to be used in a later expression.
I don't see any way to compute this later in the graph, lane, or plot. I've also tried explicitly creating a <duration-column>
, but that doesn't seem to change anything.
The rest of the pieces include the table:
<create-table> <id>state-table</id> <schema-ref>state-interval</schema-ref> </create-table>
And the lane, which I would like to display as <state>: <duration>
rather than just the duration:
<lane> <title>State</title> <table-ref>state-table</table-ref> <plot> <value-from>state</value-from> </plot> </lane>
Thank you for the question, Rob. Unfortunately, that is not currently possible.
For start time of an interval, you could bind it to a variable using tag in the start-pattern element (https://apdreview.apple.com/instruments/developer/mac/current/#/dev1074660011), but that's currently not exposed for duration.
Workaround would be to write a custom modeler, which allows you to have full control over the values. I also encourage you to file a feedback with us so that we can make this improvement – I think it's a great idea. I could certainly see that exposing duration as a variable could be quite useful in enriching the plots developers define.
Thanks,
Kacper