ced9330902fbabe78e543d89fbd15cd47aa71a3e
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / analysis / os / linux / core / inputoutput / InputOutputInformationProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2016 É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 v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.analysis.os.linux.core.inputoutput;
11
12 import java.util.Collection;
13 import java.util.Collections;
14 import java.util.HashSet;
15 import java.util.Set;
16
17 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
18
19 /**
20 * Utility methods to return data from a {@link InputOutputAnalysisModule}
21 * analysis.
22 *
23 * @author Geneviève Bastien
24 * @author Houssem Daoud
25 * @since 2.0
26 */
27 public final class InputOutputInformationProvider {
28
29 private InputOutputInformationProvider() {
30
31 }
32
33 /**
34 * Get the disks for an input/output analysis module
35 *
36 * @param module
37 * The analysis module
38 * @return A collection of disks from this analysis
39 */
40 public static Collection<Disk> getDisks(InputOutputAnalysisModule module) {
41 module.schedule();
42 if (!module.waitForInitialization()) {
43 return Collections.EMPTY_SET;
44 }
45 ITmfStateSystem ss = module.getStateSystem();
46 if (ss == null) {
47 throw new IllegalStateException("The state system should not be null at this point"); //$NON-NLS-1$
48 }
49
50 Set<Disk> disks = new HashSet<>();
51 for (Integer diskQuark : ss.getQuarks(Attributes.DISKS, "*")) { //$NON-NLS-1$
52 String devName = ss.getAttributeName(diskQuark);
53 disks.add(new Disk(Integer.parseInt(devName), ss, diskQuark));
54 }
55 return disks;
56 }
57 }
This page took 0.057198 seconds and 4 git commands to generate.