Search in sources :

Example 1 with DisksIODataProvider

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider in project tracecompass by tracecompass.

the class InputOutputDataProviderTest method getProvider.

@NonNull
private DisksIODataProvider getProvider() {
    InputOutputAnalysisModule module = setUp(fTestCase.getTraceFileName());
    ITmfTrace trace = module.getTrace();
    assertNotNull(trace);
    DisksIODataProvider provider = DisksIODataProvider.create(trace);
    assertNotNull(provider);
    return provider;
}
Also used : DisksIODataProvider(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 2 with DisksIODataProvider

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider in project tracecompass by tracecompass.

the class InputOutputDataProviderTest method testDiskActivity.

/**
 * Test the data provider
 */
@Test
public void testDiskActivity() {
    DisksIODataProvider provider = getProvider();
    Collection<@NonNull DiskActivity> diskActivity = fTestCase.getDiskActivity();
    for (DiskActivity test : diskActivity) {
        Map<@NonNull String, @NonNull Object> parameters = test.getTimeQuery();
        TmfModelResponse<@NonNull TmfTreeModel<@NonNull TmfTreeDataModel>> response = provider.fetchTree(parameters, PROGRESS_MONITOR);
        assertEquals(ITmfResponse.Status.COMPLETED, response.getStatus());
        TmfTreeModel<@NonNull TmfTreeDataModel> model = response.getModel();
        assertNotNull(model);
        parameters = test.getTimeQueryForModel(model);
        TmfModelResponse<@NonNull ITmfXyModel> yResponse = provider.fetchXY(parameters, PROGRESS_MONITOR);
        assertEquals(ITmfResponse.Status.COMPLETED, yResponse.getStatus());
        ITmfXyModel yModel = yResponse.getModel();
        assertNotNull(yModel);
        Collection<@NonNull ISeriesModel> data = yModel.getSeriesData();
        assertEquals(1, data.size());
        ISeriesModel ySeries = data.iterator().next();
        double[] expected = test.getActivity();
        double[] actual = ySeries.getData();
        for (int i = 0; i < expected.length; i++) {
            assertTrue(String.format("No actual value at position %d for %s", i, test), actual.length > i);
            assertEquals(String.format("Value at position %d for %s", i, test), expected[i], actual[i], 0.001);
        }
        assertEquals(String.format("More values than expected for %s", test), expected.length, actual.length);
    }
}
Also used : ISeriesModel(org.eclipse.tracecompass.tmf.core.model.xy.ISeriesModel) TmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel) DisksIODataProvider(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider) DiskActivity(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.DiskActivity) NonNull(org.eclipse.jdt.annotation.NonNull) TmfTreeModel(org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel) ITmfXyModel(org.eclipse.tracecompass.tmf.core.model.xy.ITmfXyModel) Test(org.junit.Test)

Aggregations

NonNull (org.eclipse.jdt.annotation.NonNull)2 DisksIODataProvider (org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider)2 DiskActivity (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.DiskActivity)1 InputOutputAnalysisModule (org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule)1 TmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel)1 TmfTreeModel (org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel)1 ISeriesModel (org.eclipse.tracecompass.tmf.core.model.xy.ISeriesModel)1 ITmfXyModel (org.eclipse.tracecompass.tmf.core.model.xy.ITmfXyModel)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1 Test (org.junit.Test)1