Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CLI top - to return thread information #42

Open
tzach opened this issue Mar 19, 2014 · 1 comment
Open

Support CLI top - to return thread information #42

tzach opened this issue Mar 19, 2014 · 1 comment

Comments

@tzach
Copy link
Member

tzach commented Mar 19, 2014

jvm topreturn JVM thread information.
We also need OS level top to display all OS thread
Information can includes:
ID - thread id
PR - thread prio
S - status,
%CPU
%MEM
TIME+
COMMAND - description

This is a side affect of fixing #23

@nyh
Copy link
Contributor

nyh commented Mar 19, 2014

Some notes:

  1. thread->id() is a numeric id of the thread. The comment in sched.hh suggests that it is a long int "guaranteed unique over system lifetime" but this is not correct any more. In fact it is an unsigned int (32-bit) which may wrap around, mimicking Linux process ids. The type and documentation of this function needs to change.
  2. thread->priority() returns a thread's floating-point priority, where 1 is the default, 2 means the thread gets half the runtime as usual and 0.5 means the thread gets twice the runtime as usual. If for some reason you want the Posix-like exponential priority, you also have the getpriority() function.
  3. A thread does have status (_detached_state->st) like running, queued, etc., but we do not have an API to get it. It will be easy to get.
  4. For "%CPU" we need to define what it means (some sort of moving average?). One thing we can do is to expose the runtime the scheduler calculates for each thread (something like export_runtime) but this includes things (like the thread's priority) not normally part of %CPU. Or perhaps we need to a second counter, just for %CPU?
  5. "%MEM" is meaningless for individual threads (threads share their memory).
  6. For "TIME" we have sched::thread::thread_clock (needs to be documented...), and the normal Posix API clock_gettime(CLOCK_THREAD_CPUTIME_ID).
  7. The closest thing we have to "COMMAND" is thread->name().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants