1 /*******************************************************************************
2 * Copyright (c) 2016 É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
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.inputoutput
;
12 import java
.util
.Collection
;
13 import java
.util
.Collections
;
14 import java
.util
.HashSet
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystem
;
20 * Utility methods to return data from a {@link InputOutputAnalysisModule}
23 * @author Geneviève Bastien
24 * @author Houssem Daoud
27 public final class InputOutputInformationProvider
{
29 private InputOutputInformationProvider() {
34 * Get the disks for an input/output analysis module
38 * @return A collection of disks from this analysis
40 public static Collection
<Disk
> getDisks(InputOutputAnalysisModule module
) {
42 if (!module
.waitForInitialization()) {
43 return Collections
.EMPTY_SET
;
45 ITmfStateSystem ss
= module
.getStateSystem();
47 throw new IllegalStateException("The state system should not be null at this point"); //$NON-NLS-1$
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
));