/
IThreadOnCpuProvider.java
64 lines (57 loc) · 2.15 KB
/
IThreadOnCpuProvider.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
/*******************************************************************************
* Copyright (c) 2016 É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.internal.analysis.callstack.core.model;
import java.util.Collection;
import org.eclipse.jdt.annotation.Nullable;
/**
* Interface to be implemented by analyses who has information about the thread
* running on a CPU at a given time.
*
* NOTE to developers: this interface is used with the composite host model but
* won't be necessary anymore once the analyses populate the model directly.
*/
public interface IThreadOnCpuProvider {
/**
* Gets the current thread ID on a given CPU for a given time
*
* @param cpu
* the CPU
* @param time
* the time in nanoseconds
* @return the current TID at the time on the CPU or {@code null} if not
* known
*/
default @Nullable Integer getThreadOnCpuAtTime(int cpu, long time) {
return getThreadOnCpuAtTime(cpu, time, false);
}
/**
* Gets the current thread ID on a given CPU for a given time, but may
* blocks if the answer is not available yet but may come later
*
* @param cpu
* the CPU
* @param time
* the time in nanoseconds
* @param block
* If <code>true</code>, the method will block until the
* providers have the data available.
* @return the current TID at the time on the CPU or {@code null} if not
* known
*/
@Nullable Integer getThreadOnCpuAtTime(int cpu, long time, boolean block);
/**
* The list of host IDs for which this object providers information on
* thread on the CPU
*
* @return The list of host IDs
*/
Collection<String> getHostIds();
}