how would I count the number of sql queries executed on one page load?
I have a similar script to time taken for page to be generated, but not for how many queries h
To count the number of queries, you need to count the number of queries. Sorry to sound redundant, but it really is that simple.
Make a counting function (mysql_query_counted?), then use grep to search through your codebase for mysql_query(, and it shouldn't take more than an hour or two. Possibly even think about using sed or similar to replace the function calls.
A note on SMF and similar that have this built-in. They use DB abstraction layers, so they are already using their own query function, and adding query counting at a later date would have been as simple as adding a line incrementing a counter to to that function. +1 for abstraction and encapsulation I suppose.