Source code for the page and thread watcher here. You can access the thread watcher's public api here and here.