Skip to content

Commit 03c4d93

Browse files
committed
Add example of build process for PGO supported binary vozlt#283
1 parent bd33883 commit 03c4d93

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,38 @@ Earlier versions is not tested.
130130

131131
4. Install the nginx binary.
132132

133+
### Instralltion with Profile-Guided Optimization
134+
135+
It can be built with Profile-Guided Optimization (PGO) using gcc `fprofile` options. The detail of the PGO mechanisms has refer to the section 7.4 of [this paper](https://people.freebsd.org/~lstewart/articles/cpumemory.pdf).
136+
Here is an example of the process to make a PGO supported binary. Please use at your own risk.
137+
138+
1. Compile with fprofile-generate.
139+
140+
```
141+
shell> pwd
142+
/somewhere/nginx
143+
shell> CC=gcc ./auto/configure --with-cc-opt='-fprofile-generate -fprofile-dir=./objs' --with-ld-opt='-lgcov' --add-module=/somewhere/nginx-module-vts
144+
shell> make
145+
```
146+
147+
2. Execute this module tests.
148+
149+
```
150+
shell> pwd
151+
/somewhere/nginx-module-vts
152+
shell> sudo PATH=/somewhere/nginx/objs:$PATH prove -r t/000.display_html.t
153+
...(during runtime it records coverage data into .gcda files)
154+
```
155+
156+
3. Recompile with fprofile-use
157+
158+
```
159+
shell> pwd
160+
/somewhere/nginx
161+
shell> CC=gcc ./auto/configure --with-cc-opt='-fprofile-use -fprofile-dir=/somewhere/nginx-module-vts/objs' --with-ld-opt='-lgcov' --add-module=/somewhere/nginx-module-vts
162+
shell> make
163+
```
164+
133165
## Synopsis
134166

135167
```Nginx

0 commit comments

Comments
 (0)