committed by
Sebastian Sumpf
parent
3854f1b941
commit
bde72bd2f3
@@ -36,7 +36,7 @@ private:
|
||||
|
||||
friend class _foo;
|
||||
|
||||
enum { LIST_UNSORTED, LIST_SORT_PRIO, LIST_SORT_TID, LIST_SORT_SPACE,
|
||||
enum { LIST_UNSORTED, LIST_SORT_PRIO, LIST_SORT_TID, LIST_SORT_SPACE, LIST_SORT_CONSUMED_TIME,
|
||||
LIST_SORT_END };
|
||||
|
||||
};
|
||||
@@ -71,7 +71,7 @@ const char*
|
||||
Jdb_thread_list::get_mode_str(void)
|
||||
{
|
||||
static const char * const mode_str[] =
|
||||
{ "(unsorted)", "(prio-sorted)", "(tid-sorted)", "(space-sorted)" };
|
||||
{ "(unsorted)", "(prio-sorted)", "(tid-sorted)", "(space-sorted)", "(cpu time-sorted)" };
|
||||
|
||||
return mode_str[_mode];
|
||||
}
|
||||
@@ -205,6 +205,14 @@ Jdb_thread_list::get_space_dbgid(Thread *t)
|
||||
return Kobject_dbg::pointer_to_id(t->space());
|
||||
}
|
||||
|
||||
// helper function for iter() -- use consumed time as sorting key
|
||||
static
|
||||
long
|
||||
Jdb_thread_list::get_consumed_time(Thread *t)
|
||||
{
|
||||
return t->consumed_time();
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
IMPLEMENTATION [sched_wfq || sched_fp_wfq]:
|
||||
@@ -472,6 +480,13 @@ Jdb_thread_list::iter(int count, Thread **t_start,
|
||||
|
||||
// fall through
|
||||
|
||||
case LIST_SORT_CONSUMED_TIME:
|
||||
// list threads sorted by consumed time
|
||||
if (!get_key)
|
||||
get_key = get_consumed_time;
|
||||
|
||||
// fall through
|
||||
|
||||
case LIST_SORT_TID:
|
||||
// list threads sorted by thread id
|
||||
{
|
||||
@@ -691,6 +706,13 @@ Jdb_thread_list::list_threads_show_thread(Thread *t)
|
||||
|
||||
printf("%-6s", to);
|
||||
|
||||
/* consumed time */
|
||||
char time_str[12];
|
||||
Jdb::write_ll_ns(t->consumed_time()*1000, time_str,
|
||||
11 < sizeof(time_str) ? 11 : sizeof(time_str), false);
|
||||
printf(" %s ", time_str);
|
||||
|
||||
/* state */
|
||||
if (long_output)
|
||||
{
|
||||
Jdb_thread::print_state_long(t, 47);
|
||||
@@ -721,7 +743,7 @@ static void
|
||||
Jdb_thread_list::show_header()
|
||||
{
|
||||
Jdb::cursor();
|
||||
printf("%s id cpu name pr sp wait to%s state\033[m\033[K",
|
||||
printf("%s id cpu name pr sp wait to%s cpu time state\033[m\033[K",
|
||||
Jdb::esc_emph, Config::Stack_depth ? " stack" : "");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user