MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / CPU_DumpFragmentCache

Function CPU_DumpFragmentCache

Source/Core/Dynamo.cpp:306–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304//
305//*****************************************************************************
306void CPU_DumpFragmentCache()
307{
308 IO::Directory::EnsureExists( "DynarecDump" );
309
310 FILE * fh( fopen( "DynarecDump/hot_trace_map.html", "w" ) );
311 if( fh != nullptr )
312 {
313 std::vector< SAddressHitCount > hit_counts;
314
315 hit_counts.reserve( gHotTraceCountMap.size() );
316
317 for(std::map<u32,u32>::const_iterator it = gHotTraceCountMap.begin(); it != gHotTraceCountMap.end(); ++it )
318 {
319 hit_counts.push_back( SAddressHitCount( it->first, it->second ) );
320 }
321
322 std::sort( hit_counts.begin(), hit_counts.end(), SortByHitCount );
323
324 fputs( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">", fh );
325 fputs( "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n", fh );
326 fputs( "<head><title>Hot Trace Map</title>\n", fh );
327 fputs( "<link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\" media=\"all\" />\n", fh );
328 fputs( "</head><body>\n", fh );
329 fputs( "<h1>Hot Trace Map</h1>\n", fh );
330 fputs( "<div align=\"center\"><table>\n", fh );
331 fputs( "<tr><th>Address</th><th>Hit Count</th><th>Abort Reason</th></tr>\n", fh );
332
333 for( u32 i = 0; i < hit_counts.size(); ++i )
334 {
335 const SAddressHitCount & info( hit_counts[ i ] );
336
337 u32 abort_reason( info.GetAbortReason() );
338
339 fprintf( fh, "<tr><td>%08x</td><td>%d</td>\n", info.Address, info.HitCount );
340
341 fputs( "<td>", fh );
342 if(abort_reason & CPU_CHECK_EXCEPTIONS) { fputs( " Exception", fh ); }
343 if(abort_reason & CPU_CHECK_INTERRUPTS) { fputs( " Interrupt", fh ); }
344 if(abort_reason & CPU_STOP_RUNNING) { fputs( " StopRunning", fh ); }
345 if(abort_reason & CPU_CHANGE_CORE) { fputs( " ChangeCore", fh ); }
346 fputs( "</td></tr>\n", fh );
347
348 //if( info.HitCount >= gHotTraceThreshold )
349 }
350 fputs( "</table></div>\n", fh );
351 fputs( "</body></html>\n", fh );
352
353 fclose(fh);
354 }
355
356 gFragmentCache.DumpStats( "DynarecDump/" );
357}
358#endif
359
360//*****************************************************************************

Callers

nothing calls this directly

Calls 5

SAddressHitCountClass · 0.85
sizeMethod · 0.80
GetAbortReasonMethod · 0.80
DumpStatsMethod · 0.80
EnsureExistsFunction · 0.50

Tested by

no test coverage detected