'MySQL debug trace timestamp

MySQL debug trace (/tmp/mysqld.trace) does not dump timestamp.

what way to add timestamp? (I need source code profile in detail)

I could use lldb(not gdb). gdb has 'show debug timestamp' option.

https://sourceware.org/gdb/onlinedocs/gdb/Debugging-Output.html

iidb have the same option ?



Solution 1:[1]

It doesn't look like the MySQL debug trace uses the debugger at all. From the descriptions online, it is just programmatically dumping log info at various points. Since it doesn't stop in the debugger, then the "show debug timestamp" option won't help you in gdb since the debugger wouldn't be doing anything to trigger emitting the timestamp.

If you know what the trace printing function is, you could set a breakpoint there and get lldb to dump the current time using a Python breakpoint command. But I doubt you will want to have the debugger stop every time you want to dump a trace message, that would most likely slow you down too much.

Solution 2:[2]

I want to profile sql.

add debug output to souce code and lldb, but this is time consuming.

If mysqd.trace could print timestamp, best way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jim Ingham
Solution 2 flavor