taskModule
Linux task interface.
Class task
| task:comm () | Returns the name (comm) of the task, at most 15 characters. |
| task:cpu () | Returns the CPU the task last ran on. |
| task:pid () | Returns the process ID (PID) of the task. |
| task:prio () | Returns the dynamic priority of the task. |
| task:tgid () | Returns the thread group ID (TGID) of the task. |
task
| current () | Gets an object representing the current kernel task. |
Class task in detail
A Linux task.
- task:comm ()
-
Returns the name (comm) of the task, at most 15 characters.
It is the executable’s basename unless the task renamed itself, as a kernel thread or a
PR_SET_NAMEcaller does.Returns
-
string
command name of the task
- task:cpu ()
-
Returns the CPU the task last ran on.
Returns
-
integer
CPU index
- task:pid ()
-
Returns the process ID (PID) of the task.
For threads, this is the thread ID (TID) unique to each thread.
Returns
-
integer
pid of the task
- task:prio ()
-
Returns the dynamic priority of the task.
Ranges from -1 (highest) to 139 (lowest): deadline tasks are -1, real-time tasks are 0-99 and
normal tasks are 100-139.
Returns
-
integer
priority of the task
- task:tgid ()
-
Returns the thread group ID (TGID) of the task.
For the main thread, TGID equals PID. For other threads in the group,
TGID is the PID of the main thread.
Returns
-
integer
tgid of the task
task in detail
- current ()
-
Gets an object representing the current kernel task.
In a softirq or hardirq callback that is the task the interrupt found running.
Returns
-
task
task object for the current task.
Usage
local task = require("task") local t = task.current() print(t:pid(), t:comm())