[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient())
From: |
Joe Wells |
Subject: |
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()) |
Date: |
Wed, 05 Sep 2007 22:58:27 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Erik Søe Sørensen <address@hidden> writes:
> Joe Wells skrev:
>
>> By the way, can you please write a short profiling “how to” explaining
>> what exact commands you typed to obtain this information? That would
>> be really helpful (because on different machines and/or with different
>> configuration options different portions of the code might be the
>> worst spots, so it would be nice if other people could easily do the
>> same profiling).
>
> For starters, I propose we add a profiling option to the build script :-)
>
> The tools I've used for profiling are:
>
> - gprof - relatively easy to use. Breaks down the runtime into
> functions; this is good for identifying bottlenecks.
> In theory, it should be usable for getting information on source line
> level instead of just function level. However, either a) I'm using it
> wrong, or b) it just has to take ages for this size of program, even
> if you just ask about a single function. (Literally, ages - I guess
> you could progress acouple in Age of Empires :)
>
> - oprofile - just discovered it for this purpose.
> This profiling tool is a bit special, in that it monitors the whole
> system - everything that's running on your machine, including (if you
> ask for it) the kernel. For this reason, the monitoring daemon
> requires root acces.
> I've used this tool for getting line-level time statistics; if you ask
> for it, it can create copies of the source files annotated with the
> statistics (for each line, function and file).
>
> Things of which to be ware:
> - Profile the right thing.
> Profiling an application compiled without optimization (-O3) is useless;
> the optimizations you'll find may just be ones also be found by the
> compiler.
> For this reason, I've let building with profiling also enable
> optimizations (I didn't at first).
> - Having a performance-test run mode would help a bit - it would also
> facilitate performance comparisons :-)
>
> That was the short version. Exact commands? Well, for gprof:
> 1. Build glob2 with PROFILE=yes.
> 2. Run glob2, play, have fun.
> 3. Exit the game. Now a file called 'gmon.out' will be generated.
> 4. Run gprof: "gprof path/to/glob2 path/to/gmon.out" - and capture the
> output for scrutiny.
> There are command-line options for call-graph analysis (instead of
> a flat function profile), and also for line-profiling (but I
> haven't gotten that to work usefully).
>
> I hope this helps :-)
Thanks much! The information you are giving looks very helpful.
Sorry for asking for this again in my other message. I didn't see
that you had written this one.
Do you have instructions for using oprofile?
--
Joe
> /Erik
> diff --git a/SConstruct b/SConstruct
> --- a/SConstruct
> +++ b/SConstruct
> @@ -5,6 +5,7 @@ def establish_options(env):
> opts.Add("INSTALLDIR", "Installation Directory", "/usr/local/share")
> opts.Add("BINDIR", "Binary Installation Directory", "/usr/local/bin")
> opts.Add(BoolOption("release", "Build for release", 0))
> + opts.Add(BoolOption("profile", 'Build with profiling on', False))
> opts.Add(BoolOption("mingw", "Build with mingw enabled if not
> auto-detected", 0))
> opts.Add(BoolOption("osx", "Build for OSX", 0))
> Help(opts.GenerateHelpText(env))
> @@ -136,6 +137,10 @@ def main():
> env.Append(CPPPATH=["C:/msys/1.0/local/include/SDL",
> "C:/msys/1.0/local/include", "C:/msys/1.0/include/SDL",
> "C:/msys/1.0/include"])
> configure(env)
> env.Append(CPPPATH=['#libgag/include', '#'])
> + if env['profile']:
> + env.Append(CXXFLAGS=' -pg')
> + env.Append(LINKFLAGS='-pg')
> + env.Append(CXXFLAGS=' -O3')
> if env['release']:
> env.Append(CXXFLAGS=' -O3')
> if env['mingw'] or env['PLATFORM'] == 'win32':
- Re: [glob2-devel] Optimization suggestions, (continued)
- [glob2-devel] More flags (--nox), Erik Søe Sørensen, 2007/09/07
- [glob2-devel] documentation for --nox (hurray!) (was: Optimization suggestions (Map::updateLocalGradient())), Joe Wells, 2007/09/05
- Re: [glob2-devel] documentation for --nox (hurray!) (was: Optimization suggestions (Map::updateLocalGradient())), Kai Antweiler, 2007/09/05
- Re: [glob2-devel] documentation for --nox (hurray!) (was: Optimization suggestions (Map::updateLocalGradient())), Stéphane Magnenat, 2007/09/06
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Joe Wells, 2007/09/05
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Erik Søe Sørensen, 2007/09/05
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()),
Joe Wells <=
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Bradley Arsenault, 2007/09/04