Some code cleanup + added scons flavor=prof

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1763 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-01-04 10:20:38 +00:00
parent 7c37718089
commit 952dfcd610
3 changed files with 33 additions and 19 deletions

View file

@ -101,7 +101,7 @@ vars.AddVariables(
BoolVariable('gltest', 'temp don\'t use (WIP)', False),
BoolVariable('jittest', 'temp don\'t use (WIP)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release', 'devel', 'debug', 'fastlog'),
allowed_values = ('release', 'devel', 'debug', 'fastlog', 'prof'),
ignorecase = 2
),
EnumVariable('osx', 'Choose a backend (WIP)', '32cocoa',
@ -117,6 +117,7 @@ vars.AddVariables(
env = Environment(
CPPPATH = include_paths,
LIBPATH = lib_paths,
RPATH = [],
variables = vars,
ENV = {
'PATH' : os.environ['PATH'],
@ -147,6 +148,7 @@ if not env['verbose']:
env['RANLIBCOMSTR'] = "Indexing $TARGET"
# build falvuor
flavour = ARGUMENTS.get('flavor')
if (flavour == 'debug'):
@ -155,14 +157,16 @@ if (flavour == 'debug'):
cppDefines.append('_DEBUG')
# FIXME: this disable wx debugging how do we make it work?
cppDefines.append('NDEBUG')
elif (flavour == 'devel'):
compileFlags.append('-g')
cppDefines.append('DEBUGFAST')
elif (flavour == 'fastlog'):
compileFlags.append('-O3')
cppDefines.append('LOGGING')
else:
elif (flavour == 'prof'):
compileFlags.append('-O3')
compileFlags.append('-g')
elif (flavour == 'release'):
compileFlags.append('-O3')
# more warnings
@ -261,6 +265,18 @@ conf.Define('USE_WX', env['USE_WX'])
conf.Define('HAVE_X11', env['HAVE_X11'])
conf.Define('HAVE_COCOA', env['HAVE_COCOA'])
# profile
env['USE_OPROFILE'] = 0
if (flavour == 'prof'):
env['LIBPATH'] += [ '/usr/lib/oprofile' ]
env['RPATH'] += [ '/usr/lib/oprofile' ]
if conf.CheckPKG('opagent'):
env['USE_OPROFILE'] = 1
else:
print "Can't build prof without oprofile, disabling"
conf.Define('USE_OPROFILE', env['USE_OPROFILE'])
# After all configuration tests are done
conf.Finish()
@ -278,8 +294,10 @@ env['base_dir'] = os.getcwd()+ '/';
# install paths
extra=''
if env['flavor'] == 'debug':
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra +os.sep)
@ -292,7 +310,7 @@ env['libs_dir'] = env['prefix'] + 'Libs/'
#TODO where should this go?
env['data_dir'] = env['prefix']
env['RPATH'] = env['libs_dir']
env['RPATH'] += env['libs_dir']
env['LIBPATH'] += [ env['libs_dir'] ]

View file

@ -22,8 +22,6 @@
// performance hit, it's not enabled by default, but it's useful for
// locating performance issues.
//#define OPROFILE_REPORT
#include "Common.h"
#include "../../Core.h"
#include "MemoryUtil.h"
@ -44,11 +42,11 @@
#include "disasm.h"
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
#include <opagent.h>
#endif
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
op_agent_t agent;
#endif
@ -76,7 +74,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
MAX_NUM_BLOCKS = 65536*8;
}
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
agent = op_open_agent();
#endif
blocks = new JitBlock[MAX_NUM_BLOCKS];
@ -92,7 +90,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
blocks = 0;
blockCodePointers = 0;
num_blocks = 0;
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
op_close_agent(agent);
#endif
}
@ -184,7 +182,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
LinkBlockExits(block_num);
}
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
char buf[100];
sprintf(buf, "EmuCode%x", b.originalAddress);
const u8* blockStart = blockCodePointers[block_num];

View file

@ -22,8 +22,6 @@
// performance hit, it's not enabled by default, but it's useful for
// locating performance issues.
//#define OPROFILE_REPORT
#include "Common.h"
#include "../../Core.h"
#include "MemoryUtil.h"
@ -44,11 +42,11 @@
#include "disasm.h"
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
#include <opagent.h>
#endif
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
op_agent_t agent;
#endif
@ -76,7 +74,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
MAX_NUM_BLOCKS = 65536*8;
}
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
agent = op_open_agent();
#endif
blocks = new JitBlock[MAX_NUM_BLOCKS];
@ -92,7 +90,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
blocks = 0;
blockCodePointers = 0;
num_blocks = 0;
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
op_close_agent(agent);
#endif
}
@ -184,7 +182,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
LinkBlockExits(block_num);
}
#ifdef OPROFILE_REPORT
#if defined USE_OPROFILE && USE_OPROFILE
char buf[100];
sprintf(buf, "EmuCode%x", b.originalAddress);
const u8* blockStart = blockCodePointers[block_num];