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
.internal
.lttng2
.kernel
.core
.analysis
.vm
.model
;
16 * This class represents a machine, host or guest, in a virtual machine model. A
17 * machine is identified by a trace's host ID.
19 * @author Geneviève Bastien
21 public final class VirtualMachine
{
23 private static enum MachineType
{
28 private final long fVmUid
;
29 private final String fHostId
;
30 private final MachineType fType
;
33 * Create a new host machine. A host is a physical machine that may contain
34 * virtual guest machines.
37 * The host ID of the trace(s) this machine represents
38 * @return A {@link VirtualMachine} of type host
40 public static VirtualMachine
newHostMachine(String hostId
) {
41 return new VirtualMachine(MachineType
.HOST
, hostId
, -1);
45 * Create a new guest machine. A guest is a virtual machine with virtual
46 * CPUs running on a host.
49 * Some unique identifier of this guest machine that can be used
50 * in both the guest and the host to match both machines.
52 * The host ID of the trace(s) this machine represents
53 * @return A {@link VirtualMachine} of type guest.
55 public static VirtualMachine
newGuestMachine(long uid
, String hostId
) {
56 return new VirtualMachine(MachineType
.GUEST
, hostId
, uid
);
59 private VirtualMachine(MachineType type
, String hostId
, long uid
) {
66 * Return whether this machine is a guest or a host
68 * @return {@code true} if the machine is a guest, or {@code false} if it is
71 public boolean isGuest() {
72 return fType
== MachineType
.GUEST
;
76 * Get the unique identifier that is used between the host and the guest to
77 * identify this machine.
79 * @return The Virtual Machine unique ID.
81 public long getVmUid() {
86 * Get the host ID of this machine
88 * @return The host ID of this machine
90 public String
getHostId() {
95 public String
toString() {
96 return "VirtualMachine: " + fHostId
; //$NON-NLS-1$
This page took 0.033234 seconds and 5 git commands to generate.