Renamed linetoscr.c to linetoscr.cpp, fixed references to file, added Profiler while DEBUG=1

This commit is contained in:
Dimitris Panokostas 2017-03-31 11:57:08 +02:00
parent b0bc4a3046
commit 620bc5bfb8
6 changed files with 816 additions and 900 deletions

View file

@ -54,6 +54,7 @@
<RemoteBuildCommandLine>cd ~/projects/Amiberry; make</RemoteBuildCommandLine>
<RemoteReBuildCommandLine>cd ~/projects/Amiberry; make clean; make</RemoteReBuildCommandLine>
<RemoteCleanCommandLine>cd ~/projects/Amiberry; make clean</RemoteCleanCommandLine>
<NMakeIncludeSearchPath>D:\midwa\Projects\GitHub\amiberry\src\guisan\include;D:\midwa\Projects\GitHub\amiberry\src\threaddep;D:\midwa\Projects\GitHub\amiberry\src\osdep;D:\midwa\Projects\GitHub\amiberry\src;D:\midwa\Projects\GitHub\amiberry\src\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
</PropertyGroup>
<ItemGroup>
<Text Include="..\conf\dir.txt">
@ -286,9 +287,6 @@
<ClCompile Include="..\src\gencpu.cpp">
<DeploymentContent>false</DeploymentContent>
</ClCompile>
<ClCompile Include="..\src\genlinetoscr.cpp">
<DeploymentContent>false</DeploymentContent>
</ClCompile>
<ClCompile Include="..\src\gfxboard.cpp">
<DeploymentContent>false</DeploymentContent>
</ClCompile>

View file

@ -258,9 +258,6 @@
<ClCompile Include="..\src\gencpu.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\genlinetoscr.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\gfxboard.cpp">
<Filter>src</Filter>
</ClCompile>

View file

@ -280,7 +280,7 @@ static int src_pixel, ham_src_pixel;
/* How many pixels in window coordinates which are to the left of the left border. */
static int unpainted;
#include "linetoscr.c"
#include "linetoscr.cpp"
static void pfield_do_linetoscr_0_640(int start, int stop)
{

View file

@ -50,6 +50,7 @@
#include "cia.h"
#include "inputdevice.h"
#include "audio.h"
#include <gperftools/profiler.h>
#ifdef JIT
#include "jit/compemu.h"
#include <signal.h>
@ -1345,6 +1346,10 @@ static void exception2_handle (uaecptr addr, uaecptr fault)
void m68k_go (int may_quit)
{
#ifdef DEBUG
ProfilerStart("amiberry-sdl2.prof");
#endif
int hardboot = 1;
int startup = 1;
@ -1457,6 +1462,9 @@ void m68k_go (int may_quit)
}
protect_roms (false);
in_m68k_go--;
#ifdef DEBUG
ProfilerStop();
#endif
}
#ifdef SAVESTATE

View file

@ -1,87 +0,0 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#define MAX_TRACE 2000
static void* trc_func[MAX_TRACE];
static void* trc_caller[MAX_TRACE];
static int trc_enter[MAX_TRACE];
static int trc_number[MAX_TRACE];
static int trc_next_write = 0;
static int trc_counter = 0;
static int do_trace = 0;
static FILE *fd;
void trace_begin (void)
{
if(do_trace)
return;
memset(trc_enter, 0, sizeof(int) * MAX_TRACE);
do_trace = 1;
}
void trace_end (void)
{
if(do_trace)
{
do_trace = 0;
fd = fopen("trace.txt", "w");
for(int i=0; i<MAX_TRACE; ++i)
{
if(trc_enter[trc_next_write] > 0)
{
Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo));
int func_found = dladdr(trc_func[trc_next_write], &dlinfo);
if(func_found && dlinfo.dli_sname != NULL)
{
fprintf(fd, "%8d - %s 0x%08X from 0x%08X (%s)\n", trc_number[trc_next_write], (trc_enter[trc_next_write] == 1 ? "enter" : "leave"),
trc_func[trc_next_write], trc_caller[trc_next_write], dlinfo.dli_sname);
}
}
++trc_next_write;
if(trc_next_write >= MAX_TRACE)
trc_next_write = 0;
}
fclose(fd);
}
}
void __cyg_profile_func_enter (void *func, void *caller)
{
if(do_trace)
{
trc_enter[trc_next_write] = 1;
trc_func[trc_next_write] = func;
trc_caller[trc_next_write] = caller;
trc_number[trc_next_write] = trc_counter;
++trc_counter;
++trc_next_write;
if(trc_next_write >= MAX_TRACE)
trc_next_write = 0;
}
}
void __cyg_profile_func_exit (void *func, void *caller)
{
if(do_trace)
{
trc_enter[trc_next_write] = 2;
trc_func[trc_next_write] = func;
trc_caller[trc_next_write] = caller;
trc_number[trc_next_write] = trc_counter;
++trc_counter;
++trc_next_write;
if(trc_next_write >= MAX_TRACE)
trc_next_write = 0;
}
}