Logging the Execution times of dynamically constructed mysql stored procedures
You could capture the mysqld's uptime or the DB Server's time at the start and end of your code.

Perhaps something like this

SUGGESTION #1

SELECT variable_value INTO @t1
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE variable_name='uptime';
&lt;Your Stored Procedure Code&gt;
SELECT variable_value INTO @t2
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE variable_name='uptime';
SET @RunningTimeSec = @t2 - @t1;
SET @RunningTime = SEC_TO_TIME(@RunningTimeSec);
INSERT INTO sometable ... VALUES (...,@RunningTimeSec,...);


SUGGESTION #2

SET @t1 = UNIX_TIMESTAMP(NOW());
&lt;Your Stored Procedure Code&gt;
SET @t2 = UNIX_TIMESTAMP(NOW());
SET @RunningTimeSec = @t2 - @t1;
SET @RunningTime = SEC_TO_TIME(@RunningTimeSec);
INSERT INTO sometable ... VALUES (...,@RunningTimeSec,...);


GIVE IT A TRY !!!