H2o: Profile-guided optimization ?

Created on 2 Mar 2019  ·  5Comments  ·  Source: h2o/h2o

Hi,

Sorry if the question is silly, but, is it possible to build H2O with Profile-guided optimization ?

Regards,

Most helpful comment

Use CMAKE_C_FLAGS flags, its c, not c++. h2o use cmake, so you should modify _CMakeLists.txt_, use cmake builtin variables to override default behavior. And remember, cleanup all cmake generated files first.

All 5 comments

PGO is a compiler feature, and yes, you can.

Thank you @meritozh for your answer.

By any chance, do you know how to do it?

I tried this:

env CXXFLAGS='-march=native -fprofile-dir=/src/h2o/pgo -fprofile-generate=/src/h2o/pgo' cmake -DWITH_MRUBY=on make

After installing, stopping/starting H2O, accessing a page, stopping H2O, I was expecting files to be written into the /src/h2o/pgo folder (to feed the fprofile-use in the next build). But the pgo folder remains empty.

Use CMAKE_C_FLAGS flags, its c, not c++. h2o use cmake, so you should modify _CMakeLists.txt_, use cmake builtin variables to override default behavior. And remember, cleanup all cmake generated files first.

What @meritozh says. Though IIRC you do not need to modify CMakeLists.txt. The CMakeLists.txt of H2O inherits environment variable CMAKE_C_FLAGS when being set (see https://github.com/h2o/h2o/blob/master/CMakeLists.txt#L206).

Thank you @meritozh and @kazuho !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ndac-todoroki picture ndac-todoroki  ·  5Comments

daniel-lucio picture daniel-lucio  ·  5Comments

Jxck picture Jxck  ·  7Comments

proyb6 picture proyb6  ·  5Comments

basbebe picture basbebe  ·  3Comments