added code for recording threads too along with processes