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