Search code examples
rubyruby-prof

ruby-prof "Wait" column in the results: what is it?


The results for the ruby-prof output always contains a value for the "Wait" column. However, I've never found a description of what this value is and in all the times I've used ruby-prof, I've never seen this column ever take on a value other than 0.

What is this value supposed to represent? Any help would be appreciated. Thanks!


Solution

  • The wait column tells us how long a thread had to wait, aka how long it spent waiting for other threads.

    Essentially a thread would wait for a resource that is currently being used by another thread. Once that thread is done with that resource, it would notify the other threads that the resource is ready to be used.

    To read more on multi threading with Ruby, check out:

    http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_threads.html

    Keep in mind, this wait concept is not only for Ruby, but is a huge concept in multi threading.