Search in sources :

Example 1 with InputOutputAnalysisModule

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

the class AbstractTestInputOutput method setUp.

/**
 * Setup the trace for the tests and return the InputOutputAnalysisModule,
 * not executed.
 *
 * @param fileName
 *            The file name of the trace to open
 * @return The input output analysis module
 */
@NonNull
protected InputOutputAnalysisModule setUp(String fileName) {
    TmfXmlKernelTraceStub trace = new TmfXmlKernelTraceStub();
    trace.addEventAspect(KernelTidAspect.INSTANCE);
    trace.setKernelEventLayout(EVENT_LAYOUT);
    IPath filePath = Activator.getAbsoluteFilePath(IO_FILE_PATH + fileName);
    IStatus status = trace.validate(null, filePath.toOSString());
    if (!status.isOK()) {
        fail(status.getException().getMessage());
    }
    try {
        trace.initTrace(null, filePath.toOSString(), TmfEvent.class);
    } catch (TmfTraceException e) {
        fail(e.getMessage());
    }
    deleteSuppFiles(trace);
    ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    fTrace = trace;
    /* Start the kernel analysis module */
    KernelAnalysisModule kernelMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
    assertNotNull(kernelMod);
    kernelMod.schedule();
    kernelMod.waitForCompletion();
    InputOutputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, InputOutputAnalysisModule.class, InputOutputAnalysisModule.ID);
    assertNotNull(module);
    return module;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) TmfXmlKernelTraceStub(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub) IPath(org.eclipse.core.runtime.IPath) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 2 with InputOutputAnalysisModule

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule 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 3 with InputOutputAnalysisModule

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

the class InputOutputDiskTest method testSectorsAt.

/**
 * Test the {@link Disk#getSectorsAt(long, IoOperationType)} method
 * method
 */
@Test
public void testSectorsAt() {
    InputOutputAnalysisModule module = setUp(fTestCase.getTraceFileName());
    for (Integer deviceId : fTestCase.getSectorCount().keySet()) {
        Disk disk = getDisk(module, deviceId);
        assertNotNull(disk);
        for (SectorCountInfo info : fTestCase.getSectorCount().get(deviceId)) {
            double sectorsAt = disk.getSectorsAt(info.getTimestamp(), info.getType());
            assertEquals("Sectors at " + info.getTimestamp() + " for type " + info.getType(), info.getNbSectors(), sectorsAt, 1.0);
        }
    }
}
Also used : InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) SectorCountInfo(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.SectorCountInfo) Disk(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.Disk) Test(org.junit.Test)

Example 4 with InputOutputAnalysisModule

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

the class InputOutputStateProviderTest method testStateProviderPunctualData.

/**
 * Test the data of attributes at punctual times
 */
@Test
public void testStateProviderPunctualData() {
    InputOutputAnalysisModule module = setUp(fTestCase.getTraceFileName());
    assertNotNull(module);
    TmfTestHelper.executeAnalysis(module);
    ITmfStateSystem ss = module.getStateSystem();
    assertNotNull(ss);
    for (@NonNull PunctualInfo info : fTestCase.getPunctualTestData()) {
        StateSystemTestUtils.testValuesAtTime(ss, info.getTimestamp(), info.getValues());
    }
}
Also used : NonNull(org.eclipse.jdt.annotation.NonNull) InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) PunctualInfo(org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase.PunctualInfo) Test(org.junit.Test)

Example 5 with InputOutputAnalysisModule

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

the class InputOutputStateProviderTest method testAnalysisExecution.

/**
 * Test that the analysis executes without problems
 */
@Test
public void testAnalysisExecution() {
    InputOutputAnalysisModule module = setUp(fTestCase.getTraceFileName());
    /* Make sure the analysis hasn't run yet */
    assertNull(module.getStateSystem());
    /* Execute the analysis */
    assertTrue(TmfTestHelper.executeAnalysis(module));
    assertNotNull(module.getStateSystem());
}
Also used : InputOutputAnalysisModule(org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule) Test(org.junit.Test)

Aggregations

InputOutputAnalysisModule (org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputAnalysisModule)11 NonNull (org.eclipse.jdt.annotation.NonNull)6 Test (org.junit.Test)6 Disk (org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.Disk)3 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)2 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)2 IPath (org.eclipse.core.runtime.IPath)1 IStatus (org.eclipse.core.runtime.IStatus)1 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)1 PunctualInfo (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase.PunctualInfo)1 DiskInfo (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.DiskInfo)1 SectorCountInfo (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.SectorCountInfo)1 TmfXmlKernelTraceStub (org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub)1 DisksIODataProvider (org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.DisksIODataProvider)1 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)1 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)1 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)1