I've used 'top', but I need a tool that can give me an arbitrary-time history of threads that have executed on my system (CentOS 5.4)?
feedback
|
migrated from stackoverflow.com Dec 8 '09 at 20:26
This question came from our site for professional and enthusiast programmers.
|
ps -eLf will give you a list of all the threads and processes currently running on the system. However you ask for a list of all threads that HAVE executed on the system, presumably since some arbitrary point in the past - are you sure that is what you mean? You could run ps as a cron job and poll the system every X minutes, but you would miss threads that were born and died between jobs. You would also have a huge amount of data to deal with. | |||
|
feedback
|
|
I am not aware of a logging solution in a single application. However, working with the more general logging / monitoring framework Zabbix I created the following definition to collect data on threads used by the application I wanted to monitor:
This one-line entry in the config makes Zabbix report, under the token 'myapp.threads' the number of threads seen each time the snippet is run. This picks up the process id via a first call to Not the most elegant solution but it got the job done in a few minutes. Now, with Zabbix databasing and reporting, I can look at this through time. Of course, you probably wouldn't want to install Zabbix just for this. | |||
|
feedback
|
|
ps ax | grep Apache just replace Apache with the process you're looking for | |||||||||||||||
feedback
|
|
I think Linux has process auditing support. You might be able to get that set up to log every thread-creation. I don't know how to do this; I've never wanted to add overhead to kernel functions that are supposed to be fast. :/ | |||
|
feedback
|
|
I like htop. It's like top, but colour coded and with more features. lsof is good if you want something more advanced. Here's an excellent lsof tutorial. | |||
|
feedback
|
|
See | |||
|
feedback
|