1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
;
14 public class TimeRangeEventProcess
extends TimeRangeComposite
implements
15 Comparable
<TimeRangeEventProcess
> {
16 // ========================================================================
18 // =======================================================================
20 private Long pid
= 0L;
21 private Long tgid
= 0L;
22 private Long ppid
= 0L;
23 private Long creationTime
= 0L;
24 private String traceID
= "";
25 private String processType
= "User"; // Kernel or user thread
26 private Long cpu
= 0L;
27 private String brand
= "";
29 // ========================================================================
31 // =======================================================================
36 * normally set to the Trace start time
38 * normally set to the Trace end time
42 public TimeRangeEventProcess(int id
, String name
, long startTime
,
43 long stopTime
, String groupName
, String className
, Long cpu
,
46 super(id
, startTime
, stopTime
, name
, CompositeType
.PROCESS
,
51 // ========================================================================
53 // =======================================================================
57 * Interface to add children to this process
61 public void addChildren(TimeRangeEvent newEvent
) {
62 if ((newEvent
!= null)) {
63 this.ChildEventLeafs
.add(newEvent
);
70 public Long
getPid() {
77 public void setPid(Long pid
) {
84 public Long
getTgid() {
91 public void setTgid(Long tgid
) {
98 public Long
getPpid() {
105 public void setPpid(Long ppid
) {
112 public Long
getCreationTime() {
117 * @param creationTime
119 public void setCreationTime(Long creationTime
) {
120 this.creationTime
= creationTime
;
126 public String
getTraceID() {
133 public void setTraceID(String traceID
) {
134 if (traceID
!= null) {
135 this.traceID
= traceID
;
144 public String
getProcessType() {
151 public void setProcessType(String processType
) {
152 if (processType
!= null) {
153 this.processType
= processType
;
160 public Long
getCpu() {
167 public void setCpu(Long cpu
) {
178 public String
getBrand() {
185 public void setBrand(String brand
) {
196 * @see java.lang.Comparable#compareTo(java.lang.Object)
199 public int compareTo(TimeRangeEventProcess process
) {
200 if (process
!= null) {
202 // first compare by pid
203 Long anotherPid
= process
.getPid();
204 result
= pid
.compareTo(anotherPid
);
210 Long anotherCpu
= process
.getCpu();
211 result
= cpu
.compareTo(anotherCpu
);
217 String anotherTraceId
= process
.getTraceID();
218 return traceID
.compareTo(anotherTraceId
);
225 public String
toString() {
226 return "[TimeRangeEventProcess:" + super.toString() +
227 ",pid=" + pid
+ ",tgid=" + tgid
+ ",ppid=" + ppid
+ ",ctime=" + creationTime
+
228 ",trace=" + traceID
+ ",ptype=" + processType
+ ",cpu=" + cpu
+ ",brand=" + brand
+ "]";