[Assorted-commits] SF.net SVN: assorted:[931] sandbox/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-08-06 08:09:53
|
Revision: 931 http://assorted.svn.sourceforge.net/assorted/?rev=931&view=rev Author: yangzhang Date: 2008-08-06 08:10:02 +0000 (Wed, 06 Aug 2008) Log Message: ----------- - added gcc sandbox - added profile-guided optimization demo Added Paths: ----------- sandbox/trunk/src/gcc/ sandbox/trunk/src/gcc/pgo/ sandbox/trunk/src/gcc/pgo/Makefile sandbox/trunk/src/gcc/pgo/README sandbox/trunk/src/gcc/pgo/pgodemo.cc Added: sandbox/trunk/src/gcc/pgo/Makefile =================================================================== --- sandbox/trunk/src/gcc/pgo/Makefile (rev 0) +++ sandbox/trunk/src/gcc/pgo/Makefile 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,14 @@ +all: out/pgodemo-gen + +out/pgodemo-gen: pgodemo.cc + mkdir -p $(@D) + g++ -Wall -O3 -fprofile-generate -o $@ $^ + +out/pgodemo-use: pgodemo.cc + mkdir -p $(@D) + g++ -Wall -O3 -fprofile-use -o $@ $^ + +clean: + rm -rf out/ pgodemo.gc* + +.PHONY: all clean Added: sandbox/trunk/src/gcc/pgo/README =================================================================== --- sandbox/trunk/src/gcc/pgo/README (rev 0) +++ sandbox/trunk/src/gcc/pgo/README 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,20 @@ +Demo of profile-guided optimization. + +`make pgodemo-gen` produces the executable along with `pgodemo.gcno`, whose +purpose is unclear to me at the moment (removing it doesn't seem to affect any +future step), but `.gcno` and `.gcda` files appear to be gcov-related. + +At this point, you may run the executable, which will produce a `pgodemo.gcda` +file back in the original build directory (the location of the executable, your +current working directory at the time of execution, etc. are all irrelevant). + +'make pgodemo-use` produces the optimized version of the executable by +consuming `pgodemo.gcda`. This will reproduce a new `pgodemo.gcno`. + +If you try to build pgodemo-use without the `.gcda` file, you'll get: + + $ make out/pgodemo-use + mkdir -p out + g++ -Wall -O3 -fprofile-use -o out/pgodemo-use pgodemo.cc + pgodemo.cc: In function ‘(static initializers for pgodemo.cc)’: + pgodemo.cc:11: note: file pgodemo.gcda not found, execution counts estimated Added: sandbox/trunk/src/gcc/pgo/pgodemo.cc =================================================================== --- sandbox/trunk/src/gcc/pgo/pgodemo.cc (rev 0) +++ sandbox/trunk/src/gcc/pgo/pgodemo.cc 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,10 @@ +#include <iostream> + +using namespace std; + +int +main() +{ + cout << "hello" << endl; + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |