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 | ||
af7f72ce | 10 | package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis; |
03bd936a | 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 | |
af7f72ce | 19 | * @since 2.0 |
03bd936a | 20 | */ |
03bd936a AM |
21 | public interface LinuxValues { |
22 | ||
94383285 | 23 | /** |
03bd936a AM |
24 | * Process states found in scheduler events. |
25 | * | |
26 | * From include/linux/sched.h | |
27 | * | |
94383285 | 28 | * <pre> |
03bd936a AM |
29 | * #define TASK_RUNNING 0 |
30 | * #define TASK_INTERRUPTIBLE 1 | |
31 | * #define TASK_UNINTERRUPTIBLE 2 | |
32 | * #define __TASK_STOPPED 4 | |
33 | * #define __TASK_TRACED 8 | |
34 | * #define EXIT_DEAD 16 | |
35 | * #define EXIT_ZOMBIE 32 | |
36 | * #define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) | |
37 | * #define TASK_DEAD 64 | |
38 | * #define TASK_WAKEKILL 128 | |
39 | * #define TASK_WAKING 256 | |
40 | * #define TASK_PARKED 512 | |
41 | * #define TASK_STATE_MAX 1024 | |
94383285 | 42 | * </pre> |
03bd936a | 43 | */ |
2bfc6622 | 44 | /** |
2f693965 AM |
45 | * The task is running normally, can be interrupted, in a syscall or user |
46 | * mode. | |
2bfc6622 | 47 | */ |
03bd936a | 48 | int TASK_STATE_RUNNING = 0; |
2f693965 | 49 | |
0589e681 MK |
50 | /** |
51 | * The process is in an interruptible sleep, (waiting for an event to | |
52 | * complete) | |
53 | */ | |
2f693965 AM |
54 | int TASK_INTERRUPTIBLE = 1; |
55 | ||
0589e681 MK |
56 | /** |
57 | * The process is in an uninteruptible sleep, (usually waiting on IO) | |
58 | */ | |
2f693965 AM |
59 | int TASK_UNINTERRUPTIBLE = 2; |
60 | ||
0589e681 MK |
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 | ||
2bfc6622 MK |
82 | /** |
83 | * The task is dead, that means the PID can be re-used. | |
84 | */ | |
2f693965 AM |
85 | int TASK_DEAD = 64; |
86 | ||
0589e681 MK |
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 | ||
2bfc6622 | 103 | /** |
2f693965 AM |
104 | * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX |
105 | * - 1 is useful to mask the task state. | |
2bfc6622 | 106 | */ |
03bd936a AM |
107 | int TASK_STATE_MAX = 1024; |
108 | ||
94383285 | 109 | /** |
03bd936a AM |
110 | * Process statuses, used in LTTng statedump events. |
111 | * | |
112 | * This is LTTng-specific, but the statedump are handled at this level, so | |
113 | * it makes sense to add those definitions here. | |
114 | * | |
115 | * Taken from lttng-module's lttng-statedump-impl.c: | |
116 | * | |
94383285 | 117 | * <pre> |
03bd936a AM |
118 | * enum lttng_process_status { |
119 | * LTTNG_UNNAMED = 0, | |
120 | * LTTNG_WAIT_FORK = 1, | |
121 | * LTTNG_WAIT_CPU = 2, | |
122 | * LTTNG_EXIT = 3, | |
123 | * LTTNG_ZOMBIE = 4, | |
124 | * LTTNG_WAIT = 5, | |
125 | * LTTNG_RUN = 6, | |
126 | * LTTNG_DEAD = 7, | |
127 | * }; | |
94383285 | 128 | * </pre> |
03bd936a | 129 | */ |
94383285 FG |
130 | |
131 | /** Task is initially preempted */ | |
03bd936a | 132 | int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2; |
94383285 FG |
133 | |
134 | /** Task is initially blocked */ | |
03bd936a | 135 | int STATEDUMP_PROCESS_STATUS_WAIT = 5; |
02993d57 FG |
136 | |
137 | /** | |
138 | * SoftIRQ definitions | |
139 | * | |
140 | * From linux/interrupt.h | |
0589e681 | 141 | * |
02993d57 FG |
142 | * <pre> |
143 | * enum | |
144 | * { | |
145 | * HI_SOFTIRQ=0, | |
146 | * TIMER_SOFTIRQ, | |
147 | * NET_TX_SOFTIRQ, | |
148 | * NET_RX_SOFTIRQ, | |
149 | * BLOCK_SOFTIRQ, | |
150 | * BLOCK_IOPOLL_SOFTIRQ, | |
151 | * TASKLET_SOFTIRQ, | |
152 | * SCHED_SOFTIRQ, | |
153 | * HRTIMER_SOFTIRQ, | |
154 | * RCU_SOFTIRQ, | |
155 | * NR_SOFTIRQS // not used as this is the NUMBER of softirqs | |
156 | * }; | |
157 | * </pre> | |
158 | */ | |
159 | ||
160 | /** High-priority tasklet */ | |
161 | int SOFTIRQ_HI = 0; | |
162 | ||
163 | /** Interrupted because of timer */ | |
164 | int SOFTIRQ_TIMER = 1; | |
165 | ||
166 | /** Interrupted because of network transmission */ | |
167 | int SOFTIRQ_NET_TX = 2; | |
168 | ||
169 | /** Interrupted because of network reception */ | |
170 | int SOFTIRQ_NET_RX = 3; | |
171 | ||
172 | /** Interrupted because of block operation */ | |
173 | int SOFTIRQ_BLOCK = 4; | |
174 | ||
175 | /** Interrupted because of block IO */ | |
176 | int SOFTIRQ_BLOCK_IOPOLL = 5; | |
177 | ||
178 | /** Tasklet (differed device interrupt) */ | |
179 | int SOFTIRQ_TASKLET = 6; | |
180 | ||
181 | /** Interrupted because of the scheduler */ | |
182 | int SOFTIRQ_SCHED = 7; | |
183 | ||
184 | /** Interrupted because of HR timer */ | |
185 | int SOFTIRQ_HRTIMER = 8; | |
186 | ||
187 | /** Interrupted because of RCU */ | |
188 | int SOFTIRQ_RCU = 9; | |
03bd936a | 189 | } |