0

jstat、jmap、jtack などの JVM ツールについて学んでいます。コマンドラインに入力jstatすると、次のメッセージが表示されます。

Usage:
    jmap [option] <pid>
        (to connect to running process)
    jmap [option] <executable <core>
        (to connect to a core file)
    jmap [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    <none>               to print same info as Solaris pmap
    -heap                to print java heap summary
    -histo[:live]        to print histogram of java object heap; if the "live"
                         suboption is specified, only count live objects
    -permstat            to print permanent generation statistics
    -finalizerinfo       to print information on objects awaiting finalization
    -dump:<dump-options> to dump java heap in hprof binary format
                         dump-options:
                           live         dump only live objects; if not specified,
                                        all objects in the heap are dumped.
                           format=b     binary format
                           file=<file>  dump heap to <file>
                         Example: jmap -dump:live,format=b,file=heap.bin <pid>
    -F                   force. Use with -dump:<dump-options> <pid> or -histo
                         to force a heap dump or histogram when <pid> does not
                         respond. The "live" suboption is not supported
                         in this mode.
    -h | -help           to print this help message
    -J<flag>             to pass <flag> directly to the runtime system

問題は、オプション -J と混同しているということです。

-J<flag>             to pass <flag> directly to the runtime system

入力するとjstat -J-version、それは言う

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

このオプションは何に使用され、「フラグ」とは正確には何を意味しますか?

4

2 に答える 2

4

についてのOracleオンラインドキュメントjstatはより明確です:

-JjavaOption

javaOption を Java アプリケーション ランチャに渡します。たとえば、-J-Xms48m は起動メモリを 48 MB に設定します。オプションの完全なリストについては、java(1) を参照してください。

このオプションは、メモリ サイズの設定など、Java オプションをランタイム JRE に渡すために使用されます。可能なオプションのリストは、ここで見ることができます。

于 2015-09-11T08:08:53.237 に答える
2

これは、jstat が呼び出す子 JVM プロセスにそのフラグを渡すことを意味します。

たとえば、以下をjstat -J-version効果的に呼び出します。

java -version

これは、JVM バージョンを出力する効果があります。

于 2015-09-11T08:08:24.120 に答える