mirror of https://github.com/alibaba/arthas.git
rename JvmUtils to Vmtool. #1781
parent
52bb8afbee
commit
4f91d181e2
@ -1,28 +1,41 @@
|
||||
package com.vdian.vclub;
|
||||
|
||||
import com.taobao.arthas.common.AnsiLog;
|
||||
import org.scijava.nativelib.NativeLoader;
|
||||
package arthas;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author ZhangZiCheng 2021-02-12
|
||||
* @author hengyunabc 2021-04-26
|
||||
* @since 3.5.1
|
||||
*/
|
||||
public class JvmUtils {
|
||||
public class Vmtool {
|
||||
|
||||
/**
|
||||
* 不要修改jni-lib的名称
|
||||
*/
|
||||
private final static String JNI_LIBRARY_NAME = "ArthasJniLibrary";
|
||||
|
||||
static {
|
||||
try {
|
||||
NativeLoader.loadLibrary(JNI_LIBRARY_NAME);
|
||||
AnsiLog.warn("checkResult->" + check() + ", jni-lib available !");
|
||||
} catch (Throwable t) {
|
||||
AnsiLog.error("load jni-lib failed:" + t.getMessage(), t);
|
||||
public final static String JNI_LIBRARY_NAME = "ArthasJniLibrary";
|
||||
|
||||
private static Vmtool instance;
|
||||
|
||||
private Vmtool() {
|
||||
}
|
||||
|
||||
public static Vmtool getInstance() {
|
||||
return getInstance(null);
|
||||
}
|
||||
|
||||
public static synchronized Vmtool getInstance(String libPath) {
|
||||
if (instance != null) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
if (libPath == null) {
|
||||
System.loadLibrary(JNI_LIBRARY_NAME);
|
||||
} else {
|
||||
System.load(libPath);
|
||||
}
|
||||
|
||||
instance = new Vmtool();
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
@ -0,0 +1,61 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class arthas_Vmtool */
|
||||
|
||||
#ifndef _Included_arthas_Vmtool
|
||||
#define _Included_arthas_Vmtool
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: check
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_arthas_Vmtool_check
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: getInstances
|
||||
* Signature: (Ljava/lang/Class;)Ljava/util/ArrayList;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_arthas_Vmtool_getInstances
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: sumInstanceSize
|
||||
* Signature: (Ljava/lang/Class;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_arthas_Vmtool_sumInstanceSize
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: getInstanceSize
|
||||
* Signature: (Ljava/lang/Object;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_arthas_Vmtool_getInstanceSize
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: countInstances
|
||||
* Signature: (Ljava/lang/Class;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_arthas_Vmtool_countInstances
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: arthas_Vmtool
|
||||
* Method: getAllLoadedClasses
|
||||
* Signature: ()Ljava/util/ArrayList;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_arthas_Vmtool_getAllLoadedClasses
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,61 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_vdian_vclub_JvmUtils */
|
||||
|
||||
#ifndef _Included_com_vdian_vclub_JvmUtils
|
||||
#define _Included_com_vdian_vclub_JvmUtils
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: check
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_vdian_vclub_JvmUtils_check
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: getInstances
|
||||
* Signature: (Ljava/lang/Class;)Ljava/util/ArrayList;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_vdian_vclub_JvmUtils_getInstances
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: sumInstanceSize
|
||||
* Signature: (Ljava/lang/Class;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_vdian_vclub_JvmUtils_sumInstanceSize
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: getInstanceSize
|
||||
* Signature: (Ljava/lang/Object;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_vdian_vclub_JvmUtils_getInstanceSize
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: countInstances
|
||||
* Signature: (Ljava/lang/Class;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_vdian_vclub_JvmUtils_countInstances
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_vdian_vclub_JvmUtils
|
||||
* Method: getAllLoadedClasses
|
||||
* Signature: ()Ljava/util/ArrayList;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_vdian_vclub_JvmUtils_getAllLoadedClasses
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue