Saagar Jha

(replying to Saagar Jha)
The process, of course, gets traced anyway because it don't care what the kernel thinks is impossible.

https://github.com/saagarjha/dotfiles/blob/master/fix_processor_trace.c
1 replies →
1 replies

tbodt

(replying to Saagar Jha)

@saagar amfitrustedkeys eta wen

Saagar Jha

(replying to tbodt)
@tbodt I thought you were working on it

tbodt

(replying to Saagar Jha)

@saagar depends on how you define working

Saagar Jha

(replying to Saagar Jha)
Now we’re getting somewhere. Not fast, mind you, but somewhere
Screenshot of Instruments running a Processor Trace against unxip on Saagar’s Software MacBook Air. The trace has been stopped after 5 seconds and is “Analyzing/Transferring Data”.
1 replies →
1 replies

Joachim

(replying to Saagar Jha)

@saagar yeah, there is a *lot* of data in there.

Saagar Jha

(replying to Saagar Jha)
CPU traces can be very large so Instruments helpfully provides an option asking you how much storage space you want to spare. For this 5 second trace I told it to use 10 GB. So far it has used 300 GB and it’s showing no signs of stopping (FB17151084)
1 replies →
1 replies

Jonathan Hendry

(replying to Saagar Jha)

@saagar

Does it let you choose where to put it?

Saagar Jha

(replying to Jonathan Hendry)
@jonhendry The intermediate stuff? No it goes in /var/folders or whatever. I don’t have the courage to try to save the resulting file

Jonathan Hendry

(replying to Saagar Jha)

@saagar

So not something people with a small boot drive should attempt. If it's using that much disk it really ought to let you stuff it on an external drive.

Saagar Jha

(replying to Saagar Jha)
It’s beautiful…
The analyzed trace, showing all tracks filled (but not expanded). The cursor is hovering over one track, actually one stack frame, showing that it is “specialized Array.init(_unsafeUninitializedCapacity:initializingWith:) (8.00ms)”
2 replies →
2 replies

James Atkinson

(replying to Saagar Jha)

@saagar maybe @KacperHarasim can advise?


Pierre H.

(replying to Saagar Jha)

@saagar isn’t it?!

Saagar Jha

(replying to Saagar Jha)
Ever wondered system libraries have initializers? How about which ones are the most expensive? Which one is the first to touch the Objective-C runtime? Well here’s your answer in a single image
Screenshot of early dyld initialization, specifically libSystem_initializer calling _libc_initializer, _sanitizers_init, __malloc_init, _dyld_initializer, dyld4::APIs::_libdyld_initialize(), libdispatch_init, _libxpc_initializer in that order
4 replies →
4 replies

Adam Bell :catPOWER:

(replying to Saagar Jha)

@saagar this is actually so sick


Ben Scheirman

(replying to Saagar Jha)

@saagar do you mean "static initializers” ?

Saagar Jha

(replying to Ben Scheirman)
@bens They’re morally kind of similar but I would shy away from calling them that because they are invoked differently

Pierre H.

(replying to Saagar Jha)

@saagar you have no idea how familiar I am with this particular image.


Joachim

(replying to Saagar Jha)

@saagar also you can now see how much time objc_msgSend actually takes in your app. And how often it was called.

Saagar Jha

(replying to Joachim)
@cocoafrog Of course there’s always DTrace for that ;)

Joachim

(replying to Saagar Jha)

@saagar not in iOS, iirc ;)

Saagar Jha

(replying to Joachim)
@cocoafrog Yeah the iOS people are mean

Saagar Jha

(replying to Saagar Jha)
Anyway I have actual work to do so I’ll play with this later. It’s very rough but also very cool and I expect it to be invaluable for any serious performance or debugging work. I hope to see it continue to improve :)

Saagar Jha

(replying to Saagar Jha)
Also, fair warning: the entire process to generate the screenshots above created about 4 TB of disk traffic. Hopefully you have AppleCare
4 replies →
4 replies

Jevin Sweval

(replying to Saagar Jha)

@saagar fffffffuuuuuuuuuuuu well that’s disappointing. Guess we need to figure out how to plug one of the 4U units in.

exostivlabs.com/exostiv-blade/

Kacper Harasim

(replying to Jevin Sweval)

@jevinskie @saagar Developers can control how much data gets recorded using the recording options ("Limit to:"). We recommend starting with smaller traces, which should not consume as much RAM and load faster as well. We're devoted to continuing to optimize this experience and offering reasonable performance for larger traces over time.

Saagar Jha

(replying to Kacper Harasim)
@KacperHarasim @jevinskie Curious what this number corresponds to

Jevin Sweval

(replying to Saagar Jha)

@saagar is it tracev3 format? I wonder if some other compressor could be hooked in…
Any idea how the trace system avoids self-tracing/minimizes perturbation?

Pierre H.

(replying to Jevin Sweval)

@jevinskie @saagar that’s not how tracing works. The CPU traces everything and then the trace is post processed. You know which asid is current and prune it


Paul Haddad :tapbots_logo:

(replying to Saagar Jha)

@saagar what was the RAM usage?

Saagar Jha

(replying to Paul Haddad :tapbots_logo:)
@paul Not too bad. Swapped a bit but I did this on a 16 GB MacBook Air

Siguza

(replying to Saagar Jha)

@saagar could that be "fixed" with a ramdisk mount?

2 replies →
2 replies

spv

(replying to Siguza)

@siguza @saagar brb installing 8TB of ram in my macbook… lmao

Siguza

(replying to spv)

@spv that's not what traffic means.

spv

(replying to Siguza)

@siguza touche, i can't read


Saagar Jha

(replying to Siguza)
@siguza You’d need one of the new Mac Studios probably