From: Michael Widenius Date: June 5 2009 10:35am Subject: Re: Profiling a storage engine List-Archive: http://lists.mysql.com/internals/36843 Message-Id: <18984.62728.212628.101966@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "MARK" == MARK CALLAGHAN writes: MARK> On Thu, Jun 4, 2009 at 2:24 PM, Michael Widenius wrote: >> >> hi! >> MARK> howdy MARK> I have never had any luck using gprof on multi-threaded servers. If MARK> you use Linux, then oProfile works great for flat profiles and Google MARK> perftools works great for hierarchical profiles. But to use perftools, MARK> you need to make some changes to the server. >> >> gprof should work fine with MySQL. >> At least I have in the past run the sql-bench benchmark with gprof >> with good results. >> >> In theory, to compile with gprof on intel/amd you should just have to >> build with: >> ./BUILD/compile-pentium64-gprof MARK> The output for hierarchical profiling looks broken. I don't need flat MARK> profiles from gprof as oprofile is much better for that. Here is an MARK> example with functions from the HEAP, MyISAM and Innobase engines MARK> mixed together. If you google for 'gprof multithread' or 'gprof MARK> multithreaded' you will find details of problems that existed this MARK> decade. I don't know if the referenced problems have been fixed. MARK> So, it still doesn't work for me. Can anyone tell me how to fix it? MARK> The output is from 'mysql-test-run --gprof innodb'. I compiled using MARK> BUILD/compile-pentium-64-gprof after removing '$debug_configs' I haven't use gprof with mysql-test-run, only with run-all-tests, which is mainly a single threaded tests (but useful to find bottlenecks in normal code). MARK> 802 mysql_insert(THD*, MARK> TABLE_LIST*, List&, List >&, List&, MARK> List&, enum_duplicates, bool) [218] MARK> 571638 MARK> select_insert::send_data(List&) [113] MARK> [6] 43.4 0.04 2.95 572440 write_record(THD*, MARK> st_table*, st_copy_info*) [6] MARK> 0.02 2.93 554320/555551 MARK> ha_innobase::write_row(char*) [7] MARK> 0.00 0.00 18115/411178 mi_write [138] MARK> 0.00 0.00 21/42 MARK> handler::print_error(int, int) [544] MARK> 0.00 0.00 18115/411168 MARK> ha_myisam::write_row(char*) [390] MARK> 0.00 0.00 8/29585 Sorry, but the text is so mangled that I can't easily read it. (Haven't read gprof for 2 years now, and I forgot the exact format to be able to comment) If you could point out one case that is wrong with the output I may be able to help you. Regards, Monty