1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
18 #include <iostream> // I hope this doesn't break anything
22 #include "Common.h" // for Common::swap
26 // =======================================================================================
27 // For PB address detection
30 // This will only work on GC, not Wii.
31 u32 RAM_MASK
= 0x1FFFFFF;
33 u16
Memory_Read_U16(u32 _uAddress
)
35 return Common::swap16(*(u16
*)&g_dsp
.cpu_ram
[_uAddress
& RAM_MASK
]);
38 u32
Memory_Read_U32(u32 _uAddress
)
40 return Common::swap32(*(u32
*)&g_dsp
.cpu_ram
[_uAddress
& RAM_MASK
]);
43 void* Memory_Get_Pointer(u32 _uAddress
)
45 return &g_dsp
.cpu_ram
[_uAddress
& RAM_MASK
];
50 #define PROFILE_MAP_SIZE 0x10000
52 u64 g_profileMap
[PROFILE_MAP_SIZE
];
53 bool g_profile
= false;
60 void ProfilerAddDelta(int _addr
, int _delta
)
64 g_profileMap
[_addr
] += _delta
;
70 memset(g_profileMap
, 0, sizeof(g_profileMap
));
73 void ProfilerDump(u64 count
)
75 FILE* pFile
= fopen("DSP_Prof.txt", "wt");
78 fprintf(pFile
, "Number of DSP steps: %llu\n\n", count
);
79 for (int i
=0; i
<PROFILE_MAP_SIZE
;i
++)
81 if (g_profileMap
[i
] > 0)
83 fprintf(pFile
, "0x%04X: %llu\n", i
, g_profileMap
[i
]);