On 2005-04-13 21:40, David Xu <davidxu_at_freebsd.org> wrote: >Giorgos Keramidas wrote: >>On 2005-04-13 17:15, Jiawei Ye <leafy7382_at_gmail.com> wrote: >>>On 4/13/05, David Xu <davidxu_at_freebsd.org> wrote: >>>> I believe he wants to see total threads number in a process. add a >>>> column to top to display total kernel threads in per-process, >>>> p_numthreads in proc structure is what you need . :) >>> >>> Exactly what I want. Is is possible to modify our top? >> >>Can you try the following patch? >>[snip] > > I am using the patch, it works fine, the screen output is attractive. :-) Would it be ok if I modified it to constantly display the THR column in process-mode, to avoid duplicating the large sprintf() part of format_next_process? I really dislike having to include virtually the same sprintf() block twice, just to change a single field. Constantly displaying THR, even when there are no multithreaded programs running on a system is not optimal either, but it's better IMO. Ideally, the displayed fields and their width could be dynamically adjustable, with contrib/top code formatting the displayed "screen" in a string buffer and using something like: struct top_field { int tf_enabled; int tf_width; int tf_precision; char *tf_fmt; char *tf_header; }; struct top_field top_fields[] = { { 1, 5, 0, "s", "PID", }, { 1, 8, 0, "s", "USERNAME", }, { 0, 5, 0, "ld", "UID", }, { 1, 3, 0, "ld", "PRI", } ... }; and the field formatting code could iterate through an array of fields, printing or ignoring some fields based on the current flags of top (thread mode, smp mode, etc), but this requires huge changes to the way contrib/top is written and I don't think I have so much time right now.Received on Wed Apr 13 2005 - 12:13:28 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:32 UTC