@@ -765,6 +765,25 @@ func buildPerfettoJsonFromBuildTimings(buildTimings: [String:BuildTiming]) -> St
765
765
// Also sort or assign a sort_index to the tracks. Sort biggest to smallest.
766
766
// Make the threadName for the track be the short filename.
767
767
768
+ // add the thread names, only using 3 threads
769
+ if true {
770
+ var event = CatapultEvent ( )
771
+ event. name = " thread_name "
772
+ let names = [ " ParseTime " , " ParseCount " , " OptimizeTime " ]
773
+ for i in 0 ..< 3 {
774
+ event. args = [ : ]
775
+ event. args![ " name " ] = AnyCodable ( names [ i] )
776
+ event. tid = i
777
+ event. ph = " M "
778
+
779
+ // may not need these, but needed for sort below
780
+ event. ts = 0
781
+ event. dur = 0
782
+
783
+ events. append ( event)
784
+ }
785
+ }
786
+
768
787
for buildTiming in buildTimings {
769
788
let t = buildTiming. value
770
789
@@ -777,8 +796,16 @@ func buildPerfettoJsonFromBuildTimings(buildTimings: [String:BuildTiming]) -> St
777
796
event. ts = 0 // do we need this, just more data to encode
778
797
event. dur = t. duration
779
798
event. ph = " X "
780
- event. tid = t. type == " Source " ? 0 : 1
799
+ let isHeader = t. type == " Source "
800
+ event. tid = isHeader ? 0 : 2
781
801
events. append ( event)
802
+
803
+ // add count in seconds, so can view sorted by count below the duration above
804
+ if isHeader {
805
+ event. tid = 1
806
+ event. dur = t. count * 10000 // in 0.1 secs, but high counts dominate the range then
807
+ events. append ( event)
808
+ }
782
809
}
783
810
784
811
// TODO: sort this by the duration
@@ -1709,15 +1736,6 @@ A tool to help profile mem, perf, and builds.
1709
1736
// https://forums.developer.apple.com/forums/thread/740591
1710
1737
1711
1738
CommandGroup ( after: . toolbar) {
1712
- // must call through NSWindow
1713
- Button ( " See Below " ) {
1714
- // Window isn't set in AppDelegate, so menu item is skipped.
1715
- // But add fn+F menu item into app. So many stupid hacks.
1716
- // Can also go NSApp.windows.first, but not good w/multiple windows.
1717
-
1718
- appDelegate. window? . toggleFullScreen ( nil )
1719
- }
1720
-
1721
1739
// TODO: only enable if build files are present
1722
1740
// eventually don't run this on all, maybe find those related to selection
1723
1741
Button ( " Build Report " ) {
@@ -1728,6 +1746,15 @@ A tool to help profile mem, perf, and builds.
1728
1746
}
1729
1747
}
1730
1748
. disabled ( selection == nil )
1749
+
1750
+ // must call through NSWindow
1751
+ Button ( " See Below " ) {
1752
+ // Window isn't set in AppDelegate, so menu item is skipped.
1753
+ // But add fn+F menu item into app. So many stupid hacks.
1754
+ // Can also go NSApp.windows.first, but not good w/multiple windows.
1755
+
1756
+ appDelegate. window? . toggleFullScreen ( nil )
1757
+ }
1731
1758
}
1732
1759
1733
1760
CommandGroup ( replacing: . appInfo) {
0 commit comments