Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory heat maps #827

Open
dirkwhoffmann opened this issue May 26, 2024 · 7 comments
Open

Memory heat maps #827

dirkwhoffmann opened this issue May 26, 2024 · 7 comments
Labels
Enhancement New feature or request

Comments

@dirkwhoffmann
Copy link
Owner

I've just come across this new web port of vAmiga by @coppenheimer, which looks very promising.

One of its standout features is memory heat maps, a feature that could greatly enhance vAmiga's capabilities if supported natively.

There are two main reasons for this project:

  1. Heat maps look cool 😎
  2. At some point, I'd like to add run-ahead to vAmiga as I've implemented it in VirtualC64 5.0, which will be released soon as a beta. A fast cloning logic for virtual machines is a central part of the run-ahead implementation. In the C64 case, I simply copy over memory. In the Amiga case, a smarter memory logic is needed to determine which memory areas are dirty. With some extra effort, this tracking logic should be able to create nice heat maps as a side effect.
@dirkwhoffmann dirkwhoffmann added the Enhancement New feature or request label May 26, 2024
@mithrendal
Copy link
Contributor

@dirkwhoffmann coppenheimer is the name of the web port 🤓 the person behind this seems to be @losso3000

@losso3000
Copy link

Wow, that was fast! :) (Thanks to both of you for your stellar emulator and browser work, by the way.)

A little remark: In Coppenheimer, I didn't really implement a heatmap in the traditional sense (or in the way WinUAE does it with the "vh" debugger feature, highlighting the most recent blitter, bitplane, audio and CPU access locations). Assuming you're talking about the smaller memory overview section, I'm just using sparsely sampled memory contents here to crudely map them to different colors. That was easy to do, looked pretty, and even helps to distinguish different data blocks a bit.

@dirkwhoffmann
Copy link
Owner Author

or in the way WinUAE does it with the "vh" debugger feature

@losso3000 Before you mentioned it in your post about Coppenheimer, I'd never heard about the heatmap feature in UAE. I cannot try it out since I don't have easy access to Windows machines. Do you know, by chance, if there is a YouTube video showing how it looks in practice? I want to gather some ideas about how a pleasant heatmap could look.

@losso3000
Copy link

Sure: https://heckmeck.de/winuae-vh.mp4 (audio crackling b/c my machine is too slow)

@dirkwhoffmann
Copy link
Owner Author

Thanks a lot for the video! Initially, I expected it to look more impressive as the expression "heat map" triggers something like this in me:

Bildschirmfoto 2024-05-26 um 18 50 44

Creating an amazing-looking heat map requires some dynamic glowing effect combined with blurring, I think. With glowing, I mean regions with many accesses steadily increase in brightness and begin to darken when no more accesses happen. This could be done in principle, but a more severe issue is involved. Heat maps are usually two-dimensional, whereas memory is organized in one dimension only. The two concepts only partially fit.

@dirkwhoffmann
Copy link
Owner Author

Some preliminary findings:

The 1D/2D issue could be solved by rearranging the address space, e.g., by doing the same as Karnaugh-Veitch diagrams do in Boolean minimization (there, a 1D truth table is mapped to 2D in a way that assures certain neighboring properties). A corresponding mapping can be achieved like this (code is for a 64KB address space):

    for (isize i = 0; i < 65536; i++) {

        isize x = 0, y = 0;
        if (i & (1 << 15)) y += 128;
        if (i & (1 << 14)) x += 128;
        if (i & (1 << 13)) y += 64;
        if (i & (1 << 12)) x += 64;
        if (i & (1 << 11)) y += 32;
        if (i & (1 << 10)) x += 32;
        if (i & (1 << 9)) y += 16;
        if (i & (1 << 8)) x += 16;
        if (i & (1 << 7)) y += 8;
        if (i & (1 << 6)) x += 8;
        if (i & (1 << 5)) y += 4;
        if (i & (1 << 4)) x += 4;
        if (i & (1 << 3)) y += 2;
        if (i & (1 << 2)) x += 2;
        if (i & (1 << 1)) y += 1;
        if (i & (1 << 0)) x += 1;
        
        // (x,y) is the coordiante of address i in a 256x256 texture

I've already done some experiments with VirtualC64 to see what happens when a heatmap is overlayed on the emulator texture (similar to the DMA debugger approach).

I have to admit, the result looks 🤢

heatmap.mov

Given the unsatisfactory results, I've made the decision to discard the overlay idea. Instead, I will now focus on integrating the heatmap within the memory panel of the inspector. Let's see how it unfolds...

@dirkwhoffmann
Copy link
Owner Author

Update: This is how the new prototype implementation looks like in VirtualC64 5.0b1. Looks much better than the texture overlay...

heatmap.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants