How to do things like \timing on in a do loop?

Shaozhong SHI <shishaozhong@gmail.com>

From: Shaozhong SHI <shishaozhong@gmail.com>
To: pgsql-sql <pgsql-sql@lists.postgresql.org>
Date: 2022-10-15T19:32:59Z
Lists: pgsql-sql
DO
$do$
declare

j int=1;

BEGIN

for j in 1..100 loop

\timing on

select * from a_table;

end loop;

end
$$;


It appears that \timing on is not allowed in a do statement.

Any alternative to do that in a do statement?

Regards,

David