|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2026 École Polytechnique de Montréal |
| 3 | + * |
| 4 | + * All rights reserved. This program and the accompanying materials are |
| 5 | + * made available under the terms of the Eclipse Public License 2.0 which |
| 6 | + * accompanies this distribution, and is available at |
| 7 | + * https://www.eclipse.org/legal/epl-2.0/ |
| 8 | + * |
| 9 | + * SPDX-License-Identifier: EPL-2.0 |
| 10 | + *******************************************************************************/ |
1 | 11 | package org.eclipse.tracecompass.incubator.internal.virtual.machine.analysis.core.flow.analysis; |
2 | 12 |
|
3 | 13 | import java.util.ArrayList; |
4 | 14 | import java.util.List; |
5 | | -import java.io.File; |
6 | | -import java.io.FileOutputStream; |
7 | | -import java.io.IOException; |
8 | | -import java.io.PrintWriter; |
9 | 15 |
|
10 | 16 | /** |
11 | 17 | * Represents a complete execution sequence in a virtualized environment: |
12 | 18 | * <pre> |
13 | | - * Guest → VM Exit → Hypervisor (Host) → VM Entry |
| 19 | + * VM ENTRY → GUEST → VM EXIT → Hypervisor (Host) → VM Entry |
14 | 20 | * </pre> |
15 | 21 | * <p> |
16 | 22 | * This class aggregates events occurring in both the guest and the hypervisor, |
@@ -82,78 +88,6 @@ void setVmEntry(FlowEvent event) { |
82 | 88 | this.vmEntry = event; |
83 | 89 | } |
84 | 90 |
|
85 | | - /** |
86 | | - * Prints the execution sequence for debugging purposes. |
87 | | - * <p> |
88 | | - * The sequence is printed both to the standard output and appended |
89 | | - * to a file on disk. |
90 | | - * </p> |
91 | | - * |
92 | | - * @throws IOException |
93 | | - * if an I/O error occurs while writing to the file |
94 | | - */ |
95 | | - void printSequence() throws IOException { |
96 | | - try ( |
97 | | - FileOutputStream fos = new FileOutputStream( |
98 | | - new File("/home/philippe/Desktop/virtualized_flow.txt"), true); //$NON-NLS-1$ |
99 | | - PrintWriter writer = new PrintWriter(fos)) { |
100 | | - |
101 | | - // Print guest events |
102 | | - for (FlowEvent guestEvent : guestEvents) { |
103 | | - KernelEventInfo evt = guestEvent.kernelEvent; |
104 | | - System.out.printf(" [GUEST] %s (TID:%d, CPU:%d)\n", evt.name, evt.tid, evt.cpuid); //$NON-NLS-1$ |
105 | | - writer.printf(" [GUEST] %s (TID:%d, CPU:%d)\n", evt.name, evt.tid, evt.cpuid); //$NON-NLS-1$ |
106 | | - } |
107 | | - |
108 | | - // Print VM exit |
109 | | - if (vmExit != null) { |
110 | | - System.out.printf(" ↓ [VM_EXIT] %s (CPU:%d, VCPU:%d, exit_reason:%s)\n", //$NON-NLS-1$ |
111 | | - vmExit.kernelEvent.name, |
112 | | - vmExit.kernelEvent.cpuid, |
113 | | - vmExit.kernelEvent.vcpuid, |
114 | | - vmExit.kernelEvent.exitReason); |
115 | | - |
116 | | - writer.printf(" ↓ [VM_EXIT] %s (CPU:%d, VCPU:%d, exit_reason:%s)\n", //$NON-NLS-1$ |
117 | | - vmExit.kernelEvent.name, |
118 | | - vmExit.kernelEvent.cpuid, |
119 | | - vmExit.kernelEvent.vcpuid, |
120 | | - vmExit.kernelEvent.exitReason); |
121 | | - } |
122 | | - |
123 | | - // Print hypervisor events |
124 | | - for (FlowEvent hypervisorEvent : hypervisorEvents) { |
125 | | - KernelEventInfo evt = hypervisorEvent.kernelEvent; |
126 | | - System.out.printf(" [HOST] %s (PID:%d, CPU:%d)\n", //$NON-NLS-1$ |
127 | | - evt.name, evt.pid, evt.cpuid); |
128 | | - |
129 | | - writer.printf(" [HOST] %s (PID:%d, CPU:%d)\n", //$NON-NLS-1$ |
130 | | - evt.name, evt.pid, evt.cpuid); |
131 | | - } |
132 | | - |
133 | | - // Print VM entry |
134 | | - if (vmEntry != null) { |
135 | | - System.out.printf(" ↑ [VM_ENTRY] %s (CPU:%d, VCPU:%d)\n", //$NON-NLS-1$ |
136 | | - vmEntry.kernelEvent.name, |
137 | | - vmEntry.kernelEvent.cpuid, |
138 | | - vmEntry.kernelEvent.vcpuid); |
139 | | - |
140 | | - writer.printf(" ↑ [VM_ENTRY] %s (CPU:%d, VCPU:%d)\n", //$NON-NLS-1$ |
141 | | - vmEntry.kernelEvent.name, |
142 | | - vmEntry.kernelEvent.cpuid, |
143 | | - vmEntry.kernelEvent.vcpuid); |
144 | | - } |
145 | | - |
146 | | - // Print timing summary |
147 | | - if (!guestEvents.isEmpty() && vmEntry != null) { |
148 | | - long totalDuration = vmEntry.kernelEvent.timestamp |
149 | | - - guestEvents.get(0).kernelEvent.timestamp; |
150 | | - |
151 | | - System.out.printf(" Total sequence duration: %d µs\n", totalDuration / 1000); //$NON-NLS-1$ |
152 | | - writer.printf(" Total sequence duration: %d µs\n", totalDuration / 1000); //$NON-NLS-1$ |
153 | | - } |
154 | | - } |
155 | | - } |
156 | | - |
157 | 91 | /** |
158 | 92 | * Indicates whether the execution sequence is complete. |
159 | 93 | * <p> |
|
0 commit comments