Rob Napier
Rob Napier

Reputation: 299345

In custom Instrument, how can I include the duration in a value

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>

Upvotes: 1

Views: 125

Answers (1)

Rob Napier
Rob Napier

Reputation: 299345

This turns out to be impossible. Apple does not expose duration as a variable. It can be solved by writing a custom modeler, though this adds a lot of complexity.

Upvotes: 1

Related Questions