Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of build process for PGO supported binary #283 #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,38 @@ Earlier versions is not tested.

4. Install the nginx binary.

### Installtion with Profile-Guided Optimization

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).
Here is an example of the process to make a PGO supported binary. Please use at your own risk.

1. Compile with fprofile-generate.

```
shell> pwd
/somewhere/nginx
shell> CC=gcc ./auto/configure --with-cc-opt='-fprofile-generate -fprofile-dir=./objs' --with-ld-opt='-lgcov' --add-module=/somewhere/nginx-module-vts
shell> make
```

2. Execute this module tests.

```
shell> pwd
/somewhere/nginx-module-vts
shell> sudo PATH=/somewhere/nginx/objs:$PATH prove -r t/000.display_html.t
...(during runtime it records coverage data into .gcda files)
```

3. Recompile with fprofile-use

```
shell> pwd
/somewhere/nginx
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
shell> make
```

## Synopsis

```Nginx
Expand Down