Skip to content

Commit

Permalink
Add selected tracepoints for JCL
Browse files Browse the repository at this point in the history
  • Loading branch information
pshipton committed Jan 30, 2025
1 parent 28c9282 commit 112970b
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 0 deletions.
48 changes: 48 additions & 0 deletions runtime/include/j9access.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright IBM Corp. and others 2025
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/

#if !defined(J9ACCESS_H)
#define J9ACCESS_H

/* The following definitions are required by j9.h and are provided via OpenJ9
* jni.h or the OpenJ9 build system, but needed when building outside of OpenJ9
* with j9.h and OpenJDK jni.h is used.
*/
struct GCStatus;
typedef struct GCStatus GCStatus;
struct JavaVMQuery;
typedef struct JavaVMQuery JavaVMQuery;
struct JVMExtensionInterface_;
typedef const struct JVMExtensionInterface_ *JVMExt;

#if defined(AIX)
#define AIXPPC
#define RS6000
#elif defined(MACOSX) /* defined(AIX) */
#define OSX
#elif defined(WIN32) /* defined(MACOSX) */
#define OMR_OS_WINDOWS
#endif /* defined(WIN32) */

#include "j9.h"

#endif /* !defined(J9ACCESS_H) */
3 changes: 3 additions & 0 deletions runtime/jcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
set(J9VM_JCL_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}")

add_tracegen(j9jcl.tdf)
add_tracegen(jcl_java.tdf)
add_tracegen(jcl_net.tdf)
add_tracegen(jcl_nio.tdf)

j9vm_add_library(jclse SHARED
OUTPUT_NAME jclse${J9VM_VERSION_SUFFIX}
Expand Down
28 changes: 28 additions & 0 deletions runtime/jcl/jcl_java.tdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright IBM Corp. and others 2025
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which accompanies this
// distribution and is available at https://www.eclipse.org/legal/epl-2.0/
// or the Apache License, Version 2.0 which accompanies this distribution and
// is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
// General Public License, version 2 with the GNU Classpath
// Exception [1] and GNU General Public License, version 2 with the
// OpenJDK Assembly Exception [2].
//
// [1] https://www.gnu.org/software/classpath/license.html
// [2] https://openjdk.org/legal/assembly-exception.html
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0

Executable=jcl_java
DATFileName=J9TraceFormat.dat

TraceEvent=Trc_io_fileDescriptorClose Noenv Overhead=1 Level=3 Template="io_fileDescriptorClose(handle=%lld)"
TraceEvent=Trc_io_fileDescriptorClose_err Noenv Overhead=1 Level=3 Template="io_fileDescriptorClose_err(handle=%lld, error=%d)"
TraceEvent=Trc_io_handleOpen Noenv Overhead=1 Level=3 Test Template="io_handleOpen(filename=%s, access=0x%x, sharing=0x%x, creation=0x%x, attributes=0x%x, handle=%lld)"
TraceEvent=Trc_io_handleOpen_err Noenv Overhead=1 Level=3 Test Template="io_handleOpen_err(filename=%s, access=0x%x, sharing=0x%x, creation=0x%x, attributes=0x%x, error=%d)"
TraceEvent=Trc_io_UnixFileSystem_createFileExclusively_close Noenv Overhead=1 Level=3 Template="io_createFileExclusively_close(handle=%d)"
29 changes: 29 additions & 0 deletions runtime/jcl/jcl_net.tdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright IBM Corp. and others 2025
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which accompanies this
// distribution and is available at https://www.eclipse.org/legal/epl-2.0/
// or the Apache License, Version 2.0 which accompanies this distribution and
// is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
// General Public License, version 2 with the GNU Classpath
// Exception [1] and GNU General Public License, version 2 with the
// OpenJDK Assembly Exception [2].
//
// [1] https://www.gnu.org/software/classpath/license.html
// [2] https://openjdk.org/legal/assembly-exception.html
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0

Executable=jcl_net
DATFileName=J9TraceFormat.dat

TraceEvent=Trc_NET_Connect4 Noenv Overhead=1 Level=3 Template="NET_Connect(descriptor=%d, connect_to(AF_INET: addr=%s port=%d), length=%d)"
TraceEvent=Trc_NET_Connect6 Noenv Overhead=1 Level=3 Template="NET_Connect(descriptor=%d, connect_to(AF_INET6: addr=%s port=%d scope_id=%d), length=%d)"
TraceEvent=Trc_NET_SocketClose Noenv Overhead=1 Level=3 Template="NET_SocketClose(descriptor=%d)"
TraceEvent=Trc_PlainSocketImpl_socketConnect4 Noenv Overhead=1 Level=3 Template="PlainSocketImpl_socketConnect(%sdescriptor=%d, connect_to(AF_INET: addr=%s port=%d), length=%d)"
TraceEvent=Trc_PlainSocketImpl_socketConnect6 Noenv Overhead=1 Level=3 Template="PlainSocketImpl_socketConnect(%sdescriptor=%d, connect_to(AF_INET6: addr=%s port=%d scope_id=%d), length=%d)"
TraceEvent=Trc_PlainSocketImpl_socketClose Noenv Overhead=1 Level=3 Template="PlainSocketImpl_socketClose(%sdescriptor=%d)"
29 changes: 29 additions & 0 deletions runtime/jcl/jcl_nio.tdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright IBM Corp. and others 2025
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which accompanies this
// distribution and is available at https://www.eclipse.org/legal/epl-2.0/
// or the Apache License, Version 2.0 which accompanies this distribution and
// is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
// General Public License, version 2 with the GNU Classpath
// Exception [1] and GNU General Public License, version 2 with the
// OpenJDK Assembly Exception [2].
//
// [1] https://www.gnu.org/software/classpath/license.html
// [2] https://openjdk.org/legal/assembly-exception.html
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0

Executable=jcl_nio
DATFileName=J9TraceFormat.dat

TraceEvent=Trc_nio_ch_Net_connect4 Noenv Overhead=1 Level=3 Template="nio_ch_Net_Connect(descriptor=%lld, connect_to(AF_INET: addr=%s port=%d), length=%d)"
TraceEvent=Trc_nio_ch_Net_connect6 Noenv Overhead=1 Level=3 Template="nio_ch_Net_Connect(descriptor=%lld, connect_to(AF_INET6: addr=%s port=%d scope_id=%d), length=%d)"
TraceEvent=Trc_nio_ch_UnixDomainSockets_connect Noenv Overhead=1 Level=3 Template="nio_ch_UnixDomainSockets_Connect(descriptor=%d, connect_to(AF_UNIX: pname=%s), length=%d)"
TraceEvent=Trc_nio_ch_UnixDispatcher_close Noenv Overhead=1 Level=3 Template="nio_ch_UnixDispatcher_close(descriptor=%d)"
TraceEvent=Trc_nio_ch_SocketDispatcher_close Noenv Overhead=1 Level=3 Template="nio_ch_SocketDispatcher_close(descriptor=%d)"
TraceEvent=Trc_nio_ch_FileDispatcherImpl_close Noenv Overhead=1 Level=3 Template="nio_ch_FileDispatcherImpl_close(descriptor=%d)"

0 comments on commit 112970b

Please sign in to comment.