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