Created
May 8, 2020 14:14
-
-
Save markd2/2cd2b63640d00ff47c46da96bc85eadd to your computer and use it in GitHub Desktop.
Trying to create a custom instruments (without CLIPS right now), and I think I have the patterns hooked up correctly, but no data is appearing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Writing a custom instrument. | |
Have this in code in the app | |
``` | |
@implementation MJSignpost | |
+ (os_log_t) log { | |
static os_log_t log; | |
if (log == 0) { | |
// can try different categories | |
log = os_log_create("com.appname.signposts", "MusicLayout"); | |
} | |
return log; | |
} // log | |
@end | |
// ... | |
os_signpost_interval_begin(MJSignpost.log, | |
OS_SIGNPOST_ID_EXCLUSIVE, | |
"Space Measure", | |
"Spacing measure %{xcode:int64}llu", | |
(unsigned long long)measureIndex); | |
// do something pretty expensive | |
NSInteger elementCount = // calculate a weight | |
os_signpost_interval_end(MJSignpost.log, | |
OS_SIGNPOST_ID_EXCLUSIVE, | |
"Space Measure", | |
"Finished Spacing stack count %{xcode:uint64}llu", | |
(unsigned long long)elementCount); | |
``` | |
and have this XML file | |
``` | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<package> | |
<id>com.appname.Layout-Instruments</id> | |
<title>Layout Instruments</title> | |
<owner> | |
<name>App Name</name> | |
</owner> | |
<os-signpost-interval-schema> | |
<id>space-measure</id> | |
<title>Spacing Measure</title> | |
<subsystem>"com.appname.signposts"</subsystem> | |
<category>"MusicLayout"</category> | |
<name>"Spacing Measures"</name> | |
<start-pattern> | |
<message>"Spacing measure " ?measure-index</message> | |
</start-pattern> | |
<end-pattern> | |
<message>"Finished Spacing stack count " ?measure-elements</message> | |
</end-pattern> | |
<column> | |
<mnemonic>measure-index</mnemonic> | |
<title>Index</title> | |
<type>uint64</type> | |
<expression>?measure-index</expression> | |
</column> | |
<column> | |
<mnemonic>measure-elements</mnemonic> | |
<title>Elements</title> | |
<type>uint64</type> | |
<expression>?measure-elements</expression> | |
</column> | |
<column> | |
<mnemonic>impact</mnemonic> | |
<title>Impact</title> | |
<type>event-concept</type> | |
<expression>(if (> ?measure-elements 50) then "High" else "Low")</expression> <!-- c.f. https://help.apple.com/instruments/developer/mac/current/#/dev66257045 --> | |
</column> | |
</os-signpost-interval-schema> | |
<instrument> | |
<id>com.appname.signposts-layout</id> | |
<title>MusicJot Layout</title> | |
<category>Behavior</category> | |
<purpose>Profile score layout work</purpose> | |
<icon>Generic</icon> | |
<create-table> | |
<id>space-measures</id> | |
<schema-ref>space-measure</schema-ref> | |
</create-table> | |
<!-- Define graph to draw for your Instrument (optional) --> | |
<graph> | |
<title>Measure Spacing</title> | |
<lane> | |
<title>Measures</title> | |
<table-ref>space-measures</table-ref> | |
<plot-template> | |
<instance-by>measure-index</instance-by> | |
<label-format>%d</label-format> | |
<value-from>impact</value-from> | |
<label-from>measure-elements</label-from> | |
<disable-implicit-qualifier>true</disable-implicit-qualifier> <!-- Disables the implicit use of layout information in the table. _not terribly useful --> | |
</plot-template> | |
</lane> | |
</graph> | |
<!-- Define at least one detail view for your Instrument --> | |
<list> | |
<title>Measure Layout</title> | |
<table-ref>space-measures</table-ref> | |
<column>start</column> | |
<column>duration</column> | |
<column>measure-index</column> | |
<column>measure-elements</column> | |
</list> | |
<aggregation> | |
<title>Summary: Elements</title> | |
<table-ref>space-measures</table-ref> | |
<hierarchy> | |
<level> | |
<column>measure-index</column> | |
</level> | |
</hierarchy> | |
<column> | |
<count /> | |
</column> | |
<column> | |
<sum>measure-elements</sum> | |
</column> | |
</aggregation> | |
<time-slice> | |
<title>Time Slice: Elements</title> | |
<table-ref>space-measures</table-ref> | |
<column>start</column> | |
<column>duration</column> | |
<column>measure-index</column> | |
<column>measure-elements</column> | |
</time-slice> | |
</instrument> | |
</package> | |
``` | |
I'm seeing the sign post data coming in to instruments, but nothing is appearing in the lane. | |
In the os_signpost table I'm seeing: | |
``` | |
V Space Measure | |
V Spacing measure 1 | |
Finished Spacing stack count 495 | |
V Spacing measure 2 | |
Finished Spacing stack count 495 | |
``` | |
Not sure how to approach debugging this. Looking in the instrument info panel, the schema is there, and the table has zero rows. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment