1 /*******************************************************************************
2 * Copyright (c) 2016 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
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.ui
.views
.resources
;
12 import java
.util
.ArrayList
;
13 import java
.util
.Comparator
;
14 import java
.util
.Iterator
;
15 import java
.util
.List
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystem
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
20 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
22 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.TimeEvent
;
25 * Internal entry of the aggregate kind, it is one without a state system value,
26 * it uses other entries and aggregates their values.
28 * @author Matthew Khouzam
30 class AggregateResourcesEntry
extends ResourcesEntry
{
32 private final @NonNull List
<ITimeGraphEntry
> fContributors
= new ArrayList
<>();
34 private static final Comparator
<ITimeEvent
> COMPARATOR
= new Comparator
<ITimeEvent
>() {
36 public int compare(ITimeEvent o1
, ITimeEvent o2
) {
38 return Integer
.compare(getValue(o2
), getValue(o1
));
41 private int getValue(ITimeEvent element
) {
42 return (element
instanceof TimeEvent
) ?
((TimeEvent
) element
).getValue() : Integer
.MIN_VALUE
;
47 * AggregateResourcesEntry Constructor
60 public AggregateResourcesEntry(@NonNull ITmfTrace trace
,
61 long startTime
, long endTime
, Type type
, int id
) {
62 super(ITmfStateSystem
.INVALID_ATTRIBUTE
, trace
, startTime
, endTime
, type
, id
);
69 * The trace on which we are working
71 * The exec_name of this entry
73 * The start time of this entry lifetime
75 * The end time of this entry
77 * The type of this entry
79 * The id of this entry
81 public AggregateResourcesEntry(@NonNull ITmfTrace trace
, String name
, long startTime
, long endTime
, Type type
, int id
) {
82 super(ITmfStateSystem
.INVALID_ATTRIBUTE
, trace
, name
, startTime
, endTime
, type
, id
);
86 public void addEvent(ITimeEvent event
) {
90 public void addZoomedEvent(ITimeEvent event
) {
94 public Iterator
<@NonNull ITimeEvent
> getTimeEventsIterator() {
95 return new AggregateEventIterator(fContributors
, COMPARATOR
);
99 public Iterator
<@NonNull ITimeEvent
> getTimeEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
100 return new AggregateEventIterator(fContributors
, startTime
, stopTime
, visibleDuration
, COMPARATOR
);
103 public void addContributor(ITimeGraphEntry entry
) {
104 fContributors
.add(entry
);
This page took 0.033387 seconds and 5 git commands to generate.