[SERVER-35274] Add scons flag which enables -pg Created: 29/May/18 Updated: 06/Dec/22 Resolved: 14/Jan/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build, Performance |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Spencer Jackson | Assignee: | DO NOT USE - Backlog - Dev Tools |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Developer Tools
|
| Participants: |
| Description |
|
Gprof is a performance profiler. To enable it, you must pass the -pg flag to the compiler. Binaries so compiled will dump performance counters to 'gmon.out' on process exit. However, mongod does not exit normally, which prevents 'gmon.out' from being generated. To properly flush the counters, we must declare an external function called "_mcleanup()" and call it during quickExit. This is a pattern used for coverage analysis, where we manually declare and call GCov's __gcov_flush function.
We should add a scons flag which passes -pg to the compiler, and enables a preprocessor flag which enables the declaration and call of _mcleanup. |
| Comments |
| Comment by Eric Milkie [ 29/May/18 ] |
|
We already have MONGO_CPU_PROFILER preprocessor macro which does what you want in quickExit(). (copy/paste fail!) |