Commit | Line | Data |
---|---|---|
03bd936a 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 | |
03bd936a AM |
8 | *******************************************************************************/ |
9 | ||
10 | package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernelanalysis; | |
11 | ||
03bd936a AM |
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 | */ | |
03bd936a AM |
20 | public interface LinuxValues { |
21 | ||
94383285 | 22 | /** |
03bd936a AM |
23 | * Process states found in scheduler events. |
24 | * | |
25 | * From include/linux/sched.h | |
26 | * | |
94383285 | 27 | * <pre> |
03bd936a AM |
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_STATE_MAX 1024 | |
94383285 | 41 | * </pre> |
03bd936a | 42 | */ |
2bfc6622 | 43 | /** |
2f693965 AM |
44 | * The task is running normally, can be interrupted, in a syscall or user |
45 | * mode. | |
2bfc6622 | 46 | */ |
03bd936a | 47 | int TASK_STATE_RUNNING = 0; |
2f693965 | 48 | |
0589e681 MK |
49 | /** |
50 | * The process is in an interruptible sleep, (waiting for an event to | |
51 | * complete) | |
52 | */ | |
2f693965 AM |
53 | int TASK_INTERRUPTIBLE = 1; |
54 | ||
0589e681 MK |
55 | /** |
56 | * The process is in an uninteruptible sleep, (usually waiting on IO) | |
57 | */ | |
2f693965 AM |
58 | int TASK_UNINTERRUPTIBLE = 2; |
59 | ||
0589e681 MK |
60 | /** |
61 | * The process is stopped, it is waiting for a SIGCONT | |
62 | */ | |
63 | int TASK_STOPPED__ = 4; | |
64 | ||
65 | /** | |
66 | * The process is being monitored by other processes like a debugger | |
67 | */ | |
68 | int TASK_TRACED__ = 8; | |
69 | ||
70 | /** | |
71 | * The task is terminated. It is lingering waiting for a parent to reap it. | |
72 | */ | |
73 | int EXIT_ZOMBIE = 16; | |
74 | ||
75 | /** | |
76 | * The final state, the process reaches this state when being reaped. This | |
77 | * state should not be seen. | |
78 | */ | |
79 | int EXIT_DEAD = 32; | |
80 | ||
2bfc6622 MK |
81 | /** |
82 | * The task is dead, that means the PID can be re-used. | |
83 | */ | |
2f693965 AM |
84 | int TASK_DEAD = 64; |
85 | ||
0589e681 MK |
86 | /** |
87 | * The task will wake up only on kill signals | |
88 | */ | |
89 | int TASK_WAKEKILL = 128; | |
90 | ||
91 | /** | |
92 | * A task is being woken up, should not appear in sched switch, but if we | |
93 | * poll. | |
94 | */ | |
95 | int TASK_WAKING = 256; | |
96 | ||
97 | /** | |
98 | * A very deep sleep that can only be woken by an unpark wakeup | |
99 | */ | |
100 | int TASK_PARK = 512; | |
101 | ||
2bfc6622 | 102 | /** |
2f693965 AM |
103 | * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX |
104 | * - 1 is useful to mask the task state. | |
2bfc6622 | 105 | */ |
03bd936a AM |
106 | int TASK_STATE_MAX = 1024; |
107 | ||
94383285 | 108 | /** |
03bd936a AM |
109 | * Process statuses, used in LTTng statedump events. |
110 | * | |
111 | * This is LTTng-specific, but the statedump are handled at this level, so | |
112 | * it makes sense to add those definitions here. | |
113 | * | |
114 | * Taken from lttng-module's lttng-statedump-impl.c: | |
115 | * | |
94383285 | 116 | * <pre> |
03bd936a AM |
117 | * enum lttng_process_status { |
118 | * LTTNG_UNNAMED = 0, | |
119 | * LTTNG_WAIT_FORK = 1, | |
120 | * LTTNG_WAIT_CPU = 2, | |
121 | * LTTNG_EXIT = 3, | |
122 | * LTTNG_ZOMBIE = 4, | |
123 | * LTTNG_WAIT = 5, | |
124 | * LTTNG_RUN = 6, | |
125 | * LTTNG_DEAD = 7, | |
126 | * }; | |
94383285 | 127 | * </pre> |
03bd936a | 128 | */ |
94383285 FG |
129 | |
130 | /** Task is initially preempted */ | |
03bd936a | 131 | int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2; |
94383285 FG |
132 | |
133 | /** Task is initially blocked */ | |
03bd936a | 134 | int STATEDUMP_PROCESS_STATUS_WAIT = 5; |
02993d57 FG |
135 | |
136 | /** | |
137 | * SoftIRQ definitions | |
138 | * | |
139 | * From linux/interrupt.h | |
0589e681 | 140 | * |
02993d57 FG |
141 | * <pre> |
142 | * enum | |
143 | * { | |
144 | * HI_SOFTIRQ=0, | |
145 | * TIMER_SOFTIRQ, | |
146 | * NET_TX_SOFTIRQ, | |
147 | * NET_RX_SOFTIRQ, | |
148 | * BLOCK_SOFTIRQ, | |
149 | * BLOCK_IOPOLL_SOFTIRQ, | |
150 | * TASKLET_SOFTIRQ, | |
151 | * SCHED_SOFTIRQ, | |
152 | * HRTIMER_SOFTIRQ, | |
153 | * RCU_SOFTIRQ, | |
154 | * NR_SOFTIRQS // not used as this is the NUMBER of softirqs | |
155 | * }; | |
156 | * </pre> | |
157 | */ | |
158 | ||
159 | /** High-priority tasklet */ | |
160 | int SOFTIRQ_HI = 0; | |
161 | ||
162 | /** Interrupted because of timer */ | |
163 | int SOFTIRQ_TIMER = 1; | |
164 | ||
165 | /** Interrupted because of network transmission */ | |
166 | int SOFTIRQ_NET_TX = 2; | |
167 | ||
168 | /** Interrupted because of network reception */ | |
169 | int SOFTIRQ_NET_RX = 3; | |
170 | ||
171 | /** Interrupted because of block operation */ | |
172 | int SOFTIRQ_BLOCK = 4; | |
173 | ||
174 | /** Interrupted because of block IO */ | |
175 | int SOFTIRQ_BLOCK_IOPOLL = 5; | |
176 | ||
177 | /** Tasklet (differed device interrupt) */ | |
178 | int SOFTIRQ_TASKLET = 6; | |
179 | ||
180 | /** Interrupted because of the scheduler */ | |
181 | int SOFTIRQ_SCHED = 7; | |
182 | ||
183 | /** Interrupted because of HR timer */ | |
184 | int SOFTIRQ_HRTIMER = 8; | |
185 | ||
186 | /** Interrupted because of RCU */ | |
187 | int SOFTIRQ_RCU = 9; | |
03bd936a | 188 | } |