Access Render/DB Times

Is there a way to access the render times that are being logged to the
log file? For example, lets say that I wanted to execute a method if
the DB query time was greater than a certain amount. Currently that
information is logged to the production log and I’m just wondering if
it is a variable we can access.

Thanks,
Tom