javascriptperformancegoogle-chrome

Using performance.mark() with Chrome dev tools performance tab


I'd like to see my calls to performance.mark(...) show up on Chrome's dev tools Performance tab. All the documentation I can find online seem to refer to the no longer existing "Timeline" tab, while the docs on the new Performance tab don't have anything to say about it.

In my code, I'm simply doing performance.mark('my mark name'). I have also tried doing the same with console.timeStamp('my mark name') because I saw that in some old docs as well.

How do I see these calls to performance.mark() on the Performance tab?


Solution

  • In the new performance tab markers show up in "User Timing". You need to use

    performance.measure()

    to mark the start and end of your marks like this:

    performance.mark('myMark-start');
    
    // your code 
    
    performance.mark('myMark-end');
    performance.measure('myPerfMarker', 'myMark-start', 'myMark-end');