a6b079f46c03ba484f8d418cfd8a6fc352002ffb
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core / src / org / eclipse / linuxtools / internal / lttng2 / kernel / core / stateprovider / LttngKernelStateProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
5 *
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;
14
15 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
16 import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
17 import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
18 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
19 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
20 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
21 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
22 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
23 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
24 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
25 import org.eclipse.linuxtools.tmf.core.statesystem.AbstractTmfStateProvider;
26 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
27 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
28 import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
29
30 /**
31 * This is the state change input plugin for TMF's state system which handles
32 * the LTTng 2.0 kernel traces in CTF format.
33 *
34 * It uses the reference handler defined in CTFKernelHandler.java.
35 *
36 * @author alexmont
37 *
38 */
39 public class LttngKernelStateProvider extends AbstractTmfStateProvider {
40
41 /**
42 * Version number of this state provider. Please bump this if you modify the
43 * contents of the generated state history in some way.
44 */
45 private static final int VERSION = 4;
46
47 // ------------------------------------------------------------------------
48 // Constructor
49 // ------------------------------------------------------------------------
50
51 /**
52 * Instantiate a new state provider plugin.
53 *
54 * @param trace
55 * The LTTng 2.0 kernel trace directory
56 */
57 public LttngKernelStateProvider(CtfTmfTrace trace) {
58 super(trace, CtfTmfEvent.class, "LTTng Kernel"); //$NON-NLS-1$
59 }
60
61 // ------------------------------------------------------------------------
62 // IStateChangeInput
63 // ------------------------------------------------------------------------
64
65 @Override
66 public int getVersion() {
67 return VERSION;
68 }
69
70 @Override
71 public void assignTargetStateSystem(ITmfStateSystemBuilder ssb) {
72 /* We can only set up the locations once the state system is assigned */
73 super.assignTargetStateSystem(ssb);
74 }
75
76 @Override
77 public LttngKernelStateProvider getNewInstance() {
78 return new LttngKernelStateProvider((CtfTmfTrace) this.getTrace());
79 }
80
81 @Override
82 protected void eventHandle(ITmfEvent ev) {
83 /*
84 * AbstractStateChangeInput should have already checked for the correct
85 * class type
86 */
87 final CtfTmfEvent event = (CtfTmfEvent) ev;
88
89 final ITmfEventField content = event.getContent();
90 final String eventName = event.getType().getName();
91 final long ts = event.getTimestamp().getValue();
92
93 try {
94 /* Shortcut for the "current CPU" attribute node */
95 final Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(), String.valueOf(event.getCPU()));
96
97 /*
98 * Shortcut for the "current thread" attribute node. It requires
99 * querying the current CPU's current thread.
100 */
101 int quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
102 ITmfStateValue value = ss.queryOngoingState(quark);
103 int thread = value.isNull() ? -1 : value.unboxInt();
104 final Integer currentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(thread));
105
106 /*
107 * Feed event to the history system if it's known to cause a state
108 * transition.
109 */
110 switch (eventName) {
111
112 case LttngStrings.EXIT_SYSCALL:
113 /* Fields: int64 ret */
114 {
115 /* Clear the current system call on the process */
116 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
117 value = TmfStateValue.nullValue();
118 ss.modifyAttribute(ts, value, quark);
119
120 /* Put the process' status back to user mode */
121 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
122 value = StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE;
123 ss.modifyAttribute(ts, value, quark);
124
125 /* Put the CPU's status back to user mode */
126 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
127 value = StateValues.CPU_STATUS_RUN_USERMODE_VALUE;
128 ss.modifyAttribute(ts, value, quark);
129 }
130 break;
131
132 case LttngStrings.IRQ_HANDLER_ENTRY:
133 /* Fields: int32 irq, string name */
134 {
135 Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
136
137 /* Mark this IRQ as active in the resource tree.
138 * The state value = the CPU on which this IRQ is sitting */
139 quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
140 value = TmfStateValue.newValueInt(event.getCPU());
141 ss.modifyAttribute(ts, value, quark);
142
143 /* Change the status of the running process to interrupted */
144 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
145 value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
146 ss.modifyAttribute(ts, value, quark);
147
148 /* Change the status of the CPU to interrupted */
149 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
150 value = StateValues.CPU_STATUS_IRQ_VALUE;
151 ss.modifyAttribute(ts, value, quark);
152 }
153 break;
154
155 case LttngStrings.IRQ_HANDLER_EXIT:
156 /* Fields: int32 irq, int32 ret */
157 {
158 Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
159
160 /* Put this IRQ back to inactive in the resource tree */
161 quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
162 value = TmfStateValue.nullValue();
163 ss.modifyAttribute(ts, value, quark);
164
165 /* Set the previous process back to running */
166 setProcessToRunning(ts, currentThreadNode);
167
168 /* Set the CPU status back to running or "idle" */
169 cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
170 }
171 break;
172
173 case LttngStrings.SOFTIRQ_ENTRY:
174 /* Fields: int32 vec */
175 {
176 Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
177
178 /* Mark this SoftIRQ as active in the resource tree.
179 * The state value = the CPU on which this SoftIRQ is processed */
180 quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
181 value = TmfStateValue.newValueInt(event.getCPU());
182 ss.modifyAttribute(ts, value, quark);
183
184 /* Change the status of the running process to interrupted */
185 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
186 value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
187 ss.modifyAttribute(ts, value, quark);
188
189 /* Change the status of the CPU to interrupted */
190 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
191 value = StateValues.CPU_STATUS_SOFTIRQ_VALUE;
192 ss.modifyAttribute(ts, value, quark);
193 }
194 break;
195
196 case LttngStrings.SOFTIRQ_EXIT:
197 /* Fields: int32 vec */
198 {
199 Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
200
201 /* Put this SoftIRQ back to inactive (= -1) in the resource tree */
202 quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
203 value = TmfStateValue.nullValue();
204 ss.modifyAttribute(ts, value, quark);
205
206 /* Set the previous process back to running */
207 setProcessToRunning(ts, currentThreadNode);
208
209 /* Set the CPU status back to "busy" or "idle" */
210 cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
211 }
212 break;
213
214 case LttngStrings.SOFTIRQ_RAISE:
215 /* Fields: int32 vec */
216 {
217 Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
218
219 /* Mark this SoftIRQ as *raised* in the resource tree.
220 * State value = -2 */
221 quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
222 value = StateValues.SOFT_IRQ_RAISED_VALUE;
223 ss.modifyAttribute(ts, value, quark);
224 }
225 break;
226
227 case LttngStrings.SCHED_SWITCH:
228 /*
229 * Fields: string prev_comm, int32 prev_tid, int32 prev_prio, int64 prev_state,
230 * string next_comm, int32 next_tid, int32 next_prio
231 */
232 {
233 Integer prevTid = ((Long) content.getField(LttngStrings.PREV_TID).getValue()).intValue();
234 Long prevState = (Long) content.getField(LttngStrings.PREV_STATE).getValue();
235 String nextProcessName = (String) content.getField(LttngStrings.NEXT_COMM).getValue();
236 Integer nextTid = ((Long) content.getField(LttngStrings.NEXT_TID).getValue()).intValue();
237
238 Integer formerThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), prevTid.toString());
239 Integer newCurrentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), nextTid.toString());
240
241 /* Set the status of the process that got scheduled out. */
242 quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
243 if (prevState != 0) {
244 value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
245 } else {
246 value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
247 }
248 ss.modifyAttribute(ts, value, quark);
249
250 /* Set the status of the new scheduled process */
251 setProcessToRunning(ts, newCurrentThreadNode);
252
253 /* Set the exec name of the new process */
254 quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.EXEC_NAME);
255 value = TmfStateValue.newValueString(nextProcessName);
256 ss.modifyAttribute(ts, value, quark);
257
258 /* Make sure the PPID and system_call sub-attributes exist */
259 ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
260 ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.PPID);
261
262 /* Set the current scheduled process on the relevant CPU */
263 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
264 value = TmfStateValue.newValueInt(nextTid);
265 ss.modifyAttribute(ts, value, quark);
266
267 /* Set the status of the CPU itself */
268 if (nextTid > 0) {
269 /* Check if the entering process is in kernel or user mode */
270 quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
271 if (ss.queryOngoingState(quark).isNull()) {
272 value = StateValues.CPU_STATUS_RUN_USERMODE_VALUE;
273 } else {
274 value = StateValues.CPU_STATUS_RUN_SYSCALL_VALUE;
275 }
276 } else {
277 value = StateValues.CPU_STATUS_IDLE_VALUE;
278 }
279 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
280 ss.modifyAttribute(ts, value, quark);
281 }
282 break;
283
284 case LttngStrings.SCHED_PROCESS_FORK:
285 /* Fields: string parent_comm, int32 parent_tid,
286 * string child_comm, int32 child_tid */
287 {
288 // String parentProcessName = (String) event.getFieldValue("parent_comm");
289 String childProcessName = (String) content.getField(LttngStrings.CHILD_COMM).getValue();
290 // assert ( parentProcessName.equals(childProcessName) );
291
292 Integer parentTid = ((Long) content.getField(LttngStrings.PARENT_TID).getValue()).intValue();
293 Integer childTid = ((Long) content.getField(LttngStrings.CHILD_TID).getValue()).intValue();
294
295 Integer parentTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), parentTid.toString());
296 Integer childTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), childTid.toString());
297
298 /* Assign the PPID to the new process */
299 quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.PPID);
300 value = TmfStateValue.newValueInt(parentTid);
301 ss.modifyAttribute(ts, value, quark);
302
303 /* Set the new process' exec_name */
304 quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.EXEC_NAME);
305 value = TmfStateValue.newValueString(childProcessName);
306 ss.modifyAttribute(ts, value, quark);
307
308 /* Set the new process' status */
309 quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.STATUS);
310 value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
311 ss.modifyAttribute(ts, value, quark);
312
313 /* Set the process' syscall name, to be the same as the parent's */
314 quark = ss.getQuarkRelativeAndAdd(parentTidNode, Attributes.SYSTEM_CALL);
315 value = ss.queryOngoingState(quark);
316 if (value.isNull()) {
317 /*
318 * Maybe we were missing info about the parent? At least we
319 * will set the child right. Let's suppose "sys_clone".
320 */
321 value = TmfStateValue.newValueString(LttngStrings.SYS_CLONE);
322 }
323 quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
324 ss.modifyAttribute(ts, value, quark);
325 }
326 break;
327
328 case LttngStrings.SCHED_PROCESS_EXIT:
329 /* Fields: string comm, int32 tid, int32 prio */
330 break;
331
332 case LttngStrings.SCHED_PROCESS_FREE:
333 /* Fields: string comm, int32 tid, int32 prio */
334 /*
335 * A sched_process_free will always happen after the sched_switch
336 * that will remove the process from the cpu for the last time. So
337 * this is when we should delete everything wrt to the process.
338 */
339 {
340 Integer tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
341 /*
342 * Remove the process and all its sub-attributes from the
343 * current state
344 */
345 quark = ss.getQuarkRelativeAndAdd(getNodeThreads(), tid.toString());
346 ss.removeAttribute(ts, quark);
347 }
348 break;
349
350 case LttngStrings.STATEDUMP_PROCESS_STATE:
351 /* Fields:
352 * int32 type, int32 mode, int32 pid, int32 submode, int32 vpid,
353 * int32 ppid, int32 tid, string name, int32 status, int32 vtid */
354 {
355 int tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
356 int pid = ((Long) content.getField(LttngStrings.PID).getValue()).intValue();
357 int ppid = ((Long) content.getField(LttngStrings.PPID).getValue()).intValue();
358 int status = ((Long) content.getField(LttngStrings.STATUS).getValue()).intValue();
359 String name = (String) content.getField(LttngStrings.NAME).getValue();
360 /*
361 * "mode" could be interesting too, but it doesn't seem to be
362 * populated with anything relevant for now.
363 */
364
365 int curThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(tid));
366
367 /* Set the process' name */
368 quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.EXEC_NAME);
369 if (ss.queryOngoingState(quark).isNull()) {
370 /* If the value didn't exist previously, set it */
371 value = TmfStateValue.newValueString(name);
372 ss.modifyAttribute(ts, value, quark);
373 }
374
375 /* Set the process' PPID */
376 quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.PPID);
377 if (ss.queryOngoingState(quark).isNull()) {
378 if (pid == tid) {
379 /* We have a process. Use the 'PPID' field. */
380 value = TmfStateValue.newValueInt(ppid);
381 } else {
382 /* We have a thread, use the 'PID' field for the parent. */
383 value = TmfStateValue.newValueInt(pid);
384 }
385 ss.modifyAttribute(ts, value, quark);
386 }
387
388 /* Set the process' status */
389 quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.STATUS);
390 if (ss.queryOngoingState(quark).isNull()) {
391 /* "2" here means "WAIT_FOR_CPU", and "5" "WAIT_BLOCKED" in the LTTng kernel. */
392 if (status == 2) {
393 value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
394 } else if (status == 5) {
395 value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
396 } else {
397 value = StateValues.PROCESS_STATUS_UNKNOWN_VALUE;
398 }
399 ss.modifyAttribute(ts, value, quark);
400 }
401 }
402 break;
403
404 case LttngStrings.SCHED_WAKEUP:
405 case LttngStrings.SCHED_WAKEUP_NEW:
406 /* Fields (same fields for both types):
407 * string comm, int32 pid, int32 prio, int32 success,
408 * int32 target_cpu */
409 {
410 final int tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
411 final int threadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(tid));
412
413 /*
414 * The process indicated in the event's payload is now ready to
415 * run. Assign it to the "wait for cpu" state, but only if it
416 * was not already running.
417 */
418 quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.STATUS);
419 int status = ss.queryOngoingState(quark).unboxInt();
420
421 if (status != StateValues.PROCESS_STATUS_RUN_SYSCALL &&
422 status != StateValues.PROCESS_STATUS_RUN_USERMODE) {
423 value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
424 ss.modifyAttribute(ts, value, quark);
425 }
426 }
427 break;
428
429 default:
430 /* Other event types not covered by the main switch */
431 {
432 if (eventName.startsWith(LttngStrings.SYSCALL_PREFIX)
433 || eventName.startsWith(LttngStrings.COMPAT_SYSCALL_PREFIX)) {
434 /*
435 * This is a replacement for the old sys_enter event. Now
436 * syscall names are listed into the event type
437 */
438
439 /* Assign the new system call to the process */
440 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
441 value = TmfStateValue.newValueString(eventName);
442 ss.modifyAttribute(ts, value, quark);
443
444 /* Put the process in system call mode */
445 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
446 value = StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE;
447 ss.modifyAttribute(ts, value, quark);
448
449 /* Put the CPU in system call (kernel) mode */
450 quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
451 value = StateValues.CPU_STATUS_RUN_SYSCALL_VALUE;
452 ss.modifyAttribute(ts, value, quark);
453 }
454 }
455 break;
456 } // End of big switch
457
458 } catch (AttributeNotFoundException ae) {
459 /*
460 * This would indicate a problem with the logic of the manager here,
461 * so it shouldn't happen.
462 */
463 ae.printStackTrace();
464
465 } catch (TimeRangeException tre) {
466 /*
467 * This would happen if the events in the trace aren't ordered
468 * chronologically, which should never be the case ...
469 */
470 System.err.println("TimeRangeExcpetion caught in the state system's event manager."); //$NON-NLS-1$
471 System.err.println("Are the events in the trace correctly ordered?"); //$NON-NLS-1$
472 tre.printStackTrace();
473
474 } catch (StateValueTypeException sve) {
475 /*
476 * This would happen if we were trying to push/pop attributes not of
477 * type integer. Which, once again, should never happen.
478 */
479 sve.printStackTrace();
480 }
481 }
482
483 // ------------------------------------------------------------------------
484 // Convenience methods for commonly-used attribute tree locations
485 // ------------------------------------------------------------------------
486
487 private int getNodeCPUs() {
488 return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
489 }
490
491 private int getNodeThreads() {
492 return ss.getQuarkAbsoluteAndAdd(Attributes.THREADS);
493 }
494
495 private int getNodeIRQs() {
496 return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.IRQS);
497 }
498
499 private int getNodeSoftIRQs() {
500 return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.SOFT_IRQS);
501 }
502
503 // ------------------------------------------------------------------------
504 // Advanced state-setting methods
505 // ------------------------------------------------------------------------
506
507 /**
508 * When we want to set a process back to a "running" state, first check
509 * its current System_call attribute. If there is a system call active, we
510 * put the process back in the syscall state. If not, we put it back in
511 * user mode state.
512 */
513 private void setProcessToRunning(long ts, int currentThreadNode)
514 throws AttributeNotFoundException, TimeRangeException,
515 StateValueTypeException {
516 int quark;
517 ITmfStateValue value;
518
519 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
520 if (ss.queryOngoingState(quark).isNull()) {
521 /* We were in user mode before the interruption */
522 value = StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE;
523 } else {
524 /* We were previously in kernel mode */
525 value = StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE;
526 }
527 quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
528 ss.modifyAttribute(ts, value, quark);
529 }
530
531 /**
532 * Similar logic as above, but to set the CPU's status when it's coming out
533 * of an interruption.
534 */
535 private void cpuExitInterrupt(long ts, int currentCpuNode, int currentThreadNode)
536 throws StateValueTypeException, AttributeNotFoundException,
537 TimeRangeException {
538 int quark;
539 ITmfStateValue value;
540
541 quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.CURRENT_THREAD);
542 if (ss.queryOngoingState(quark).unboxInt() > 0) {
543 /* There was a process on the CPU */
544 quark = ss.getQuarkRelative(currentThreadNode, Attributes.SYSTEM_CALL);
545 if (ss.queryOngoingState(quark).isNull()) {
546 /* That process was in user mode */
547 value = StateValues.CPU_STATUS_RUN_USERMODE_VALUE;
548 } else {
549 /* That process was in a system call */
550 value = StateValues.CPU_STATUS_RUN_SYSCALL_VALUE;
551 }
552 } else {
553 /* There was no real process scheduled, CPU was idle */
554 value = StateValues.CPU_STATUS_IDLE_VALUE;
555 }
556 quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.STATUS);
557 ss.modifyAttribute(ts, value, quark);
558 }
559 }
This page took 0.073492 seconds and 4 git commands to generate.