<html>
<body>
<div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src</tt></b></td></tr>
<tr><td><tt>sh4/<a href="#file1">sh4.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">266e7a1bae90 -> 1cc9bb0b3848</td></tr>
<tr class="alt" style=";" ><td><tt> /<a href="#file2">sh4trans.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+11</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">266e7a1bae90 -> 1cc9bb0b3848</td></tr>
<tr><td><tt> /<a href="#file3">sh4trans.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+5</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">266e7a1bae90 -> 1cc9bb0b3848</td></tr>
<tr class="alt" style=";" ><td><tt>xlat/<a href="#file4">xltcache.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+12</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-20</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">266e7a1bae90 -> 1cc9bb0b3848</td></tr>
<tr><td><tt> /<a href="#file5">xltcache.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+13</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-2</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">266e7a1bae90 -> 1cc9bb0b3848</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+42</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-23</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >5 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Rearrange the profile dump code so as to avoid xlat => SH4 references
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>sh4.c</b></big> <small id="info" style="color: #888888;" >266e7a1bae90 -> 1cc9bb0b3848</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4.c
+++ lxdream/src/sh4/sh4.c
@@ -236,7 +236,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > sh4r.new_pc = sh4r.pc+2;
sh4r.in_delay_slot = FALSE;
if( sh4_translate_get_profile_blocks() ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >xlat</span>_dump_cache_by_activity(30);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >sh4_translate</span>_dump_cache_by_activity(30);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
}
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>sh4trans.c</b></big> <small id="info" style="color: #888888;" >266e7a1bae90 -> 1cc9bb0b3848</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4trans.c
+++ lxdream/src/sh4/sh4trans.c
@@ -292,3 +292,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > sh4_translate_disasm_block( stderr, code, sh4_pc, NULL );
}
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void sh4_translate_dump_cache_by_activity( unsigned int topN )
+{
+ struct xlat_block_ref blocks[topN];
+ topN = xlat_get_cache_blocks_by_activity(blocks, topN);
+ unsigned int i;
+ for( i=0; i<topN; i++ ) {
+ fprintf( stderr, "0x%08X (%p): %d \n", blocks[i].pc, blocks[i].block->code, blocks[i].block->active);
+ sh4_translate_disasm_block( stderr, blocks[i].block->code, blocks[i].pc, NULL );
+ fprintf( stderr, "\n" );
+ }
+}
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/sh4</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>sh4trans.h</b></big> <small id="info" style="color: #888888;" >266e7a1bae90 -> 1cc9bb0b3848</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/sh4/sh4trans.h
+++ lxdream/src/sh4/sh4trans.h
@@ -171,6 +171,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > */
void sh4_translate_disasm_block( FILE *out, void *code, sh4addr_t source_start, void *native_pc );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/**
+ * Dump the top N blocks in the SH4 translation cache
+ */
+void sh4_translate_dump_cache_by_activity( unsigned int topN );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #ifdef __cplusplus
}
#endif
</pre></div>
<hr /><a name="file4" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/xlat</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>xltcache.c</b></big> <small id="info" style="color: #888888;" >266e7a1bae90 -> 1cc9bb0b3848</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/xlat/xltcache.c
+++ lxdream/src/xlat/xltcache.c
@@ -583,11 +583,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #endif
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-typedef struct {
- xlat_cache_block_t block;
- sh4addr_t sh4_pc;
-} block_sh4_entry;
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > unsigned int xlat_get_active_block_count()
{
unsigned int count = 0;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -601,14 +596,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > return count;
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-unsigned int xlat_get_active_blocks( <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >block_sh4_entry</span> *blocks, unsigned int size )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+unsigned int xlat_get_active_blocks( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >struct xlat_block_ref</span> *blocks, unsigned int size )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
unsigned int count = 0;
xlat_cache_block_t ptr = xlat_new_cache;
while( ptr->size != 0 ) {
if( ptr->active != 0 ) {
blocks[count].block = ptr;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- blocks[count].<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >sh4_</span>pc = 0;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ blocks[count].pc = 0;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > count++;
}
if( count >= size )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -618,7 +613,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > return count;
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void xlat_get_block_sh4addrs( <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >block_sh4_entry</span> *blocks, unsigned int size )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void xlat_get_block_sh4addrs( <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >struct xlat_block_ref</span> *blocks, unsigned int size )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
unsigned i;
for( i=0; i<XLAT_LUT_PAGES;i ++ ) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -631,7 +626,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > sh4addr_t pc = XLAT_ADDR_FROM_ENTRY(i,j);
for( unsigned k=0; k<size; k++ ) {
if( blocks[k].block == ptr ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- blocks[k].<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >sh4_</span>pc = pc;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ blocks[k].pc = pc;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > ptr = ptr->chain;
if( ptr == NULL )
break;
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -649,26 +644,23 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
static int xlat_compare_active_field( const void *a, const void *b )
{
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- const block_sh4_entry *ptra = (const block_sh4_entry *)a;
- const block_sh4_entry *ptrb = (const block_sh4_entry *)b;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ const struct xlat_block_ref *ptra = (const struct xlat_block_ref *)a;
+ const struct xlat_block_ref *ptrb = (const struct xlat_block_ref *)b;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > return ptrb->block->active - ptra->block->active;
}
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void xlat_dump_cache_by_activity( unsigned int topN )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+unsigned int xlat_get_cache_blocks_by_activity( xlat_block_ref_t outblocks, size_t topN )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
int i=0;
int count = xlat_get_active_block_count();
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- block_sh4_entry blocks[count];
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ struct xlat_block_ref blocks[count];
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > xlat_get_active_blocks(blocks, count);
xlat_get_block_sh4addrs(blocks,count);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- qsort(blocks, count, sizeof(<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >block_sh4_entry</span>), xlat_compare_active_field);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ qsort(blocks, count, sizeof(<span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >struct xlat_block_ref</span>), xlat_compare_active_field);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- if( topN == 0 || topN > count )
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ if( topN > count )
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > topN = count;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- for( unsigned int i=0; i<topN; i++ ) {
- fprintf(stderr, "0x%08X (%p): %d\n", blocks[i].sh4_pc, blocks[i].block->code, blocks[i].block->active);
- sh4_translate_disasm_block( stderr, blocks[i].block->code, blocks[i].sh4_pc, NULL );
- fprintf(stderr, "\n");
- }
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ memcpy(outblocks, blocks, topN*sizeof(struct xlat_block_ref));
+ return topN;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
</pre></div>
<hr /><a name="file5" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/xlat</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>xltcache.h</b></big> <small id="info" style="color: #888888;" >266e7a1bae90 -> 1cc9bb0b3848</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/xlat/xltcache.h
+++ lxdream/src/xlat/xltcache.h
@@ -183,10 +183,21 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void xlat_check_integrity();
/**
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * Dump out the top N translated blocks by number of executions (requires block
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Short record with block + pc, used for activity dumps
+ */
+typedef struct xlat_block_ref {
+ xlat_cache_block_t block;
+ uint32_t pc;
+} *xlat_block_ref_t;
+
+/**
+ * Fetch the top numRecords translated blocks by number of executions (requires block
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > * profiling to be turned on in order to give meaningful results).
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * @param topN Number of blocks to print. If 0, print all blocks in the cache
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * @param topN Number of blocks to print.
+ * @return the number of records retrieved
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > */
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+unsigned int xlat_get_cache_blocks_by_activity( xlat_block_ref_t records, size_t numRecords );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void xlat_dump_cache_by_activity( unsigned int topN );
#endif /* lxdream_xltcache_H */
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>