1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.model
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
18 import com
.google
.common
.hash
.HashFunction
;
19 import com
.google
.common
.hash
.Hashing
;
22 * This class represents a thread from a specific host. Many machines in an
23 * experiment can have the same thread IDs. This class differentiates the
24 * threads by adding the host ID it belongs to.
26 * @author Geneviève Bastien
29 public class HostThread
{
31 private static final HashFunction HF
= NonNullUtils
.checkNotNull(Hashing
.goodFastHash(32));
33 private final String fHost
;
34 private final Integer fTid
;
40 * The host this thread belongs to
42 * The thread ID of this thread
44 public HostThread(String host
, Integer tid
) {
50 public int hashCode() {
52 .putUnencodedChars(fHost
)
53 .putInt(fTid
).hash().asInt();
57 public boolean equals(@Nullable Object o
) {
58 if (o
instanceof HostThread
) {
59 HostThread hostTid
= (HostThread
) o
;
60 if (fTid
.equals(hostTid
.fTid
) &&
61 fHost
.equals(hostTid
.fHost
)) {
69 public String
toString() {
70 return "HostTid: [" + fHost
+ ',' + fTid
+ ']'; //$NON-NLS-1$
74 * Get the thread ID of this thread
76 * @return The thread ID of this thread
78 public Integer
getTid() {
83 * Get the host ID of the machine this thread belongs to
85 * @return The host ID this thread belongs to
87 public String
getHost() {
This page took 0.051673 seconds and 5 git commands to generate.