analysis.io: Make the main package internal for now
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / analysis / os / linux / core / inputoutput / InputOutputInformationProvider.java
CommitLineData
d0043318
GB
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
10package org.eclipse.tracecompass.analysis.os.linux.core.inputoutput;
11
12import java.util.Collection;
13import java.util.Collections;
14import java.util.HashSet;
15import java.util.Set;
16
17import 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
d0043318
GB
25 */
26public final class InputOutputInformationProvider {
27
28 private InputOutputInformationProvider() {
29
30 }
31
32 /**
33 * Get the disks for an input/output analysis module
34 *
35 * @param module
36 * The analysis module
37 * @return A collection of disks from this analysis
38 */
39 public static Collection<Disk> getDisks(InputOutputAnalysisModule module) {
40 module.schedule();
41 if (!module.waitForInitialization()) {
42 return Collections.EMPTY_SET;
43 }
44 ITmfStateSystem ss = module.getStateSystem();
45 if (ss == null) {
46 throw new IllegalStateException("The state system should not be null at this point"); //$NON-NLS-1$
47 }
48
49 Set<Disk> disks = new HashSet<>();
50 for (Integer diskQuark : ss.getQuarks(Attributes.DISKS, "*")) { //$NON-NLS-1$
51 String devName = ss.getAttributeName(diskQuark);
52 disks.add(new Disk(Integer.parseInt(devName), ss, diskQuark));
53 }
54 return disks;
55 }
56}
This page took 0.026502 seconds and 5 git commands to generate.