16 November 2023, 15:18 | #1 |
Registered User
Join Date: Aug 2013
Location: Germany
Posts: 82
|
Data cache hit/miss ratio analyser
I found an interesting discussion and eventually understood how the data cache of the 68040/60 is working. (at least I think so ;-) https://stackoverflow.com/questions/...29152#48029152
There are also two gif animations showing which memory of an example program is cached. Would it be difficult/possible to add some kind of cache analysis to the debugger? My current idea would be set a start and end breakpoint when start reached, enable cache analysis (assume empty cache) when end breakoint reached, stop cache analysis and read statistics. hits vs. miss ratio could be displayed. Or is something like that already possible in winuae? Do we have statistics counters already? |
16 November 2023, 19:05 | #2 |
Registered User
Join Date: Jul 2014
Location: Finland
Posts: 1,192
|
I think for this to be doable is for the exact cache behavior of the 040 and 060 to be documented, which i'm not sure it is.
|
17 November 2023, 17:36 | #3 |
Registered User
Join Date: Aug 2013
Location: Germany
Posts: 82
|
The goal would be for instance to find data that are really heavily used and are spread in "critical stride distances" over memory.
|
21 November 2023, 10:55 | #4 |
Registered User
Join Date: Nov 2018
Location: Germany
Posts: 119
|
The cache behavior is pretty well documented. For example, 68040 Users Manual section 4.1 describes how everything is working including selection of cache line within a set which should be used next. So yeah, such statistics could be eventually implemented. Ofc not in case of real 68040 since it does not do such stats internally.
|
21 November 2023, 14:54 | #5 |
Registered User
Join Date: Aug 2013
Location: Germany
Posts: 82
|
|
21 November 2023, 18:26 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,596
|
Do you mean two counters, cache hits and misses? (separate counters for code and data) that some debugger command would reset/output?
But I am not sure if it returns any useful number(s) because part of test code might be (accidentally) already cached. Should cache counter reset command also (optionally) flush the cache? Anything more complex would make emulation even more slower. Cache emulation does what datasheets say but it can't be 100% perfect because order of instruction's internal memory operations are not defined. |
23 November 2023, 00:36 | #7 | ||
Registered User
Join Date: Aug 2013
Location: Germany
Posts: 82
|
Quote:
Yes. We could run to a breakpoint before a very time consuming loop for instance. Then reset the counters, continue and run to a second breakpoint directly after this loop. Now sow the counters. Quote:
I guess the cache misses at the begin of such a routine are unavoidable/impossible to predict. Bit in a heavily used routine that shouldn't have big impact to the ratio? But yes, flushing the caches seems to be a good idea go give more reproduceable rsults. Ideally I would like to have some indication if/how I could for instance improve the data cache hit rate by reorganising/shrinking data structures, which code needs to be made smaller or needs to be moved to better fit into the instruction cache lines and wich opcodes cause pipeline stalls... No idea if that really helps a developer but only WinUAE could provide such insights into the internals. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble with chip ram data cache | remz | support.WinUAE | 11 | 19 February 2023 13:28 |
BsdSocket Libray With Data cache emulation | Zilog | support.WinUAE | 2 | 30 July 2019 20:31 |
"Data Cache Emulation" configuration not saved(?) | oRBIT | support.WinUAE | 5 | 30 March 2019 19:01 |
Is it really hit & miss with CF-IDE adapters? | Amiga1992 | Hardware mods | 17 | 27 April 2010 22:49 |
Hit and miss writing ADF's | vimfuego | support.Other | 34 | 23 September 2009 03:44 |
|
|