如何在 os-signpost-point-schema 中指定 symbol/character

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

我有一个自定义 Xcode 13.2.1 (13C100) 仪器,我最近添加了 os-signpost-point-schema。我注意到事件标有 hyphen/dash 而不是 。查看我的自定义工具与标准“兴趣点”工具的比较:

我一直在挖掘 documentation,虽然我打赌可以设置一些简单的属性来指示路标 中包含哪个符号,但它不会跳出来对我。 select 在 Instruments 中的自定义事件点中使用的符号如何?


这是仪器的代码:

<?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>

我也在 Apple 论坛上 posted this,并收到了这个答案:

… 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_

简而言之,event-concept也可以控制事件的颜色和符号。


因此,我将点数通道中的 value-from 替换为使用已解析的 event-concept 字符串,就像 color-from 所做的那样:

<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>

结果是: