-
Notifications
You must be signed in to change notification settings - Fork 10
/
AggregatedThreadStatus.java
79 lines (68 loc) · 2.22 KB
/
AggregatedThreadStatus.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
* Copyright (c) 2016, 2017 Ericsson, École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.incubator.internal.callstack.core.instrumented.callgraph;
import org.eclipse.tracecompass.analysis.os.linux.core.model.ProcessStatus;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.AggregatedCallSite;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ProcessStatusInterval;
import org.eclipse.tracecompass.incubator.internal.callstack.core.symbol.StringSymbol;
/**
* Class to calculate statistics for an aggregated function.
*
* @author Geneviève Bastien
*/
public class AggregatedThreadStatus extends AggregatedCallSite {
private final ProcessStatus fStatus;
/**
* Constructor
*
* @param status
* the process status
*/
public AggregatedThreadStatus(ProcessStatus status) {
super(new StringSymbol(status), 0);
fStatus = status;
}
/**
* Constructor
*
* @param status
* the aggregated thread status
*/
public AggregatedThreadStatus(AggregatedThreadStatus status) {
super(status);
fStatus = status.fStatus;
}
/**
* Update length
*
* @param interval
* the interval
*/
public void update(ProcessStatusInterval interval) {
addToWeight(interval.getLength());
}
/**
* Get the process status
*
* @return the process status
*/
public ProcessStatus getProcessStatus() {
return fStatus;
}
@Override
public String toString() {
return "Aggregated Thread status for " + fStatus + ": " + getWeight(); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public AggregatedCallSite copyOf() {
return new AggregatedThreadStatus(this);
}
}