Poor Man’s Profiling with the Linux ts Command

Sometimes when you’re investigating server performance issues, you don’t have the luxury of a full development suite installed with tools like a profiler.

It turns out that the linux ts command, included in moreutils, can be surprisingly helpful. It can timestamp stdout in microseconds, clearly showing timing gaps:

time ./prog_excerpt.cgi sp_token=1 | ts "%.S"

In the above situation, installing the Perl NYT Profiler failed, but ts and a few print statements gave me the info I needed (a database query was taking almost one-third second when it was expected to take under 100 ms.)

ts and parallel commands

This entry was posted in API Programming, MySQL, MySQL Cluster, Open Source, Perl, Tech. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.