PSA: Build time VLOG for ash-chrome

121 views
Skip to first unread message

Xiyuan Xia

unread,
Mar 17, 2022, 6:18:00 PM3/17/22
to chromium-dev
Hi fellow chromium-devs,

If you don't write code for ash-chrome, or don't collect vlog in feedback reports, you can stop reading now.

tl;dr

I am creating CL:3334864 to use build time VLOG for ash-chrome. Once it lands, VLOGs need to be enabled by defining macro ENABLE_VLOG_LEVEL=x rather than specifying vmodule patterns in chrome_setup.cc. Command line switches "--vmodule=xxx" and "--v=x" would have no effect.


Long version:

When vlog code was ported to chromium, we stripped the caching in VLOG_IS_ON to reduce binary size (code). Each VLOG() statement includes:
   VLOG_IS_ON ->
   ::logging::GetVlogLevel ->
   GetVlogLevelHelper ->

VlogInfo::GetVlogLevel runs a little loop to do logging::MatchVlogPattern for every vmodule pattern supplied.

This became a problem over time as more and more VLOGs were added and more and more vmodule patterns were added as it resulted in non-trivial cpu cost. Olivier has also created an excellent investigation document on the problem, the impact, the findings, and possible solutions. The problem is currently tracked in an old crbug/489441.

CL:3334864 addresses the problem by compiling out all VLOGs out of source code unless they have ENABLE_VLOG_LEVEL=x macro defined. We pay no cost and enjoy a binary size reduction for VLOGs that are not enabled with the macro. For the enable VLOGs, we pay little cpu cost to compare 2 int log levels. 

Feel free to ping me or Olivier (oliv...@chromium.org) if you have questions.

Regards
Xiyuan
Reply all
Reply to author
Forward
0 new messages