Date: Sun, 4 Oct 2009 20:16:21 +0100 From: Andrew Brampton <brampton+freebsd-hackers@gmail.com> To: freebsd-hackers@freebsd.org Subject: Make top display thread IDs Message-ID: <d41814900910041216m183a364bk6dc62d6c475a73a7@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--0016e6dd9669153090047520d5d8 Content-Type: text/plain; charset=UTF-8 Hello, I was using "top -H" to display all the different threads on my system. I then wanted to use cpuset to pin a thread to a particular core, however, I couldn't find the thread ID. So I've hacked top to display thread IDs. Hopefully this patch is useful to something, and perhaps it should be included with FreeBSD. I'd be grateful for any feedback or suggestions. thanks Andrew --0016e6dd9669153090047520d5d8 Content-Type: text/plain; charset=US-ASCII; name="freebsd-top-tid.patch.txt" Content-Disposition: attachment; filename="freebsd-top-tid.patch.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g0e6atdy0 SW5kZXg6IHVzci5iaW4vdG9wL21hY2hpbmUuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIHVzci5iaW4vdG9w L21hY2hpbmUuYwkocmV2aXNpb24gMTk3NjExKQ0KKysrIHVzci5iaW4vdG9wL21hY2hpbmUuYwko d29ya2luZyBjb3B5KQ0KQEAgLTEwOCwxOCArMTA4LDE4IEBADQogc3RhdGljIGNoYXIgc21wX2hl YWRlcl90aHJbXSA9DQogICAgICIgIFBJRCVzICUtKi4qcyAgVEhSIFBSSSBOSUNFICAgU0laRSAg ICBSRVMgU1RBVEUgICBDICAgVElNRSAlNnMgQ09NTUFORCI7DQogc3RhdGljIGNoYXIgc21wX2hl YWRlcltdID0NCi0gICAgIiAgUElEJXMgJS0qLipzICIgICAiUFJJIE5JQ0UgICBTSVpFICAgIFJF UyBTVEFURSAgIEMgICBUSU1FICU2cyBDT01NQU5EIjsNCisgICAgIiAgUElEICAgIFRJRCVzICUt Ki4qcyBQUkkgTklDRSAgIFNJWkUgICAgUkVTIFNUQ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QljaGFyICpwcm9jX2Zt dCwgdGhyX2J1Zls2XSwgamlkX2J1Zls2XTsNCisJY2hhciAqcHJvY19mbXQsIHRpZF9idWZbOF0s IHRocl9idWZbNl0sIGppZF9idWZbNl07DQogCWNoYXIgKmNtZGJ1ZiA9IE5VTEw7DQogCWNoYXIg KiphcmdzOw0KIA0KQEAgLTk0MiwxNCArOTQyLDE5IEBADQogDQogCS8qIGZvcm1hdCB0aGlzIGVu dHJ5ICovDQogCXByb2NfZm10ID0gc21wbW9kZSA/IHNtcF9Qcm9jX2Zvcm1hdCA6IHVwX1Byb2Nf Zm9ybWF0Ow0KLQlpZiAocHMudGhyZWFkICE9IDApDQorCWlmIChwcy50aHJlYWQpIHsNCiAJCXRo cl9idWZbMF0gPSAnXDAnOw0KLQllbHNlDQorCQlzbnByaW50Zih0aWRfYnVmLCBzaXplb2YodGlk X2J1ZiksICIlKmQiLA0KKwkJICAgIHNpemVvZih0aWRfYnVmKSAtIDEsIHBwLT5raV90aWQpOw0K Kwl9IGVsc2Ugew0KKwkJdGlkX2J1ZlswXSA9ICdcMCc7DQogCQlzbnByaW50Zih0aHJfYnVmLCBz aXplb2YodGhyX2J1ZiksICIlKmQgIiwNCiAJCSAgICBzaXplb2YodGhyX2J1ZikgLSAyLCBwcC0+ a2lfbnVtdGhyZWFkcyk7DQorCX0NCiANCiAJc3ByaW50ZihmbXQsIHByb2NfZm10LA0KIAkgICAg cHAtPmtpX3BpZCwNCisJICAgIHRpZF9idWYsDQogCSAgICBqaWRfYnVmLA0KIAkgICAgbmFtZWxl bmd0aCwgbmFtZWxlbmd0aCwgKCpnZXRfdXNlcmlkKShwcC0+a2lfcnVpZCksDQogCSAgICB0aHJf YnVmLA0K --0016e6dd9669153090047520d5d8--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d41814900910041216m183a364bk6dc62d6c475a73a7>