Bug #50057 | PATCH: SHOW PROFILE CPU port for Windows | ||
---|---|---|---|
Submitted: | 4 Jan 2010 16:44 | Modified: | 7 Mar 2010 1:19 |
Reporter: | Lenz Grimmer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Windows | Severity: | S4 (Feature request) |
Version: | 5.4 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution, profiling, windows |
[4 Jan 2010 16:44]
Lenz Grimmer
[5 Jan 2010 15:42]
Matthew Bradbury
You have a subtle bug there, the second parameter of Int64ShllMod32 can only be in the range of 0 - 31. So perhaps a better version would be: inline ULONGLONG FileTimeToQuadWord(FILETIME *ft) { ULONGLONG nrv = 0; nrv |= ft->dwHighDateTime; nrv <<= 32; nrv |= ft->dwLowDateTime; return nrv; }
[5 Jan 2010 23:12]
Alex Budovski
Good catch! Looks like either the book has an error, or the documentation is wrong. I'll make the change to your version, using the regular bit shift operator.
[5 Jan 2010 23:28]
Alex Budovski
Updated patch
Attachment: cpu1.patch (application/octet-stream, text), 5.58 KiB.
[3 Feb 2010 2:50]
Reggie Burnett
Looks ok to me but I've also assigned Vlad to review it. He may catch some things that I miss. Thanks for submitting this.
[4 Feb 2010 14:24]
Vladislav Vaintroub
Hi Alex, this looks good, I only have very minor points to it (which you are free to ignore, if you wish, and then I'll push it as-is). They are only style-type comments. 1) Using __WIN__ . Since long time already we're trying to get of __WIN__ and replace it with _WIN32, an least in the new code . Reason being that __WIN__ is completely artificial creature and violates ANSI which reserves identifiers starting with double underscore for compiler writers. 2) Maybe it is simpler instead of bit twiddling in the conversion of FILETIME to ULONGLONG to use ULARGE_INTEGER union, as also suggested here http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx 3) inline ULONGLONG FileTimeToQuadWord() inline static double GetTimeDiffInSeconds() Why inline instead of e.g static? Does not look like we would need to care much about performance of those 2 functions.
[4 Feb 2010 22:50]
Alex Budovski
Hi Vladislav! Excellent points! Re: 1) I agree completely. I used __WIN__ merely to be consistent with the surrounding code. But I too prefer using the standard _WIN32 macro. 2) I guess a union could have worked. I'll see what I can do. 3) Only reason for inline is that I figured it wasn't worth paying the cost of entry and return for those 2 simple functions. But I guess they won't be called often enough to matter? Static is a good choice, as presumably they won't be needed elsewhere. I'll make the changes. Thanks again!
[5 Feb 2010 1:44]
Alex Budovski
Revised patch.
Attachment: cpu.patch (text/x-diff), 2.55 KiB.
[5 Feb 2010 12:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99411 2986 Vladislav Vaintroub 2010-02-05 Bug#50057: 'SHOW PROFILE CPU' port for Windows. Patch contributed by Alex Budkovski.
[5 Feb 2010 12:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99412 2986 Vladislav Vaintroub 2010-02-05 Bug#50057: 'SHOW PROFILE CPU' port for Windows. Patch contributed by Alex Budovski.
[5 Feb 2010 16:32]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99485 2987 Vladislav Vaintroub 2010-02-05 Bug#50057: SHOW PROFILE CPU for Windows On QA request, adding test that causes new code to be called. Even if we cannot validate the result, this will at least increase the code coverage.
[5 Feb 2010 17:18]
Vladislav Vaintroub
Alex, I pushed your latest patch plus some test code that QA asked for - that was only for code coverage, since a meaningful test for SHOW PROFILES CPU with checking results is not possible. Thank you for contribution!
[13 Feb 2010 8:36]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100213083436-9pesg4h55w1mekxc) (version source revid:luis.soares@sun.com-20100211135109-t63avry9fqpgyh78) (merge vers: 6.0.14-alpha) (pib:16)
[13 Feb 2010 8:39]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100213083327-cee4ao3jpg33eggv) (version source revid:luis.soares@sun.com-20100211135018-1f9dbghg0itszigo) (pib:16)
[13 Feb 2010 17:51]
Paul DuBois
Noted in 6.0.14 changelog. SHOW PROFILE CPU has been ported to Windows. Setting report to Need Merge pending push of Celosia to release tree.
[6 Mar 2010 10:59]
Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100213160132-nx1vlocxuta76txh) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:19]
Paul DuBois
Noted in 5.5.3 changelog.