[SERVER-6628] enable google perftools, e.g. heap profiler, cpu profiler, to work Created: 27/Jul/12  Updated: 26/Feb/17  Resolved: 26/Feb/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 2.2.0-rc0
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Eric Milkie Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Incomplete Votes: 1
Labels: platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

After we changed all the exit()'s to _exit()'s, this broke the way google perf tools work, since they register an exit handler to write out the profiler data. This would be easy to fix; just add conditional compilation to call ::exit instead of ::_exit when using --use-cpu-profiler SCons flag. Unfortunately, it means that we can't easily ask users to turn on heap profiling just via environment variables, like we could with 2.0.7.

I'm not sure if calling ProfilerStop() explicitly writes out the profile right then or if it waits until process exit.



 Comments   
Comment by Eric Milkie [ 26/Feb/17 ]

Yes, I agree.

Comment by Mark Callaghan [ 22/Apr/14 ]

gperftool maintainer says this might be a new problem
created https://jira.mongodb.org/browse/SERVER-13683

Comment by Andy Schwerin [ 22/Apr/14 ]

Interesting. Last time I used the tool was on Ubuntu 12.04LTS, back in March, and I did not experience this behavior. mdcallag, can you file a separate SERVER issue for this? Was the error behavior you saw that only the main() thread was showing up in the profiles? If you can, please attach an erroneous and correct profile to the ticket, too (as an SVG would be best).

Comment by Mark Callaghan [ 22/Apr/14 ]

On my x86_64 (Ubuntu 13.10) I don't get useful output in the gperftools profiler output file unless I add a call to ProfilerRegisterThread to handleIncomingMsg(). See https://code.google.com/p/gperftools/issues/detail?id=335. I want hierarchical profiling to help explain a perf regression in MongoDB 2.6 compared to 2.4 – https://jira.mongodb.org/browse/SERVER-13663

I asked about this at https://groups.google.com/forum/#!topic/google-perftools/gEpE7_AdibI

Comment by Eliot Horowitz (Inactive) [ 28/Jul/12 ]

Not 100% sure we should backport, but should certainly consider it.

Generated at Thu Feb 08 03:12:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.