Commit | Line | Data |
---|---|---|
af3275f8 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials | |
5 | * are made available under the terms of the Eclipse Public License v1.0 | |
6 | * which accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | *******************************************************************************/ | |
9 | ||
10 | package org.lttng.scope.lttng.kernel.core.analysis.os; | |
11 | ||
12 | /** | |
13 | * Definitions of values used in the Linux kernel code. | |
14 | * | |
15 | * Instead of using "magic numbers" in state providers, the definitions should | |
16 | * be added here first. | |
17 | * | |
18 | * @author Alexandre Montplaisir | |
19 | */ | |
20 | public interface LinuxValues { | |
21 | ||
22 | /** | |
23 | * Process states found in scheduler events. | |
24 | * | |
25 | * From include/linux/sched.h | |
26 | * | |
27 | * <pre> | |
28 | * #define TASK_RUNNING 0 | |
29 | * #define TASK_INTERRUPTIBLE 1 | |
30 | * #define TASK_UNINTERRUPTIBLE 2 | |
31 | * #define __TASK_STOPPED 4 | |
32 | * #define __TASK_TRACED 8 | |
33 | * #define EXIT_DEAD 16 | |
34 | * #define EXIT_ZOMBIE 32 | |
35 | * #define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) | |
36 | * #define TASK_DEAD 64 | |
37 | * #define TASK_WAKEKILL 128 | |
38 | * #define TASK_WAKING 256 | |
39 | * #define TASK_PARKED 512 | |
40 | * #define TASK_NOLOAD 1024 | |
41 | * #define TASK_STATE_MAX 2048 | |
42 | * </pre> | |
43 | */ | |
44 | /** | |
45 | * The task is running normally, can be interrupted, in a syscall or user | |
46 | * mode. | |
47 | */ | |
48 | int TASK_STATE_RUNNING = 0; | |
49 | ||
50 | /** | |
51 | * The process is in an interruptible sleep, (waiting for an event to | |
52 | * complete) | |
53 | */ | |
54 | int TASK_INTERRUPTIBLE = 1; | |
55 | ||
56 | /** | |
57 | * The process is in an uninteruptible sleep, (usually waiting on IO) | |
58 | */ | |
59 | int TASK_UNINTERRUPTIBLE = 2; | |
60 | ||
61 | /** | |
62 | * The process is stopped, it is waiting for a SIGCONT | |
63 | */ | |
64 | int TASK_STOPPED__ = 4; | |
65 | ||
66 | /** | |
67 | * The process is being monitored by other processes like a debugger | |
68 | */ | |
69 | int TASK_TRACED__ = 8; | |
70 | ||
71 | /** | |
72 | * The task is terminated. It is lingering waiting for a parent to reap it. | |
73 | */ | |
74 | int EXIT_ZOMBIE = 16; | |
75 | ||
76 | /** | |
77 | * The final state, the process reaches this state when being reaped. This | |
78 | * state should not be seen. | |
79 | */ | |
80 | int EXIT_DEAD = 32; | |
81 | ||
82 | /** | |
83 | * The task is dead, that means the PID can be re-used. | |
84 | */ | |
85 | int TASK_DEAD = 64; | |
86 | ||
87 | /** | |
88 | * The task will wake up only on kill signals | |
89 | */ | |
90 | int TASK_WAKEKILL = 128; | |
91 | ||
92 | /** | |
93 | * A task is being woken up, should not appear in sched switch, but if we | |
94 | * poll. | |
95 | */ | |
96 | int TASK_WAKING = 256; | |
97 | ||
98 | /** | |
99 | * A very deep sleep that can only be woken by an unpark wakeup | |
100 | */ | |
101 | int TASK_PARK = 512; | |
102 | ||
103 | /** | |
104 | * Task that do not contribute to load average (since Linux 4.1) | |
105 | */ | |
106 | int TASK_NOLOAD = 1024; | |
107 | ||
108 | /** | |
109 | * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX | |
110 | * - 1 is useful to mask the task state. | |
111 | */ | |
112 | int TASK_STATE_MAX = 2048; | |
113 | ||
114 | /** | |
115 | * Process statuses, used in LTTng statedump events. | |
116 | * | |
117 | * This is LTTng-specific, but the statedump are handled at this level, so | |
118 | * it makes sense to add those definitions here. | |
119 | * | |
120 | * Taken from lttng-module's lttng-statedump-impl.c: | |
121 | * | |
122 | * <pre> | |
123 | * enum lttng_process_status { | |
124 | * LTTNG_UNNAMED = 0, | |
125 | * LTTNG_WAIT_FORK = 1, | |
126 | * LTTNG_WAIT_CPU = 2, | |
127 | * LTTNG_EXIT = 3, | |
128 | * LTTNG_ZOMBIE = 4, | |
129 | * LTTNG_WAIT = 5, | |
130 | * LTTNG_RUN = 6, | |
131 | * LTTNG_DEAD = 7, | |
132 | * }; | |
133 | * </pre> | |
134 | */ | |
135 | ||
136 | /** Task is initially preempted */ | |
137 | int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2; | |
138 | ||
139 | /** Task is initially blocked */ | |
140 | int STATEDUMP_PROCESS_STATUS_WAIT = 5; | |
141 | ||
142 | /** | |
143 | * SoftIRQ definitions | |
144 | * | |
145 | * From linux/interrupt.h | |
146 | * | |
147 | * <pre> | |
148 | * enum | |
149 | * { | |
150 | * HI_SOFTIRQ=0, | |
151 | * TIMER_SOFTIRQ, | |
152 | * NET_TX_SOFTIRQ, | |
153 | * NET_RX_SOFTIRQ, | |
154 | * BLOCK_SOFTIRQ, | |
155 | * BLOCK_IOPOLL_SOFTIRQ, | |
156 | * TASKLET_SOFTIRQ, | |
157 | * SCHED_SOFTIRQ, | |
158 | * HRTIMER_SOFTIRQ, | |
159 | * RCU_SOFTIRQ, | |
160 | * NR_SOFTIRQS // not used as this is the NUMBER of softirqs | |
161 | * }; | |
162 | * </pre> | |
163 | */ | |
164 | ||
165 | /** High-priority tasklet */ | |
166 | int SOFTIRQ_HI = 0; | |
167 | ||
168 | /** Interrupted because of timer */ | |
169 | int SOFTIRQ_TIMER = 1; | |
170 | ||
171 | /** Interrupted because of network transmission */ | |
172 | int SOFTIRQ_NET_TX = 2; | |
173 | ||
174 | /** Interrupted because of network reception */ | |
175 | int SOFTIRQ_NET_RX = 3; | |
176 | ||
177 | /** Interrupted because of block operation */ | |
178 | int SOFTIRQ_BLOCK = 4; | |
179 | ||
180 | /** Interrupted because of block IO */ | |
181 | int SOFTIRQ_BLOCK_IOPOLL = 5; | |
182 | ||
183 | /** Tasklet (differed device interrupt) */ | |
184 | int SOFTIRQ_TASKLET = 6; | |
185 | ||
186 | /** Interrupted because of the scheduler */ | |
187 | int SOFTIRQ_SCHED = 7; | |
188 | ||
189 | /** Interrupted because of HR timer */ | |
190 | int SOFTIRQ_HRTIMER = 8; | |
191 | ||
192 | /** Interrupted because of RCU */ | |
193 | int SOFTIRQ_RCU = 9; | |
194 | } |