os.linux: Do not define the default kernel layout in the interface
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / analysis / os / linux / core / kernelmemoryusage / KernelMemoryAnalysisModule.java
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 package org.eclipse.tracecompass.analysis.os.linux.core.kernelmemoryusage;
10
11 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
12
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.tracecompass.analysis.os.linux.core.trace.DefaultEventLayout;
15 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
16 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
17 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
18 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
19 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
20
21 /**
22 * This analysis module creates a stateprovider that keeps track of the memory
23 * allocated and deallocated by the kernel
24 *
25 * @author Samuel Gagnon
26 * @since 2.0
27 */
28 public class KernelMemoryAnalysisModule extends TmfStateSystemAnalysisModule {
29
30 /**
31 * Analysis ID, it should match that in the plugin.xml file
32 */
33 public static final @NonNull String ID = "org.eclipse.tracecompass.analysis.os.linux.core.kernelmemory"; //$NON-NLS-1$
34
35 /**
36 * Each thread attribute in the tree has an attribute for keeping the lowest memory
37 * value for that thread during the trace. (Those values can be negative because we
38 * don't have access to a memory dump before the trace)
39 */
40 public static final @NonNull String THREAD_LOWEST_MEMORY_VALUE = "lowestMemory"; //$NON-NLS-1$
41
42 @Override
43 protected @NonNull ITmfStateProvider createStateProvider() {
44 ITmfTrace trace = checkNotNull(getTrace());
45 IKernelAnalysisEventLayout layout;
46
47 if (trace instanceof IKernelTrace) {
48 layout = ((IKernelTrace) trace).getKernelEventLayout();
49 } else {
50 /* Fall-back to the base LttngEventLayout */
51 layout = DefaultEventLayout.getInstance();
52 }
53 return new KernelMemoryStateProvider(trace, layout);
54 }
55 }
This page took 0.031591 seconds and 5 git commands to generate.