According to the code in shell.c the .timer on/off sets a flag that tells whether you want timer data printed or not, and then for each statement: if .timer is turned on save the current wall clock and getrusage times (usr and sys times) execute the statement. if .timer is turned on get the new wall clock and getrsuage times display the difference between the new and old values
sort of like you would know how long X() took (in wall clock elapsed seconds) if you did: begin = time(); X(); finish = time(); elapsed = finish - begin; Just that .timer saves and reports three values provided by the underlying Operating System, not just one. "real" is the current time (in seconds) reported by the underlying OS, and user/sys are the underlying times in seconds reported by the Operating System getrusage call for user/sys CPU usage times for the current process. -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> On >Behalf Of Jose Isaias Cabrera >Sent: Thursday, 13 February, 2020 06:48 >To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> >Subject: [sqlite] .timer explanation anywhere > > >Greetings. > >I was searching on sqlite.org for [sqlite command line tool .timer >explanation] and found nothing. I also searched on the internet and found >an old thread[1] of when .timer had just two entries: > >CPU Time: user 880.710398 sys 353.260288 > >And, although, there is some good information there, I would like for us >to have a solid answer somewhere. :-) Maybe even explain it on the site >[2], or better yet, have an option on .timer (on|off|?) to explain each >piece of the output. One-liners will suffice. > >I also found this other interesting post [3], which I think is not >totally correct, but I will let you guys explain why it is true. Or, at >least, if it has some truth in it. > >Thanks for your support. > >josé > >[1] http://sqlite.1065341.n5.nabble.com/timer-on-in-the-shell-tool- >td79626.html >[2] >https://www.sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_ >[3] https://stackoverflow.com/questions/40329106/how-to-measure-the- >execution-time-of-each-sql-statement-query-in-sqlite >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users