2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
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 package org
.lttng
.scope
.lttng
.kernel
.core
.views
.timegraph
.resources
;
12 import java
.util
.Comparator
;
13 import java
.util
.function
.Function
;
14 import java
.util
.function
.Supplier
;
16 import org
.lttng
.scope
.lttng
.kernel
.core
.analysis
.os
.KernelAnalysisModule
;
17 import org
.lttng
.scope
.lttng
.kernel
.core
.views
.timegraph
.resources
.elements
.ResourcesIrqTreeElement
;
18 import org
.lttng
.scope
.lttng
.kernel
.core
.views
.timegraph
.resources
.elements
.ResourcesIrqTreeElement
.IrqType
;
19 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.provider
.states
.ITimeGraphModelStateProvider
;
20 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.provider
.statesystem
.StateSystemModelProvider
;
21 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.tree
.TimeGraphTreeRender
;
24 * Base class for Resources (for now, CPUs and IRQs) model providers.
26 * Implementations of this class can define the hierarchy the resources are to
27 * be presented in, for example CPUs/IRQs or IRQs/CPUs.
29 * @author Alexandre Montplaisir
31 public abstract class ResourcesBaseModelProvider
extends StateSystemModelProvider
{
33 private static final Supplier
<ITimeGraphModelStateProvider
> STATE_PROVIDER
= () -> {
34 return new ResourcesModelStateProvider();
38 * Comparator to sort IRQ entries in the tree model.
40 * Shows (hardware) IRQs first, followed by Soft IRQs. Within each section they
41 * are sorted by numerical (not String!) value of their IRQ number.
43 protected static final Comparator
<ResourcesIrqTreeElement
> IRQ_SORTER
= Comparator
44 .<ResourcesIrqTreeElement
, IrqType
> comparing(treeElem
-> treeElem
.getIrqType())
45 .thenComparingInt(treeElem
-> treeElem
.getIrqNumber());
51 * Name of this provider
52 * @param treeRenderFunction
53 * Function to generate a tree render from a given tree context
55 public ResourcesBaseModelProvider(String providerName
, Function
<TreeRenderContext
, TimeGraphTreeRender
> treeRenderFunction
) {
61 /* Parameters specific to state system render providers */
62 KernelAnalysisModule
.ID
,