精华内容
下载资源
问答
  • JVM OQL查询语言

    2018-11-11 17:08:00
    OQL查询语言 SELECT Clause The SELECT clause determines what to extract from the heap dump. To display objects and be able to browse the outgoing references, use the * symbol: SELECT * FROM java....

    OQL查询语言

    SELECT Clause

    The SELECT clause determines what to extract from the heap dump. To display objects and be able to browse the outgoing references, use the * symbol:

    SELECT * FROM java.lang.String

    Select specific columns

    Alternatively, one can select the fields to be displayed:

    SELECT toString(s), s.count, s.value FROM java.lang.String s

    The resulting table knows about the underlying object. So you can use the context menu to open further views on the object at hand. Use the @ symbol to access Java attributes and methods of the objects. There are also a number of built-in functions available to extract common information:

    SELECT toString(s), s.@usedHeapSize,

        s.@retainedHeapSize FROM java.lang.String s

    The section on Property Accessors contains details on the commonly available attributes.

    Provide column names

    Use the AS keyword to name the columns:

    SELECT toString(s) AS Value,

        s.@usedHeapSize AS "Shallow Size",

        s.@retainedHeapSize AS "Retained Size"

                              FROM java.lang.String s

    Use the AS RETAINED SET keyword to get the set of objects retained by your selection:

    SELECT AS RETAINED SET * FROM java.lang.String

    Flatten select items into an object list

    Use the OBJECTS to interpret the items in the SELECT clause as objects:

    SELECT OBJECTS dominators(s) FROM java.lang.String s

    The function dominators() returns an array of objects. Therefore the query returns a list of object lists, i.e. arrays. By using the keyword OBJECTS , we force the OQL to reduce this into a single list of objects.

    Select unique objects

    Use the DISTINCT keyword to only select unique objects:

    SELECT DISTINCT * FROM OBJECTS 0,1,1,2

    Use the DISTINCT OBJECTS keyword to only select unique objects from the result of the selected clause:

    SELECT DISTINCT OBJECTS classof(s) FROM java.lang.String s

    The function classof returns the class object. Of course, all Strings have the same class. The OBJECTS converts the underlying row with a String object and a displayed value of the class object to the object represented by the result of the classof function. Without the DISTINCT OBJECTS keywords, the query would result in a list with as many rows with the same class as there are Strings.

    Expressions (experimental, Memory Analyzer 1.4)

    Use the expressions for the select item, including string concatenation:

    SELECT s.@objectId, s.@objectId * 2, "The object ID is "+@objectId FROM OBJECTS 0,1,1,2 s

    With Memory Analyzer 1.4 expressions and sub-selects are allowed for select items. More complex expressions may need to be parenthesized. This is currently in the test phase.

    FROM Clause

    Specify the class

    The FROM clause defines the classes on which to operate. Specify the class by one of the following means:

    by class name:

    SELECT * FROM java.lang.String

    by a regular expression matching the class name:

    SELECT * FROM "java\.lang\..*"

    by the object address of the class:

    SELECT * FROM 0x2b7468c8

    by the object addresses of more than one class:

    SELECT * FROM 0x2b7468c8,0x2b74aee0

    by the object id of the class:

    SELECT * FROM 20815

    by the object ids of more than one class:

    SELECT * FROM 20815,20975

    by a sub select:

    SELECT * FROM ( SELECT *
                    FROM java.lang.Class c
                    WHERE c implements org.eclipse.mat.snapshot.model.IClass )

    The statement returns all objects in the heap. The implements check is necessary, as the heap dump can contain java.lang.Class instances caused by proxy classes or classes representing primitive types such as int.class or Integer.TYPE. The following query has the same effect, which calls a method directly on the ISnapshot object:

    SELECT * FROM ${snapshot}.getClasses()

    Include sub classes

    Use the INSTANCEOF keyword to include objects of sub-classes into the query:

    SELECT * FROM INSTANCEOF java.lang.ref.Reference

    The resulting table contains, amongst others, WeakReference and SoftReference objects because both classes extend from java.lang.ref.Reference . By the way, the same result has the following query

    SELECT * FROM ${snapshot}.getClassesByName("java.lang.ref.Reference", true)

    Prevent interpretation of the from term as classes

    Use the OBJECTS keyword if you do not want to process the term as classes. Specify the object or objects by one of the following means:

    by class name:

    SELECT * FROM OBJECTS java.lang.String

    The result is just one object, the java.lang.String class object.

    by the object address of the particular object:

    SELECT * FROM OBJECTS 0x2b7468c8

    by the object addresses of particular objects:

    SELECT * FROM OBJECTS 0x2b7468c8,0x2b746868

    by the object id of the particular object:

    SELECT * FROM OBJECTS 20815

    by the object ids of particular objects:

    SELECT * FROM OBJECTS 20815,20814

    by a sub expression (Memory Analyzer 1.4 only):

    SELECT * FROM OBJECTS (1 + ${snapshot}.GCRoots.length)

    Note: Please note, that currently the FROM OBJECTS term is in the test phase!

    Autocompletion

    The OQL pane now has autocompletion for class names, class name regular expressions, field names, attributes and methods. See OQL autocompletion.

    WHERE Clause

    >=, <=, >, <, [ NOT ] LIKE, [ NOT ] IN, IMPLEMENTS (relational operations)

    The WHERE clause specifies search conditions, that remove unwanted data from the query result. The following operators, are in order of precedence. The operators are evaluated in the specified order:

    SELECT * FROM java.lang.String s WHERE s.count >= 100
    SELECT * FROM java.lang.String s WHERE toString(s) LIKE ".*day"
    SELECT * FROM java.lang.String s WHERE s.value NOT IN dominators(s)
    SELECT * FROM java.lang.Class c WHERE c IMPLEMENTS org.eclipse.mat.snapshot.model.IClass

    =, != (equality operations)

    SELECT * FROM java.lang.String s WHERE toString(s) = "monday"

    AND (conditional AND operation)

    SELECT * FROM java.lang.String s WHERE s.count > 100 AND s.@retainedHeapSize > s.@usedHeapSize

    OR (conditional OR operation)

    SELECT * FROM java.lang.String s WHERE s.count > 1000 OR s.value.@length > 1000

    Operators can be applied to expressions, constant literals and sub queries. Valid expressions are explained in the next sections.

    Literal Expression

    Boolean, String, Integer, Long, Character and null literals:

    SELECT * FROM java.lang.String s
             WHERE ( s.count > 1000 ) = true
             WHERE toString(s) = "monday"
             WHERE dominators(s).size() = 0
             WHERE s.@retainedHeapSize > 1024L
             WHERE s.value != null AND s.value.@valueArray.@length >= 1 AND s.value.@valueArray.get(0) = 'j'
             WHERE s.@GCRootInfo != null

     

    Property Accessors

    Accessing fields of the heap object

    Properties of heap objects are accessed using a simple dot notation:

    [ <alias>. ] <field> . <field>. <field>

    An alias can be defined in the FROM Clause to identify the current object, i.e. row in the SQL analogy, on which the OQL statement operates. Without alias, the field is assumed to be one of the fields of the current object. Fields are attributes of the Java objects in the heap dump. Use OQL autocompletion or the Object Inspector to find out about the available fields of an object.

    Accessing Java Bean properties

    [ <alias>. ] @<attribute> ...

    Using the @ symbol, OQL accesses attributes of the underlying Java objects used by Memory Analyzer to represent objects in the heap dump. The attributes are resolved via Bean Introspection. Use OQL autocompletion to find the common beans names. The following table lists some commonly used Java attributes.

    Any heap object

    IObject

    objectId

    id of snapshot object

      

    objectAddress

    address of snapshot object

      

    class

    Java class of this object

      

    clazz

    IClass of this object. See also classof(object).

      

    usedHeapSize

    shallow heap size

      

    retainedHeapSize

    retained heap size

      

    displayName

    display name

    Class object

    IClass

    classLoaderId

    id of the class loader

    Any array

    IArray

    length

    length of the array

    Primitive array

    IPrimitiveArray

    valueArray

    the values in the array

    Reference array

    IObjectArray

    referenceArray

    the objects in the array (as long values, the addresses of the objects) Access a particular element using get() and convert to an object using OBJECTS.

    Calling Java methods

    [ <alias> . ] @<method>( [ <expression>, <expression> ] ) ...

    Adding ( ) forces OQL to interpret this as a Java method call. The call is executed via reflection. The following table lists some common Java methods on the underlying Java objects used by Memory Analyzer to represent objects in the heap dump.

    ${snapshot}

    ISnapshot

    getClasses()

    a collection of all classes

      
    getClassesByName(String name, boolean includeSubClasses)

    a collection of classes

    Class object

    IClass

    hasSuperClass()

    result is true if the class has a super class

      
    isArrayType()

    the result is true if the class is an array type

    Any heap object

    IObject

    getObjectAddress()

    The address of a snapshot object as a long integer

    Primitive array

    IPrimitiveArray

    getValueAt(int index)

    a value from the array

    Java primitive array, Java object array or Java list (returned from reflection)

    [] or List

    get(int index)

    a value from the array or list

    Array Access

    Memory Analyzer 1.3 or later allows direct array style access of primitive arrays and objects arrays from the snapshot, and Java arrays and Java Lists obtained from reflective method calls. The notation is[index]. The index is a zero-based integer. If the array is null or the index is out of range then the result is null.

    Memory Analyzer 1.4 allows array range access as well using the notation[index1:index2]where index1 and index2 are inclusive. If the values are negative then they are treated as indexing from the end of the array, so -1 means the last entry.

    Reading values from primitive arrays

    SELECT s[2] FROM int[] s WHERE (s.@length > 2)

    This method is for Memory Analyzer 1.3 or later.

    SELECT s.getValueAt(2) FROM int[] s WHERE (s.@length > 2)

    This method is for all versions of Memory Analyzer. This reads the value of the element at index 2 from all int[] arrays which have at least 3 elements.

    Reading objects from object arrays

    SELECT s[2] FROM java.lang.Object[] s WHERE (s.@length > 2)

    This method is for Memory Analyzer 1.3 or later.s[2]is an IObject so fields and Java bean properties can be accessed

    SELECT OBJECTS s[2] FROM java.lang.Object[] s

    This method is for Memory Analyzer 1.3 or later. The OBJECTS converts the object to give a tree view rather than table result. We do not need the WHERE clause as out of range accesses return null and the OBJECTS skips nulls.

    SELECT OBJECTS s.@referenceArray.get(2) FROM java.lang.Object[] s WHERE (s.@length > 2)

    This method is for Memory Analyzer 1.1 or later. This reads as a long address the element at index 2 from all Object[] arrays which have at least 3 elements and converts them into objects.

    SELECT OBJECTS s.getReferenceArray(2,1) FROM java.lang.Object[] s WHERE (s.@length > 2)

    This method is for Memory Analyzer 1.1 or later. This reads as an array of long[] 1 element starting at index 2 from all Object[] arrays which have at least 3 elements and converts the contents of those arrays into objects.

    Reading from Java arrays

    SELECT s.@GCRoots[2] FROM OBJECTS ${snapshot} s

    This method is for Memory Analyzer 1.3 or later.

    SELECT s.get(2) FROM OBJECTS ${snapshot} s  WHERE s.@GCRoots.@length > 2

    This method is for all versions of Memory Analyzer.

    Reading from Java Lists

    SELECT s.@GCRoots.subList(1,3)[1] FROM OBJECTS ${snapshot} s

    This method is for Memory Analyzer 1.3 or later.

    SELECT s.@GCRoots.subList(1,3).get(1) FROM OBJECTS ${snapshot} s

    This method is for all versions of Memory Analyzer.

    Built-in OQL functions

    <function>( <parameter> )

    Built-in functions.

    toHex( number )

    Print the number as hexadecimal

    toString( object )

    Returns the value of an object, e.g. the content of a String etc.

    dominators( object )

    The objects immediately dominated by the object

    outbounds( object )

    outbound referrer

    inbounds( object )

    inbound referrer

    classof( object )

    the class of the current object

    dominatorof( object )

    the immediate dominator, -1 if none

    eval( expression )

    (Experimental in Memory Analyzer 1.4) evaluates the argument and returns it. Could be useful to allow array/method access to the result of a sub-select or expression.

     

    BNF for the Object Query Language

    SelectStatement

    ::=

    "SELECT" SelectList FromClause ( WhereClause )? ( UnionClause )?

    SelectList

    ::=

    (( "DISTINCT" | "AS RETAINED SET" )? ( "*" | "OBJECTS" SelectItem | SelectItem ( "," SelectItem )* ))

    SelectItem

    ::=

    ( PathExpression | EnvVarPathExpression ) ( "AS" ( <STRING_LITERAL> | <IDENTIFIER> ) )?

    PathExpression

    ::=

    ( ObjectFacet | BuiltInFunction ) ( "." ObjectFacet | "[" SimpleExpression ( ":" SimpleExpression)? "]" )*

    EnvVarPathExpression

    ::=

    ( "$" "{" <IDENTIFIER> "}" ) ( "." ObjectFacet | "[" SimpleExpression ( ":" SimpleExpression)? "]" )*

    ObjectFacet

    ::=

    ( ( "@" )? <IDENTIFIER> ( ParameterList )? )

    ParameterList

    ::=

    "(" ( ( SimpleExpression ( "," SimpleExpression )* ) )? ")"

    FromClause

    ::=

    "FROM" ( "OBJECTS" )? ( "INSTANCEOF" )? ( FromItem | "(" SelectStatement ")" ) ( <IDENTIFIER> )?

    FromItem

    ::=

    ( ClassName | <STRING_LITERAL> | ObjectAddress ( "," ObjectAddress )* | ObjectId ( "," ObjectId )* | EnvVarPathExpression )

    ClassName

    ::=

    ( <IDENTIFIER> ( "." <IDENTIFIER> )* ( "[]" )* )

    ObjectAddress

    ::=

    <HEX_LITERAL>

    ObjectId

    ::=

    <INTEGER_LITERAL>

    WhereClause

    ::=

    "WHERE" ConditionalOrExpression

    ConditionalOrExpression

    ::=

    ConditionalAndExpression ( "or" ConditionalAndExpression )*

    ConditionalAndExpression

    ::=

    EqualityExpression ( "and" EqualityExpression )*

    EqualityExpression

    ::=

    RelationalExpression ( ( "=" RelationalExpression | "!=" RelationalExpression ) )*

    RelationalExpression

    ::=

    ( SimpleExpression ( ( "<" SimpleExpression | ">" SimpleExpression | "<=" SimpleExpression | ">=" SimpleExpression | ( LikeClause | InClause ) | "implements" ClassName ) )? )

    LikeClause

    ::=

    ( "NOT" )? "LIKE" <STRING_LITERAL>

    InClause

    ::=

    ( "NOT" )? "IN" SimpleExpression

    SimpleExpression

    ::=

    MultiplicativeExpression ( "+" MultiplicativeExpression | "-" MultiplicativeExpression )*

    MultiplicativeExpression

    ::=

    PrimaryExpression ( "*" PrimaryExpression | "/" PrimaryExpression )*

    PrimaryExpression

    ::=

    Literal

     

    |

    "(" ( ConditionalOrExpression | SubQuery ) ")

     

    |

    PathExpression

     

    |

    EnvVarPathExpression

    SubQuery

    ::=

    SelectStatement

    Function

    ::=

    ( ( "toHex" | "toString" | "dominators" | "outbounds" | "inbounds" | "classof" | "dominatorof" ) "(" ConditionalOrExpression ")" )

    Literal

    ::=

    ( <INTEGER_LITERAL> | <LONG_LITERAL> | <FLOATING_POINT_LITERAL> | <CHARACTER_LITERAL> | <STRING_LITERAL> | BooleanLiteral | NullLiteral )

    BooleanLiteral

    ::=

    "true"

     

    |

    "false"

    NullLiteral

    ::=

    <NULL>

    UnionClause

    ::=

    ( "UNION" "(" SelectStatement ")" )+

    转载于:https://www.cnblogs.com/GarfieldEr007/p/9942624.html

    展开全文
  • jhat中的OQL(对象查询语言)   如果需要根据某些条件来过滤或查询堆的对象,这是可能的,可以在jhat的html页面中执行OQL,来查询符合条件的对象 基本语法:   select < JavaScript  expression to select> [from...

     

    jmap -dump:format=b,file=./abc.dump

    之后,会产生 abc.dump 文件,然后如果服务及其性能相当不错的话,可以再服务器上直接运行命令:

    jhat -J-Xmx2000M abc.dump 

    运行之后,会打开默认的7000 端口对外提供http的服务,用浏览器即可进行查看。

     

    From:http://blog.csdn.net/wanglha/article/details/40181767

    jhat中的OQL(对象查询语言) 
    如果需要根据某些条件来过滤或查询堆的对象,这是可能的,可以在jhat的html页面中执行OQL,来查询符合条件的对象

    基本语法: 
    select <JavaScript expression to select>
    [from [instanceof] <class name> <identifier>]
    [where <javascript boolean expression to filter>]

    解释: 
    (1)class name是Java类的完全限定名,如:java.lang.String, java.util.ArrayList, [C是char数组, [Ljava.io.File是java.io.File[]
    (2)类的完全限定名不足以唯一的辨识一个类,因为不同的ClassLoader载入的相同的类,它们在jvm中是不同类型的
    (3)instanceof表示也查询某一个类的子类,如果不明确instanceof,则只精确查询class name指定的类
    (4)from和where子句都是可选的
    (5)java域表示:obj.field_name;java数组表示:array[index]

    举例: 
    (1)查询长度大于100的字符串
    select s from java.lang.String s where s.count > 100

    (2)查询长度大于256的数组
    select a from [I a where a.length > 256
    (3)显示匹配某一正则表达式的字符串
    select a.value.toString() from java.lang.String s where /java/(s.value.toString())
    (4)显示所有文件对象的文件路径
    select file.path.value.toString() from java.io.File file
    (5)显示所有ClassLoader的类名
    select classof(cl).name from instanceof java.lang.ClassLoader cl
    (6)通过引用查询对象
    select o from instanceof 0xd404d404 o

    built-in对象 -- heap 
    (1)heap.findClass(class name) -- 找到类
    select heap.findClass("java.lang.String").superclass
    (2)heap.findObject(object id) -- 找到对象
    select heap.findObject("0xd404d404")
    (3)heap.classes -- 所有类的枚举
    select heap.classes
    (4)heap.objects -- 所有对象的枚举
    select heap.objects("java.lang.String")
    (5)heap.finalizables -- 等待垃圾收集的java对象的枚举
    (6)heap.livepaths -- 某一对象存活路径
    select heaplivepaths(s) from java.lang.String s
    (7)heap.roots -- 堆根集的枚举

    辨识对象的函数 
    (1)classof(class name) -- 返回java对象的类对象
    select classof(cl).name from instanceof java.lang.ClassLoader cl
    (2)identical(object1,object2) -- 返回是否两个对象是同一个实例
    select identical(heap.findClass("java.lang.String").name, heap.findClass("java.lang.String").name)
    (3)objectid(object) -- 返回对象的id
    select objectid(s) from java.lang.String s
    (4)reachables -- 返回可从对象可到达的对象
    select reachables(p) from java.util.Properties p -- 查询从Properties对象可到达的对象
    select reachables(u, "java.NET.URL.handler") from java.Net.URL u -- 查询从URL对象可到达的对象,但不包括从URL.handler可到达的对象
    (5)referrers(object) -- 返回引用某一对象的对象
    select referrers(s) from java.lang.String s where s.count > 100
    (6)referees(object) -- 返回某一对象引用的对象
    select referees(s) from java.lang.String s where s.count > 100
    (7)refers(object1,object2) -- 返回是否第一个对象引用第二个对象
    select refers(heap.findObject("0xd4d4d4d4"),heap.findObject("0xe4e4e4e4"))
    (8)root(object) -- 返回是否对象是根集的成员
    select root(heap.findObject("0xd4d4d4d4")) 
    (9)sizeof(object) -- 返回对象的大小
    select sizeof(o) from [I o
    (10)toHtml(object) -- 返回对象的html格式
    select "<b>" + toHtml(o) + "</b>" from java.lang.Object o
    (11)选择多值
    select {name:t.name?t.name.toString():"null",thread:t} from instanceof java.lang.Thread t

    数组、迭代器等函数 
    (1)concat(enumeration1,enumeration2) -- 将数组或枚举进行连接
    select concat(referrers(p),referrers(p)) from java.util.Properties p
    (2)contains(array, expression) -- 数组中元素是否满足某表达式
    select p from java.util.Properties where contains(referres(p), "classof(it).name == 'java.lang.Class'")
    返回由java.lang.Class引用的java.util.Properties对象
    built-in变量
    it -- 当前的迭代元素
    index -- 当前迭代元素的索引
    array -- 被迭代的数组
    (3)count(array, expression) -- 满足某一条件的元素的数量
    select count(heap.classes(), "/java.io./(it.name)")
    (4)filter(array, expression) -- 过滤出满足某一条件的元素
    select filter(heap.classes(), "/java.io./(it.name)")
    (5)length(array) -- 返回数组长度
    select length(heap.classes())
    (6)map(array,expression) -- 根据表达式对数组中的元素进行转换映射
    select map(heap.classes(),"index + '-->' + toHtml(it)")
    (7)max(array,expression) -- 最大值, min(array,expression)
    select max(heap.objects("java.lang.String"),"lhs.count>rhs.count")
    built-in变量
    lhs -- 左边元素
    rhs -- 右边元素
    (8)sort(array,expression) -- 排序
    select sort(heap.objects('[C'),'sizeof(lhs)-sizeof(rhs)')
    (9)sum(array,expression) -- 求和
    select sum(heap.objects('[C'),'sizeof(it)')
    (10)toArray(array) -- 返回数组
    (11)unique(array) -- 唯一化数组

    展开全文
  • Lab5 在MAT内使用OQL查询内存导出

    千次阅读 2019-05-29 17:46:59
    CircularOrbit 的所有对象实例; 大于长度100的String对象: 大于特定大小的任意类型对象实例 PhysicalObject(及其子类)的对象实例的数量和总占用内存大小 所有包含元素数量大于 100 的 ...

    CircularOrbit 的所有对象实例;

     

    大于长度100的String对象:

    大于特定大小的任意类型对象实例

     

    PhysicalObject(及其子类)的对象实例的数量和总占用内存大小

     

     

     

    所有包含元素数量大于 100 的 Collections 实例

     

    更多参考:http://cr.openjdk.java.net/~sundar/8022483/webrev.01/raw_files/new/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html

     

    展开全文
  • OQL.NET 是一套强类型的数据库对象查询语言 (OQL,Object Query Language),和 SQL 以及其它 OQL 不同的是,OQL.NET 基于宿主语言 (基于 C# 和 VB 等原生 .NET 语言而不是字符串)。OQL.NET 兼容 SQL-92 标准。  ...
  • MAT支持一种类似于SQL的查询语言OQL(Object Query Language)。OQL使用类SQL语法,可以在堆中进行对象的查找和筛选。 1. SELECT子句 在MAT中,Select子句的格式与SQL基本一致,用于指定要显示的列。Select子句中...

    MAT支持一种类似于SQL的查询语言OQL(Object Query Language)。OQL使用类SQL语法,可以在堆中进行对象的查找和筛选。

    1. SELECT子句

    在MAT中,Select子句的格式与SQL基本一致,用于指定要显示的列。Select子句中可以使用“*”,查看结果对象的引用实例(相当于outgoing references)。

    SELECT * FROM java.util.Vector v

    SELECT objects v.elementData FROM java.util.Vector v
    
    SELECT OBJECTS s.value FROM java.lang.String s

     如下图:

    在Select子句中,使用“AS RETAINED SET”关键字可以得到所得对象的保留集。

    SELECT AS RETAINED SET *FROM com.wsh.WebPage

     “DISTINCT”关键字用于在结果集中去除重复对象。

    SELECT DISTINCT OBJECTS classof(s) FROM java.lang.String s

     2. FROM子句

    From子句用于指定查询范围,它可以指定类名、正则表达式或者对象地址。

    SELECT * FROM java.lang.String s

    使用正则表达式,限定搜索范围,输出所有com.wsh包下所有类的实例

    SELECT * FROM "com\.wsh\..*"

    使用类的地址进行搜索。使用类的地址的好处是可以区分被不同ClassLoader加载的同一种类型。 

    select * from 0x37a0b4d

    3. WHERE子句

    Where子句用于指定OQL的查询条件。OQL查询将只返回满足Where子句指定条件的对象。Where子句的格式与传统SQL极为相似。

    返回长度大于10的char数组:

    SELECT *FROM Ichar[] s WHERE s.@length>10

    返回包含“java”子字符串的所有字符串,使用“LIKE”操作符,“LIKE”操作符的操作参数为正则表达式:

    SELECT * FROM java.lang.String s WHERE toString(s) LIKE ".*java.*"

       返回所有value域不为null的字符串,使用“=”操作符:

    SELECT * FROM java.lang.String s where s.value!=null

     返回数组长度大于15,并且深堆大于1000字节的所有Vector对象:

    SELECT * FROM java.util.Vector v WHERE v.elementData.@length>15 AND v.@retainedHeapSize>1000

     4. 内置对象与方法

    OQL中可以访问堆内对象的属性,也可以访问堆内代理对象的属性。访问堆内对象的属性时,格式如下,其中alias为对象名称:

    [ <alias>. ] <field> . <field>. <field>

    访问java.io.File对象的path属性,并进一步访问path的value属性: 

    SELECT toString(f.path.value) FROM java.io.File f

    显示String对象的内容、objectid和objectAddress:

    SELECT s.toString(),s.@objectId, s.@objectAddress FROM java.lang.String s

    显示java.util.Vector内部数组的长度:

    SELECT v.elementData.@length FROM java.util.Vector v

     显示所有的java.util.Vector对象及其子类型:

    select * from INSTANCEOF java.util.Vector

    展开全文
  • OQL对象查询语言

    千次阅读 2012-07-03 09:58:31
    目录 虚拟机学习系列 - 1 - 运行时数据区域 虚拟机学习系列 - 2 - 垃圾收集概述 虚拟机学习系列 - 3 - 垃圾收集算法 ...虚拟机学习系列 - 附 - OQL(对象查询语言)   下面内容几乎全部来自
  • JVM 对象查询语言(OQL

    万次阅读 2018-08-24 20:30:08
    OQL是用于查询Java堆的类SQL查询语言。OQL允许过滤/选择从Java堆中获取的信息。虽然HAT已经支持预定义的查询,例如“显示类X的所有实例”,但OQL增加了更多的灵活性。OQL基于JavaScript表达式语言。   O...
  • OQL资料汇总

    2018-03-20 14:44:20
    visualvm oql查询https://www.cnblogs.com/lmjk/articles/7478154.htmljhat中的OQL(对象查询语言)https://www.cnblogs.com/ceshi2016/p/6070566.html虚拟机学习系列 - 附 - OQL(对象查询语言)...
  • Java OQL(对象查询语言)

    千次阅读 2018-12-18 21:36:14
    摘要:下面内容几乎全部来自《深入理解java虚拟机》-周志明这本书的附录D附录D是作者翻译自EclipseMemoryAnalyzerTool(MAT)的OQL帮助文档我觉得对于分析内存使用情况查询OutOfMemory原因,OQL会有很大帮助,所以先在...
  • Object Query Language (OQL) OQL is SQL-like query language to query Java heap. OQL allows to filter/select information wanted from Java heap. While pre-defined queries such as "show all instances of ...
  • OQL

    千次阅读 2008-02-14 23:43:00
    今天有进行了一些OQL研究OQL Object Query Language ,前面将它与HQL比较了一下,感觉,我们的OQL更有难度,HQL 解析比较简单,只需要将HQL简单地替换成SQL就可以了,将HQL中的对象和属性自动替换成对应的数据库...
  • 内容主要来自JDK 1.8的JVM监控工具jhat中关于OQL的英文帮助说明 以及Eclipse Memory Analyzer中对OQL使用的帮助文档 以及两位CSDN博主的博客整理(博客地址在本文最后) 基本语法: select [from [instanceof]...
  • SELECT objects v.elementData FROM java.util.Vector v SELECT OBJECTS s.value FROM java.lang.String s

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,541
精华内容 1,016
关键字:

oql查询