Commit | Line | Data |
---|---|---|
dffc234f | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2014, 2015 École Polytechnique de Montréal |
dffc234f GB |
3 | * |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Geneviève Bastien - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
e363eae1 | 13 | package org.eclipse.tracecompass.analysis.os.linux.ui.views.cpuusage; |
dffc234f | 14 | |
2bdf0193 | 15 | import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeViewerEntry; |
dffc234f GB |
16 | |
17 | /** | |
18 | * Represents an entry in the tree viewer of the CPU usage view. An entry is a | |
19 | * thread that occupied part of the CPU in the selected time range. | |
20 | * | |
21 | * @author Geneviève Bastien | |
22 | */ | |
23 | public class CpuUsageEntry extends TmfTreeViewerEntry { | |
24 | private final String fTid; | |
25 | private final String fProcessName; | |
26 | private final Double fPercent; | |
27 | private final Long fTime; | |
28 | ||
29 | /** | |
30 | * Constructor | |
31 | * | |
32 | * @param tid | |
33 | * The TID of the process | |
34 | * @param name | |
35 | * The thread's name | |
36 | * @param percent | |
37 | * The percentage CPU usage | |
38 | * @param time | |
39 | * The total amount of time spent on CPU | |
40 | */ | |
41 | public CpuUsageEntry(String tid, String name, double percent, long time) { | |
42 | super(tid); | |
43 | fTid = tid; | |
44 | fProcessName = name; | |
45 | fPercent = percent; | |
46 | fTime = time; | |
47 | } | |
48 | ||
49 | /** | |
50 | * Get the TID of the thread represented by this entry | |
51 | * | |
52 | * @return The thread's TID | |
53 | */ | |
54 | public String getTid() { | |
55 | return fTid; | |
56 | } | |
57 | ||
58 | /** | |
59 | * Get the process name | |
60 | * | |
61 | * @return The process name | |
62 | */ | |
63 | public String getProcessName() { | |
64 | return fProcessName; | |
65 | } | |
66 | ||
67 | /** | |
68 | * Get the percentage of time spent on CPU in the time interval represented | |
69 | * by this entry. | |
70 | * | |
71 | * @return The percentage of time spent on CPU | |
72 | */ | |
73 | public Double getPercent() { | |
74 | return fPercent; | |
75 | } | |
76 | ||
77 | /** | |
78 | * Get the total time spent on CPU in the time interval represented by this | |
79 | * entry. | |
80 | * | |
81 | * @return The total time spent on CPU | |
82 | */ | |
83 | public Long getTime() { | |
84 | return fTime; | |
85 | } | |
86 | } |