Skip to content

Commit

Permalink
8054: Support the new JPLIS agent events
Browse files Browse the repository at this point in the history
Reviewed-by: aptmac
  • Loading branch information
thegreystone committed Jan 19, 2024
1 parent dba8509 commit 793e826
Show file tree
Hide file tree
Showing 30 changed files with 2,575 additions and 1,170 deletions.
18 changes: 17 additions & 1 deletion application/org.openjdk.jmc.flightrecorder.ui/defaultPages.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -977,6 +977,22 @@
<filter showFilter="false" showSearch="true" />
</state>
</page>
<page factory="org.openjdk.jmc.flightrecorder.ui.agents"
id="org.openjdk.jmc.flightrecorder.ui.agents">
<state>
<table sortColumn="initializationTime:timestamp">
<column id="initializationTime:timestamp" width="150" sortAscending="true"/>
<column id="startTime:timestamp" hidden="true" width="150" />
<column id="(endTime):timestamp" hidden="true" width="150" />
<column id="(eventType):type" width="100" />
<column id="name:text" width="410"/>
<column id="options:text" width="160"/>
<column id="dynamic:boolean" width="100"/>
<column id="initializationDuration:timespan" width="130"/>
</table>
<filter showFilter="false" showSearch="true" />
</state>
</page>
<page factory="org.openjdk.jmc.flightrecorder.ui.recording" id="org.openjdk.jmc.flightrecorder.ui.recording">
<state>
<sash weights="27,20,70" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion application/org.openjdk.jmc.flightrecorder.ui/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -310,6 +310,10 @@
class="org.openjdk.jmc.flightrecorder.ui.pages.RecordingPage$RecordingPageFactory"
id="org.openjdk.jmc.flightrecorder.ui.recording">
</factory>
<factory
class="org.openjdk.jmc.flightrecorder.ui.pages.AgentsPage$AgentsPageFactory"
id="org.openjdk.jmc.flightrecorder.ui.agents">
</factory>
<factory
class="org.openjdk.jmc.flightrecorder.ui.pages.ConstantPoolsPage$ConstantPoolsPageFactory"
id="org.openjdk.jmc.flightrecorder.ui.constantpools">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -812,6 +812,8 @@ private static ImageDescriptor getResultIcon(Severity severity) {
return ResultOverview.ICON_INFO;
case WARNING:
return ResultOverview.ICON_WARNING;
case IGNORE:
return ResultOverview.ICON_IGNORE;
case NA:
return ResultOverview.ICON_NA;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -137,4 +137,5 @@ public class ImageConstants {
public static final String PAGE_SYSTEM_PROPERTIES = "pages/systemproperties.png"; //$NON-NLS-1$
public static final String PAGE_RECORDING = "pages/recording.png"; //$NON-NLS-1$
public static final String PAGE_NATIVE_LIBRARY = "pages/nativelibraries.png"; //$NON-NLS-1$ //FIXME!
public static final String PAGE_AGENT = "pages/agent.png"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -36,6 +36,7 @@

public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.openjdk.jmc.flightrecorder.ui.messages.internal.messages"; //$NON-NLS-1$
public static String AgentsPage_PAGE_NAME;
public static String ATTRIBUTE_CONFIG_PAGE_RULES;
public static String ATTRIBUTE_CONFIG_RULE;
public static String ATTRIBUTE_CONFIG_RULES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Datadog, Inc. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
*
* or the following license:
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openjdk.jmc.flightrecorder.ui.pages;

import org.eclipse.jface.resource.ImageDescriptor;
import org.openjdk.jmc.common.IState;
import org.openjdk.jmc.common.item.IItemFilter;
import org.openjdk.jmc.flightrecorder.jdk.JdkFilters;
import org.openjdk.jmc.flightrecorder.jdk.JdkQueries;
import org.openjdk.jmc.flightrecorder.rules.util.JfrRuleTopics;
import org.openjdk.jmc.flightrecorder.ui.FlightRecorderUI;
import org.openjdk.jmc.flightrecorder.ui.IDataPageFactory;
import org.openjdk.jmc.flightrecorder.ui.IDisplayablePage;
import org.openjdk.jmc.flightrecorder.ui.IPageContainer;
import org.openjdk.jmc.flightrecorder.ui.IPageDefinition;
import org.openjdk.jmc.flightrecorder.ui.StreamModel;
import org.openjdk.jmc.flightrecorder.ui.common.ImageConstants;
import org.openjdk.jmc.flightrecorder.ui.messages.internal.Messages;

public class AgentsPage extends DistinctItemsPage {
public static class AgentsPageFactory implements IDataPageFactory {

@Override
public String getName(IState state) {
return Messages.AgentsPage_PAGE_NAME;
}

@Override
public ImageDescriptor getImageDescriptor(IState state) {
return FlightRecorderUI.getDefault().getMCImageDescriptor(ImageConstants.PAGE_AGENT);
}

@Override
public String[] getTopics(IState state) {
return new String[] {JfrRuleTopics.AGENT_INFORMATION};
}

@Override
public IDisplayablePage createPage(IPageDefinition dpd, StreamModel items, IPageContainer editor) {
return new AgentsPage(dpd, items, editor);
}
}

public AgentsPage(IPageDefinition dpd, StreamModel items, IPageContainer editor) {
super(dpd, items, editor);
setTableDefinition(JdkQueries.AGENTS);
}

@Override
public IItemFilter getDefaultSelectionFilter() {
return JdkFilters.AGENTS;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
Expand Down Expand Up @@ -30,6 +30,7 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
AgentsPage_PAGE_NAME=Agents
# {0} is a page name
ATTRIBUTE_CONFIG_PAGE_RULES=Configuration attributes for the rules associated with the {0} page.
# {0} is a rule name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -32,7 +32,10 @@
*/
package org.openjdk.jmc.common.unit;

import static org.openjdk.jmc.common.unit.UnitLookup.NUMBER_UNITY;

public class QuantitiesToolkit {
private final static ITypedQuantity<LinearUnit> ZERO = NUMBER_UNITY.quantity(0);

public static <M extends Comparable<? super M>> M min(M a, M b) {
return a.compareTo(b) < 0 ? a : b;
Expand All @@ -53,4 +56,12 @@ public static <M extends Comparable<? super M>> M maxPresent(M a, M b) {
public static <M extends Comparable<? super M>> boolean same(M a, M b) {
return (a == null) ? (b == null) : ((b == null) ? false : (a.compareTo(b) == 0));
}

public static IQuantity nullSafe(IQuantity quantity) {
if (quantity != null) {
return quantity;
} else {
return ZERO;
}
}
}
Loading

0 comments on commit 793e826

Please sign in to comment.