4 ms·
This is just standard instruction trace. Intel has supported such capability via Intel Processor Trace (PT) since at least 2014 [1]. Here is a full trace recor
by Veserv 1y ago
This is just standard instruction trace.
Intel has supported such capability via Intel Processor Trace (PT) since at least 2014 [1]. Here is a full trace recorder built by Jane Street feeding into standard program trace visualizers [2].
ARM has supported such capability via the standard CoreSight Program Trace Macrocell (PTM)[3]/Embedded Trace Macrocell (ETM)[4] since at least 2000.
If you pair it with standard data trace, which is less commonly available, then you have the prerequisites for a hardware trace time travel debugger as originally seen in the early 2000s [5]
You can get similar performance/function tracing entirely in software via software-instrumented instruction trace and similar debugging information (though less granular performance information) via record-replay time travel debugger recordings.
[1] https://www.intel.com/content/www/us/en/support/articles/000056730/processors.html https://www.intel.com/content/www/us/en/support/articles/000...
[2] https://blog.janestreet.com/magic-trace/ https://blog.janestreet.com/magic-trace/
[3] https://developer.arm.com/documentation/ihi0035/b/Program-Flow-Tracing/About-Program-Flow-Tracing https://developer.arm.com/documentation/ihi0035/b/Program-Fl...
[4] https://developer.arm.com/documentation/ddi0158/d https://developer.arm.com/documentation/ddi0158/d
[5] https://jakob.engbloms.se/archives/1564 https://jakob.engbloms.se/archives/1564
- wmf 1y agoMost Linux devs think Valgrind is a good profiler so if Apple can shame them into being only 10 years behind that's pretty good.
- delta_p_delta_x 1y agoLinux devs in general seem to be quite content with absolutely atrocious tooling.
- sitkack 1y agoSomething something grug printf is all you need. People who LARP as Unix neckbeards rejoice in having nothing. Not content, actively seek out worse solutions. Real Scottish craftspeople enjoy having amazing tooling. They even know how to use a debugger!
- jauntywundrkind 1y agoYour either deep in the shit amazed anything works and respecting the world about you, so happy any tool at all is trying to make things better… Or you have the free time to be a loudmouth online and mouth off about how tech's x y and/or z are dumb and how a shitty bash script is more than enough. Thankfully I think now Linux has some really great tooling now. But very few people have calls of duty where they are called to do super serious work. Mostly the job calls for pretty simple shit. Make the dumb app go. Throw more servers at the problem someday. The tension is real. It's unfortunate that the cutting edge is so spread out, is so far in advance of the main body of devs.
- sitkack 1y agoI agree, and thanks to AI we can scream debuggers at each other online, amazed that THAT actually works.
- snihalani 1y agoI don't get why tho.
- jiggawatts 1y agoWhy use a propriety steam hammer when you can bash things with open source rocks?
- 01HNNWZ0MV43FF 1y agothis but unironically
- wmf 1y agoNah, there are plenty of newer open source tools that people either resist using or don't even know about.
- astrange 1y agoThe most useful performance tool on macOS is spindump, which is just a straightforward whole-system CPU sampler. Second most useful is MallocStackLogging. Other OSes have those too, but they're harder to use and the interfaces aren't as good.
- viraptor 1y agoThe most useful tool was dtrace... Until Apple killed it with M2.
- astrange 1y agoThat's overkill for most things since it relies on being able to patch running kernel code, which is also the definition of an RCE exploit. I think it should work if you run `bputil -c`? Didn't try it though.
- viraptor 1y agoIt just doesn't work at all since M2. I've got a bug report open and confirmed and Apple officially does not care anymore. If you try to run it, it will crash your whole system.
- Someone 1y ago> That's overkill for most things since it relies on being able to patch running kernel code, which is also the definition of an RCE exploit. The idea of dtrace is that you can do that, yes, but to that, you need to be authorized, and the things you can do are (supposed to be) limited to looking to see what’s happening in the system. You can read arguments, but can’t, for example, change the arguments of a system call or disable authorization checks on system calls.
- astrange 1y agoThe reason dtrace doesn't work by default is the kernel memory is locked down so nothing can write to it. There are no exceptions to this even if you're authorized. (Or rather, the exception requires restarting the machine to turn the security off.)
- joshvm 1y agoI was going to ask, isn't this basically callgrind? I used that a lot in grad school to optimise our group's code (on an iMac no less). Incredibly useful and there are some nice visualisation / inspection tools.
- jesse__ 1y ago10/10 comment
- sthomps 1y agoYes, and Intel Processor Trace (IPT) can be used for more than just performance - we use it for very specific memory protection security (see more: https://info.preludesecurity.com/hubfs/Content/Closing%20the%20Execution%20Gap.pdf https://info.preludesecurity.com/hubfs/Content/Closing%20the...)
- pdhborges 1y ago>> ARM has supported such capability via the standard CoreSight Program Trace Macrocell (PTM)[3]/Embedded Trace Macrocell (ETM)[4] since at least 2000. Where are the performace tools that wrap those capabilities? IPT has Magic Trace what is the equivalent tool for ARM?
- Veserv 1y agoGreen Hills Software Path Analyzer[1] and newer History[2] which likely invented or at least popularized the modern trace/callstack visualization used by Perfetto, Firefox Profiler, etc. Segger trace[3]. Lauterbach trace[4]. TI Code Composer trace[5]. [1] https://www.ghs.com/video/debug_in_minutes.html https://www.ghs.com/video/debug_in_minutes.html [2] https://ghs.com/products/MULTI_IDE.html https://ghs.com/products/MULTI_IDE.html [3] https://youtu.be/sT7N580EI-M?si=53S_DQ5E4IN8AXqM https://youtu.be/sT7N580EI-M?si=53S_DQ5E4IN8AXqM [4] https://www2.lauterbach.com/pdf/trace_tutorial.pdf https://www2.lauterbach.com/pdf/trace_tutorial.pdf [5] https://software-dl.ti.com/ccs/esd/documents/users_guide_ccs_theia/ccs_debug-trace.html https://software-dl.ti.com/ccs/esd/documents/users_guide_ccs...