xcodexcode-instruments

How to specify symbol/character in os-signpost-point-schema


I have a custom Xcode 13.2.1 (13C100) Instrument to which I have recently added os-signpost-point-schema. I notice that the events are marked with a hyphen/dash rather than a . See the comparison of my custom tool vs the standard “Points of Interest” tool:

enter image description here

I have been digging through the documentation and while I wager that there is some simple attribute that can be set to dictate which symbol is included within the signpost , it is not jumping out at me. How does one select the symbol used within custom event points in Instruments?


Here is the code for the instrument:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Instruments Developer Help: https://help.apple.com/instruments/developer/mac/current/ -->
<package>
    <id>com.robertmryan.CustomInterval</id>
    <version>0.2</version>
    <title>Custom Points of Interest</title>
    <owner>
        <name>Robert Ryan</name>
    </owner>

    <import-schema>os-signpost</import-schema>

    <!-- See https://help.apple.com/instruments/developer/mac/current/#/dev536412616 -->
    <os-signpost-point-schema>
        <id>custom-point-schema</id>
        <title>Points</title>
        <owner>
            <name>Robert Ryan</name>
        </owner>
        <purpose>Provide mechanism for multicolored events posted by `os_signpost`; The string generated by `os_signpost` must be in form of "Label:%d,Concept:%{public}@", where "Label" is string that will control what text appears in the event, and "Concept" is one of the strings listed in https://help.apple.com/instruments/developer/mac/current/#/dev66257045 that dictates the color of the interval. No spaces after the commas within this string.</purpose>
        <note>That message must use that printf-style format, not embedding the values in the format string literal.</note>

        <!-- you can constrain this to a particular subsystem if you'd like:
        <subsystem>"com.domain.MyApp"</subsystem>
        -->
        <category>"Interval"</category>
        <name>?name</name>

        <pattern>
            <message>"Label:" ?label ",Concept:" ?concept</message>
        </pattern>

        <column>
            <mnemonic>name</mnemonic>
            <title>Name</title>
            <type>string</type>
            <expression>?name</expression>
        </column>
        <column>
            <mnemonic>label</mnemonic>
            <title>Label</title>
            <type>string</type>
            <expression>?label</expression>
        </column>
        <column>
            <mnemonic>concept</mnemonic>
            <title>Concept</title>
            <type>event-concept</type>
            <expression>?concept</expression>
        </column>
    </os-signpost-point-schema>

    <os-signpost-interval-schema>
        <id>custom-interval-schema</id>
        <title>Intervals</title>
        <owner>
            <name>Robert Ryan</name>
        </owner>
        <purpose>Provide mechanism for multicolored intervals posted by `os_signpost`; The string generated by `os_signpost` must be in form of "Label:%d,Concept:%{public}@", where "Label" is string that will control what text appears in the interval, and "Concept" is one of the strings listed in https://help.apple.com/instruments/developer/mac/current/#/dev66257045 that dictates the color of the interval. No spaces after the commas within this string.</purpose>
        <note>That message must use that printf-style format, not embedding the values in the format string literal.</note>

        <!-- you can constrain this to a particular subsystem if you'd like:
        <subsystem>"com.domain.MyApp"</subsystem>
        -->
        <category>"Interval"</category>
        <name>?name</name>

        <start-pattern>
            <message>"Label:" ?label ",Concept:" ?concept</message>
        </start-pattern>

        <column>
            <mnemonic>name</mnemonic>
            <title>Name</title>
            <type>string</type>
            <expression>?name</expression>
        </column>
        <column>
            <mnemonic>label</mnemonic>
            <title>Label</title>
            <type>string</type>
            <expression>?label</expression>
        </column>
        <column>
            <mnemonic>concept</mnemonic>
            <title>Concept</title>
            <type>event-concept</type>
            <expression>?concept</expression>
        </column>
    </os-signpost-interval-schema>

    <instrument>
        <id>com.robertmryan.CustomInterval.instrument</id>
        <title>Custom Points of Interest</title>
        <category>Behavior</category>
        <purpose>Provide multi-colored intervals as dictated by the "event-concept" parsed from the `start-pattern` string.</purpose>
        <icon>Generic</icon>
        <limitations></limitations>
        <create-table>
            <id>custom-interval-table</id>
            <schema-ref>custom-interval-schema</schema-ref>
        </create-table>
        <create-table>
            <id>custom-point-table</id>
            <schema-ref>custom-point-schema</schema-ref>
        </create-table>

        <graph>
            <title>Custom Interval Graph</title>
            <lane>
                <title>Points</title>
                <table-ref>custom-point-table</table-ref>
                <plot-template>
                    <instance-by>name</instance-by>
                    <label-format>%s</label-format>
                    <value-from>name</value-from>
                    <color-from>concept</color-from>
                    <label-from>label</label-from>
                </plot-template>
            </lane>
            <lane>
                <title>Intervals</title>
                <table-ref>custom-interval-table</table-ref>
                <plot-template>
                    <instance-by>name</instance-by>
                    <label-format>%s</label-format>
                    <value-from>name</value-from>
                    <color-from>concept</color-from>
                    <label-from>label</label-from>
                    <qualified-by>layout-qualifier</qualified-by>
                </plot-template>
            </lane>
        </graph>

        <list>
            <title>Custom Regions of Interest</title>
            <table-ref>custom-interval-table</table-ref>
            <column>name</column>
            <column>label</column>
            <column>concept</column>
            <column>start</column>
            <column>duration</column>
        </list>

        <list>
            <title>Custom Points of Interest</title>
            <table-ref>custom-point-table</table-ref>
            <column>name</column>
            <column>label</column>
            <column>concept</column>
        </list>
    </instrument>
</package>

Solution

  • I posted this on the Apple forums, too, and received this answer:

    … To customize the icon that is set in the point rendering scenario, your type that is selected in your value-from field needs to have a "Special Value Treatment" defined. In your case, instead of using name, you could safely use event-concept.

    The mapping between Value -> (Icon, Color) can be found in the etype documentation. For event concept, that would be: https://help.apple.com/instruments/developer/mac/current/#/dev66257045

    Please let me know if that helps!

    Kacper

    Posted 57 minutes ago by kacperh_

    In short, the event-concept can control both the color and the symbol for the event, too.


    So, I replaced the value-from in the points lane to use the parsed event-concept string, just like the color-from was doing:

    <lane>
        <title>Points</title>
        <table-ref>custom-point-table</table-ref>
        <plot-template>
            <instance-by>name</instance-by>
            <label-format>%s</label-format>
            <value-from>concept</value-from>
            <color-from>concept</color-from>
            <label-from>label</label-from>
        </plot-template>
    </lane>
    

    And that yielded:

    enter image description here