From: MARK CALLAGHAN Date: June 4 2009 10:25pm Subject: Re: Profiling a storage engine List-Archive: http://lists.mysql.com/internals/36842 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, Jun 4, 2009 at 2:24 PM, Michael Widenius wrote: > > hi! > 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 The output for hierarchical profiling looks broken. I don't need flat profiles from gprof as oprofile is much better for that. Here is an example with functions from the HEAP, MyISAM and Innobase engines mixed together. If you google for 'gprof multithread' or 'gprof multithreaded' you will find details of problems that existed this decade. I don't know if the referenced problems have been fixed. So, it still doesn't work for me. Can anyone tell me how to fix it? The output is from 'mysql-test-run --gprof innodb'. I compiled using BUILD/compile-pentium-64-gprof after removing '$debug_configs' 802 mysql_insert(THD*, TABLE_LIST*, List&, List >&, List&, List&, enum_duplicates, bool) [218] 571638 select_insert::send_data(List&) [113] [6] 43.4 0.04 2.95 572440 write_record(THD*, st_table*, st_copy_info*) [6] 0.02 2.93 554320/555551 ha_innobase::write_row(char*) [7] 0.00 0.00 18115/411178 mi_write [138] 0.00 0.00 21/42 handler::print_error(int, int) [544] 0.00 0.00 18115/411168 ha_myisam::write_row(char*) [390] 0.00 0.00 8/29585 ha_innobase::update_row(char const*, char*) [51] 0.00 0.00 9/1218 ha_innobase::index_read(char*, char const*, unsigned int, ha_rkey_function) [477] 0.00 0.00 1/76 ha_innobase::delete_row(char const*) [561] 0.00 0.00 9/516 handler::get_dup_key(int) [688] 0.00 0.00 9/25 ha_innobase::index_read_idx(char*, unsigned int, char const*, unsigned int, ha_rkey_function) [1150] 0.00 0.00 1/273767 ha_heap::write_row(char*) [275] 0.00 0.00 9/2669 ha_innobase::extra(ha_extra_function) [956] 0.00 0.00 554304/555011 ha_innobase::has_transactions() [3732] 0.00 0.00 18115/18140 handler::has_transactions() [3755] 0.00 0.00 22/22 handler::restore_auto_increment() [4571] 0.00 0.00 9/31363 ha_innobase::table_flags() const [3744] 0.00 0.00 9/18 key_copy(char*, char*, st_key*, unsigned int) [4594] 0.00 0.00 8/8 ha_innobase::referenced_by_foreign_key() [4781] 42 Table_triggers_list::process_triggers(THD*, trg_event_type, trg_action_time_type, bool) [4281] -- Mark Callaghan mdcallag@stripped