| List: | Internals | « Previous MessageNext Message » | |
| From: | Jeremy Cole | Date: | August 1 2006 6:12pm |
| Subject: | Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses to a macro | ||
| View as plain text | |||
Hi Jim, >> 0. Change thd->proc_info access to a macro > > why not add a method to the THD class? I wouldn't really be opposed to that, but it seems much harder to make "zero penalty" when it's disabled. This is the macro I use in my current profiling code: #if 1 #define THD_PROC_INFO(thd, msg) if(unlikely((thd)->profiling.enabled)) { (thd)->profiling.status((msg), __FUNCTION__, __FILE__, __LINE__); } else { (thd)->proc_info= (msg); } #else #define THD_PROC_INFO(thd, msg) (thd)->proc_info= (msg); #endif (Of course the "1" should change to something smarter...) If it's disabled at compile time, there is absolutely no penalty, the macro pre-compiles into the exact same code that used to be in place. If it is enabled at compile time, the branch prediction should be set up to have the larger penalty when it is turned on rather than off. Regards, Jeremy -- high performance mysql consulting www.provenscaling.com
| Thread | ||
|---|---|---|
| • SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses to a macro | Jeremy Cole | 31 Jul |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses to a macro | Jim Winstead | 31 Jul |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Jeremy Cole | 1 Aug |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Lenz Grimmer | 31 Aug |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses to a macro | Elliot Murphy | 31 Aug |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Marc Alff | 1 Sep |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Jeremy Cole | 1 Sep |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Marc Alff | 5 Sep |
| • Re: SHOW PROFILE and PATCH/5.1: Change thd->proc_info accesses toa macro | Jeremy Cole | 5 Sep |
