Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 80d104930abf234f6e2ba999c5f2febff490c944 (plain) (blame)
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
/*******************************************************************************
 * Copyright (c) 2014, 2015 Ericsson
 *
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Alexandre Montplaisir - Initial API and implementation
 *******************************************************************************/

package org.eclipse.tracecompass.tmf.core.event.aspect;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;

/**
 * Event aspect representing the CPU of a trace event. Trace types that do have
 * the notion of CPU can use this to expose it in their traces.
 *
 * TODO Move to an eventualy kernel-trace-specific plugin.
 *
 * @author Alexandre Montplaisir
 */
public abstract class TmfCpuAspect implements ITmfEventAspect {

    @Override
    public final String getName() {
        return Messages.getMessage(Messages.AspectName_CPU);
    }

    @Override
    public final String getHelpText() {
        return Messages.getMessage(Messages.AspectHelpText_CPU);
    }

    /**
     * Returns the CPU number of the CPU on which this event was executed or
     * {@code null} if the CPU is not available for an event.
     */
    @Override
    public abstract @Nullable Integer resolve(ITmfEvent event);

    @Override
    public boolean equals(@Nullable Object other) {
        /*
         * Consider all sub-instance of this type "equal", so that they get
         * merged in a single CPU column/aspect.
         */
        if (other instanceof TmfCpuAspect) {
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return getName().hashCode();
    }
}

Back to the top