How to measure frame length

I’d like to measure the time it takes the game to process data received via socket (tick) and prepare it for rendering (tock). I can take a timestamp when the data arrives, I’m wondering if there’s a function which is called right before rendering to take the second timestamp.