1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 É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
10 * Geneviève Bastien - Initial API and implementation
11 * Alexandre Montplaisir - Convert to org.eclipse.test.performance test
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.tests
.perf
.analysis
;
16 import static org
.junit
.Assert
.fail
;
20 import org
.eclipse
.jdt
.annotation
.NonNull
;
21 import org
.eclipse
.test
.performance
.Dimension
;
22 import org
.eclipse
.test
.performance
.Performance
;
23 import org
.eclipse
.test
.performance
.PerformanceMeter
;
24 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernelanalysis
.KernelAnalysisModule
;
25 import org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.trace
.LttngKernelTrace
;
26 import org
.eclipse
.tracecompass
.testtraces
.ctf
.CtfTestTrace
;
27 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.IAnalysisModule
;
28 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfAnalysisException
;
29 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfTraceException
;
30 import org
.eclipse
.tracecompass
.tmf
.core
.tests
.shared
.TmfTestHelper
;
31 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
32 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.event
.CtfTmfEvent
;
33 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.shared
.CtfTmfTestTraceUtils
;
34 import org
.junit
.Test
;
37 * This is a test of the time to build a kernel state system
39 * @author Genevieve Bastien
41 public class AnalysisBenchmark
{
43 private static final String TEST_ID
= "org.eclipse.linuxtools#LTTng kernel analysis";
44 private static final int LOOP_COUNT
= 25;
47 * Run the benchmark with "trace2"
50 public void testTrace2() {
51 runTest(CtfTestTrace
.TRACE2
, "Trace2");
54 private static void runTest(@NonNull CtfTestTrace testTrace
, String testName
) {
55 Performance perf
= Performance
.getDefault();
56 PerformanceMeter pm
= perf
.createPerformanceMeter(TEST_ID
+ '#' + testName
);
57 perf
.tagAsSummary(pm
, "LTTng Kernel Analysis: " + testName
, Dimension
.CPU_TIME
);
59 if (testTrace
== CtfTestTrace
.TRACE2
) {
60 /* Do not show all traces in the global summary */
61 perf
.tagAsGlobalSummary(pm
, "LTTng Kernel Analysis: " + testName
, Dimension
.CPU_TIME
);
64 for (int i
= 0; i
< LOOP_COUNT
; i
++) {
65 LttngKernelTrace trace
= null;
66 IAnalysisModule module
= null;
67 // TODO Allow the utility method to instantiate trace sub-types
69 String path
= CtfTmfTestTraceUtils
.getTrace(testTrace
).getPath();
72 trace
= new LttngKernelTrace();
73 module
= new KernelAnalysisModule();
75 trace
.initTrace(null, path
, CtfTmfEvent
.class);
76 module
.setTrace(trace
);
79 TmfTestHelper
.executeAnalysis(module
);
83 * Delete the supplementary files, so that the next iteration
84 * rebuilds the state system.
86 File suppDir
= new File(TmfTraceManager
.getSupplementaryFileDir(trace
));
87 for (File file
: suppDir
.listFiles()) {
91 } catch (TmfAnalysisException
| TmfTraceException e
) {
103 CtfTmfTestTraceUtils
.dispose(testTrace
);
This page took 0.058501 seconds and 5 git commands to generate.