In WebGL we have special extension EXT_disjoint_timer_query for proper GPU profiling, but I can't find good manual how to use it. For example initialization below works in my machine
let gl = canvas.getContext('webgl');
let ext = gl.getExtension('EXT_disjoint_timer_query');
let startQuery = ext.createQueryEXT();
ext.queryCounterEXT(startQuery, ext.TIMESTAMP_EXT);
But last line return undefined. Also I am inspired from source example in regl library, but it's too sophisticated.