OK, thanks for the explanation.
And what if you dump the output of this show profiles to a file and do a 'sort | uniq -c' on the Query column..??
That would give you every single query and the number of times it ran.
Or isn't that what you want?!?
Or you could also make a Perl oneliner that gives you all the queries, the amount of times they ran, and the total time they took individually.
Suppose you got a file (called MySQL_profilingDump.txt) that looks like this:
[tt]
+----------+------------+----------------+
| Query_ID | Duration | Query |
+----------+------------+----------------+
| 4 | 0.00180200 | show tables |
| 5 | 0.00131350 | show tables |
| 6 | 0.00124850 | show tables |
| 7 | 0.00124725 | show tables |
| 8 | 0.00115375 | show databases |
| 9 | 0.00129925 | show databases |
| 10 | 0.00125400 | show databases |
| 11 | 0.00116425 | show databases |
| 12 | 0.00119300 | show databases |
| 13 | 0.00135775 | show databases |
| 14 | 0.00115750 | show databases |
| 15 | 0.00115675 | show databases |
| 16 | 0.00116475 | show databases |
| 17 | 0.00157750 | show databases |
| 18 | 0.00123000 | show databases |
+----------+------------+----------------+
[/tt]
Then you could say:
[tt]
> perl -ne "chomp; $hNrOfCalls{(split /\ \|\ ?/ )[2]}++; $hTimes{(split /\ \|\ ?/ )[2]} += (split /\ \|\ ?/ )[1] if(/\d/); END { while( ($sQuery, $fTime)= each %hTimes) {print \"$sQuery took $fTime seconds (called $hNrOfCalls{$sQuery} times)\n\";} }" MySQL_profilingDump.txt
[/tt]
Maybe not the most eloquent piece of Perl ;-), but it does give you this:
[tt]
show databases took 0.0137085 seconds (called 11 times)
show tables took 0.00561125 seconds (called 4 times)
[/tt]