I've been practicing my C++ programming on LeetCode and whenever I submit a solution it will tell me how long my program took to run and how much memory it used.
I'm using a mac and VSCode with g++ to compile my program locally. I want to find a tool or method I can use to get the same information about the run time and memory usage of my program so I can try tweaking it to see the effect on performance.
Is there a compiler option or something like a command line tool or VSCode extension I can run my program through or would I have to add code to my program to track the time and memory itself?