4 ms·
For comparison, I strongly recommend everyone check out Blinkenlights https://justine.lol/blinkenlights/ https://justine.lol/blinkenlights/ It's billed as a "d
by john-tells-all 5y ago
For comparison, I strongly recommend everyone check out Blinkenlights https://justine.lol/blinkenlights/ https://justine.lol/blinkenlights/
It's billed as a "debugger"... but it has an entire x86 emulator! The code is very small and clear. Written by national treasure Justine Tunney, of Redbean fame.
I'm considering modifying it to count x86 calls, to trace an executable running, to find hotspots and code that doesn't get called.
- mhh__ 5y agoWhy not just use one of the many many tools that already to do that kind of analysis? Valgrind, Pin etc.
- rackjack 5y agoI think check out =/= use in this case
- mhh__ 5y agoI was talking about the last paragraph, i.e. I was just pointing out that it's well trodden ground lest that OP accidentally wastes their time assuming they wouldn't be doing it for the technical challenge
- jart 5y agoAuthor of Blinkenlights here. I wrote Blinkenlights because I wanted to be able to see my programs running and create MPEG videos on my blog that let people watch progs like SectorLISP run without having to run the code themselves. I also use Blinkenlights to make my software go faster. Commands like `perf record` are great for creating reports, but a lot of information gets lost in translation while aggregating like temporality, page faults, register spillage, and feature utilization. I also needed it to debug booting actually portable executables from bios in a way that could be embedded in a hermetic monorepo with automated testing and a TUI that's snappier and more pleasant to use than bochs or qemu. I wanted an x86-64 emulator that's about 150kb in size so it could be embedded in APE binaries so that they'll run on other cpu architectures. Finally, I wanted the ability to have a security layer where, for example, it's nice to have an emulator that's hackable enough where if some new rowhammer attack comes out then I can change the mapping of physical memory on the fly without having to recompile. It's hard to find software that creates a stronger barrier between software and the cpu/kernel. The only one I know that comes close is Bochs but it's GPL and gVisor but it's syscall-only and huge. It's also just a rare thing to want since all software, e.g. v8, tends to optimize hosted code down to metal on a long enough timeline, regardless of their original intentions, due to the constant push and pull between perf and sec.
- mhh__ 5y agoI was responding to the PC's desire to write an analysis pass. If perf isn't doing the job then you need to use a "proper" profiler like vTune. Perf is really good for the first pass but the analysis it provides is very superficial compared to a better profiler. This is better than analysis in an emulated environment as far as I'm concerned, most simulators don't even come close to mimicing a real processor (even gem5 isn't cycle accurate so if you are latency bound you may get the wrong result) It also can track page faults, if you want to know where they happen you probably want perf mem
- jart 5y agoWould Blinkenlights be proper if I told you that it uses Intel Xed? I'm sure Intel vTune is wonderful but I probably can't use it since I usually don't have access to a desktop. I feel the same way about Valgrind. You have to generate the report, copy it over, spin up the VM, view it in KCacheGrind.
- mhh__ 5y ago> Would Blinkenlights be proper if I told you that it uses Intel Xed? Why would it? I have every faith that the tool is sound (i.e. parses X86 correctly etc.), I was just thinking aloud about this kind of analysis. What do you need to optimize but can't run on a desktop? Or is this the same type of "optimization" that I do fiddling around on compiler explorer? e.g. I like making little snippets faster
- jart 5y agoSorry I wasn't able to answer your question. What have I ever done to make you treat me so disrespectfully? Business must not be going well if you need to come online and grill computer hobbyists like me.