亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jtop.java

?? JTop monitors the CPU usage of all threads in a remote application which has remote management enab
?? JAVA
字號:
/* * @(#)JTop.java	1.5 06/05/08 * * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this *  list of conditions and the following disclaimer. * * -Redistribution 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. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. *//* * @(#)JTop.java	1.5 06/05/08 * * Example of using the java.lang.management API to sort threads * by CPU usage. * * JTop class can be run as a standalone application. * It first establishs a connection to a target VM specified * by the given hostname and port number where the JMX agent * to be connected.  It then polls for the thread information * and the CPU consumption of each thread to display every 2  * seconds. * * It is also used by JTopPlugin which is a JConsolePlugin * that can be used with JConsole (see README.txt). The JTop * GUI will be added as a JConsole tab by the JTop plugin. * * @see com.sun.tools.jconsole.JConsolePlugin * * @author Mandy Chung */import java.lang.management.*;import javax.management.*;import javax.management.remote.*;import java.io.IOException;import java.util.ArrayList;import java.util.Collections;import java.util.List;import java.util.Map;import java.util.Map.Entry;import java.util.Set;import java.util.SortedMap;import java.util.Timer;import java.util.TimerTask;import java.util.TreeMap;import java.util.concurrent.ExecutionException;import java.text.NumberFormat;import java.net.MalformedURLException;import static java.lang.management.ManagementFactory.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;import javax.swing.event.*;import javax.swing.table.*;/** * JTop is a JPanel to display thread's name, CPU time, and its state * in a table. */public class JTop extends JPanel {    private MBeanServerConnection server;    private ThreadMXBean tmbean;    private MyTableModel tmodel;    public JTop() {        super(new GridLayout(1,0));        tmodel = new MyTableModel();         JTable table = new JTable(tmodel);        table.setPreferredScrollableViewportSize(new Dimension(500, 300));        // Set the renderer to format Double        table.setDefaultRenderer(Double.class, new DoubleRenderer());        // Add some space        table.setIntercellSpacing(new Dimension(6,3));        table.setRowHeight(table.getRowHeight() + 4);        // Create the scroll pane and add the table to it.        JScrollPane scrollPane = new JScrollPane(table);        // Add the scroll pane to this panel.        add(scrollPane);    }    // Set the MBeanServerConnection object for communicating    // with the target VM    public void setMBeanServerConnection(MBeanServerConnection mbs) {        this.server = mbs;        try {            this.tmbean = newPlatformMXBeanProxy(server,                                                 THREAD_MXBEAN_NAME,                                                 ThreadMXBean.class);        } catch (IOException e) {            e.printStackTrace();        }        if (!tmbean.isThreadCpuTimeSupported()) {            System.err.println("This VM does not support thread CPU time monitoring");        } else {            tmbean.setThreadCpuTimeEnabled(true);        }    }    class MyTableModel extends AbstractTableModel {        private String[] columnNames = {"ThreadName",                                        "CPU(sec)",                                        "State"};        // List of all threads. The key of each entry is the CPU time        // and its value is the ThreadInfo object with no stack trace.        private List<Map.Entry<Long, ThreadInfo>> threadList =             Collections.EMPTY_LIST;        public MyTableModel() {        }        public int getColumnCount() {            return columnNames.length;        }        public int getRowCount() {            return threadList.size();        }        public String getColumnName(int col) {            return columnNames[col];        }        public Object getValueAt(int row, int col) {            Map.Entry<Long, ThreadInfo> me = threadList.get(row);            switch (col) {                case 0 :                     // Column 0 shows the thread name                    return me.getValue().getThreadName();                case 1 :                     // Column 1 shows the CPU usage                    long ns = me.getKey().longValue();                    double sec = ns / 1000000000;                    return new Double(sec);                case 2 :                     // Column 2 shows the thread state                    return me.getValue().getThreadState();                default:                     return null;            }        }        public Class getColumnClass(int c) {            return getValueAt(0, c).getClass();        }        void setThreadList(List<Map.Entry<Long, ThreadInfo>> list) {            threadList = list;        }    }    /**     * Get the thread list with CPU consumption and the ThreadInfo     * for each thread sorted by the CPU time.     */    private List<Map.Entry<Long, ThreadInfo>> getThreadList() {        // Get all threads and their ThreadInfo objects         // with no stack trace        long[] tids = tmbean.getAllThreadIds();        ThreadInfo[] tinfos = tmbean.getThreadInfo(tids);        // build a map with key = CPU time and value = ThreadInfo        SortedMap<Long, ThreadInfo> map = new TreeMap<Long, ThreadInfo>();        for (int i = 0; i < tids.length; i++) {             long cpuTime = tmbean.getThreadCpuTime(tids[i]);            // filter out threads that have been terminated            if (cpuTime != -1 && tinfos[i] != null) {                map.put(new Long(cpuTime), tinfos[i]);            }        }        // build the thread list and sort it with CPU time        // in decreasing order        Set<Map.Entry<Long, ThreadInfo>> set = map.entrySet();        List<Map.Entry<Long, ThreadInfo>> list =             new ArrayList<Map.Entry<Long, ThreadInfo>>(set);        Collections.reverse(list);        return list;    }    /**     * Format Double with 4 fraction digits     */     class DoubleRenderer extends DefaultTableCellRenderer {        NumberFormat formatter;        public DoubleRenderer() {             super();            setHorizontalAlignment(JLabel.RIGHT);        }            public void setValue(Object value) {            if (formatter==null) {                formatter = NumberFormat.getInstance();                formatter.setMinimumFractionDigits(4);            }            setText((value == null) ? "" : formatter.format(value));        }    }    // SwingWorker responsible for updating the GUI    //     // It first gets the thread and CPU usage information as a     // background task done by a worker thread so that    // it will not block the event dispatcher thread.    //    // When the worker thread finishes, the event dispatcher    // thread will invoke the done() method which will update    // the UI.    class Worker extends SwingWorker<List<Map.Entry<Long, ThreadInfo>>,Object> {        private MyTableModel tmodel;        Worker(MyTableModel tmodel) {            this.tmodel = tmodel;        }        // Get the current thread info and CPU time        public List<Map.Entry<Long, ThreadInfo>> doInBackground() {            return getThreadList();        }                                                                                        // fire table data changed to trigger GUI update        // when doInBackground() is finished        protected void done() {            try {                // Set table model with the new thread list                 tmodel.setThreadList(get());                // refresh the table model                 tmodel.fireTableDataChanged();            } catch (InterruptedException e) {            } catch (ExecutionException e) {            }        }    }    // Return a new SwingWorker for UI update    public SwingWorker<?,?> newSwingWorker() {        return new Worker(tmodel);    }    public static void main(String[] args) throws Exception {        // Validate the input arguments        if (args.length != 1) {            usage();        }        String[] arg2 = args[0].split(":");        if (arg2.length != 2) {            usage();        }        String hostname = arg2[0];        int port = -1;        try {            port = Integer.parseInt(arg2[1]);        } catch (NumberFormatException x) {            usage();        }        if (port < 0) {            usage();        }        // Create the JTop Panel        final JTop jtop = new JTop();        // Set up the MBeanServerConnection to the target VM        MBeanServerConnection server = connect(hostname, port);        jtop.setMBeanServerConnection(server);        // A timer task to update GUI per each interval	TimerTask timerTask = new TimerTask() {            public void run() {                // Schedule the SwingWorker to update the GUI		jtop.newSwingWorker().execute();            }	};        // Create the standalone window with JTop panel        // by the event dispatcher thread        SwingUtilities.invokeAndWait(new Runnable() {            public void run() {                createAndShowGUI(jtop);            }        });        // refresh every 2 seconds	Timer timer = new Timer("JTop Sampling thread");	timer.schedule(timerTask, 0, 2000);    }    // Establish a connection with the remote application    //    // You can modify the urlPath to the address of the JMX agent    // of your application if it has a different URL.    //     // You can also modify the following code to take     // username and password for client authentication.    private static MBeanServerConnection connect(String hostname, int port) {        // Create an RMI connector client and connect it to        // the RMI connector server        String urlPath = "/jndi/rmi://" + hostname + ":" + port + "/jmxrmi";        MBeanServerConnection server = null;                try {            JMXServiceURL url = new JMXServiceURL("rmi", "", 0, urlPath);            JMXConnector jmxc = JMXConnectorFactory.connect(url);            server = jmxc.getMBeanServerConnection();        } catch (MalformedURLException e) {            // should not reach here        } catch (IOException e) {            System.err.println("\nCommunication error: " + e.getMessage());            System.exit(1);        }        return server;    }    private static void usage() {        System.out.println("Usage: java JTop <hostname>:<port>");        System.exit(1);    }    /**     * Create the GUI and show it.  For thread safety,     * this method should be invoked from the     * event-dispatching thread.     */    private static void createAndShowGUI(JPanel jtop) {        // Create and set up the window.        JFrame frame = new JFrame("JTop");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        // Create and set up the content pane.        JComponent contentPane = (JComponent) frame.getContentPane();        contentPane.add(jtop, BorderLayout.CENTER);        contentPane.setOpaque(true); //content panes must be opaque        contentPane.setBorder(new EmptyBorder(12, 12, 12, 12));        frame.setContentPane(contentPane);        // Display the window.        frame.pack();        frame.setVisible(true);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品人人做人人爽人人| www.日韩大片| 日韩三级电影网址| 国产婷婷色一区二区三区 | 久久精品视频一区二区三区| 日韩久久一区二区| 欧美亚洲国产一卡| 亚洲电影第三页| 欧美成人激情免费网| 国产精华液一区二区三区| 国产精品福利电影一区二区三区四区 | 国产精品99精品久久免费| 中文字幕成人在线观看| 色综合视频在线观看| 午夜一区二区三区视频| 日韩视频中午一区| 国产成人自拍在线| 亚洲一区在线播放| 欧美电影免费观看高清完整版在线 | 亚洲chinese男男1069| 亚洲乱码一区二区三区在线观看| 日本道色综合久久| 日本视频免费一区| 久久久一区二区| 91浏览器在线视频| 男男gaygay亚洲| 国产精品不卡一区| 5月丁香婷婷综合| 国产精品一区二区免费不卡| 自拍偷自拍亚洲精品播放| 337p亚洲精品色噜噜噜| 成人一区二区三区在线观看| 亚洲成人激情社区| 亚洲国产精品t66y| 91精品国产aⅴ一区二区| 风间由美一区二区av101| 亚洲一级在线观看| 中文字幕乱码久久午夜不卡| 欧美日韩国产大片| 北条麻妃一区二区三区| 蜜臀av性久久久久蜜臀av麻豆| 国产精品国产三级国产有无不卡| 3751色影院一区二区三区| a级精品国产片在线观看| 捆绑调教一区二区三区| 亚洲精品欧美二区三区中文字幕| 日韩欧美国产电影| 欧美亚洲动漫制服丝袜| 国产精品亚洲第一| 亚洲h动漫在线| 亚洲摸摸操操av| 久久久蜜桃精品| 6080国产精品一区二区| 在线观看日韩电影| 成人av资源在线观看| 狠狠色狠狠色综合系列| 亚洲bt欧美bt精品| 亚洲国产精品一区二区www| 成人欧美一区二区三区白人| 久久网站最新地址| 欧美日韩一区三区| 欧美亚洲日本一区| 色婷婷亚洲一区二区三区| 成人性视频免费网站| 九色综合狠狠综合久久| 日本不卡一二三| 日韩激情中文字幕| 午夜成人免费视频| 亚洲国产一区二区三区青草影视| 亚洲欧美另类久久久精品| 中文字幕亚洲电影| 国产精品毛片高清在线完整版| 欧美经典一区二区| 久久精品男人的天堂| 久久伊99综合婷婷久久伊| 欧美tk—视频vk| 精品国产一二三| 久久综合999| 欧美精品一区二区三区在线| 精品成人免费观看| wwwwww.欧美系列| 久久久www成人免费毛片麻豆| 精品欧美一区二区在线观看| 亚洲精品在线免费观看视频| 精品久久人人做人人爰| 日韩三级视频在线观看| 精品国产电影一区二区| 精品久久免费看| 国产精品视频在线看| 国产精品萝li| 亚洲精品亚洲人成人网| 亚洲高清视频的网址| 天天操天天干天天综合网| 日本亚洲三级在线| 国产一区二区三区视频在线播放 | 国产精品99久久不卡二区| 国产.精品.日韩.另类.中文.在线.播放| 黄页网站大全一区二区| 粗大黑人巨茎大战欧美成人| 99热这里都是精品| 欧美日韩和欧美的一区二区| 91精品国模一区二区三区| 精品国产sm最大网站| 中文字幕在线观看不卡视频| 亚洲色图丝袜美腿| 亚洲福利一区二区三区| 久久精品72免费观看| 成人动漫视频在线| 在线一区二区三区四区| 日韩一区二区三区电影| 久久久精品欧美丰满| 亚洲精品伦理在线| 日韩不卡一二三区| 成人免费视频caoporn| 欧美色手机在线观看| 26uuu久久天堂性欧美| 亚洲视频1区2区| 美女脱光内衣内裤视频久久网站 | 蜜臀va亚洲va欧美va天堂| 国产乱妇无码大片在线观看| 色婷婷国产精品综合在线观看| 欧美喷水一区二区| 国产精品婷婷午夜在线观看| 亚洲高清一区二区三区| 夫妻av一区二区| 欧美日韩在线播放一区| 久久久www免费人成精品| 亚洲成人激情自拍| 丁香婷婷综合网| 欧美一二三区精品| 一区二区免费在线播放| 国产麻豆视频一区| 欧美高清激情brazzers| 国产片一区二区| 麻豆精品一区二区综合av| 91蝌蚪porny| 国产亚洲人成网站| 日韩和欧美一区二区三区| 不卡一区二区在线| 精品国一区二区三区| 亚洲国产一区视频| 99re热视频这里只精品| 精品国产sm最大网站免费看| 婷婷开心激情综合| 一本大道av一区二区在线播放| 久久久久久亚洲综合| 天堂久久久久va久久久久| 99久久精品免费看国产免费软件| 欧美成人精品二区三区99精品| 亚洲午夜久久久久| 欧美在线一区二区| 亚洲免费色视频| 99精品一区二区| 中文字幕成人av| 国产成人精品www牛牛影视| 精品理论电影在线观看 | 成人永久看片免费视频天堂| 日韩欧美国产1| 日本欧美一区二区| 欧美蜜桃一区二区三区| 亚洲成人免费在线观看| 色婷婷av一区二区| 亚洲视频免费看| 91片黄在线观看| 亚洲精品国产品国语在线app| av在线免费不卡| 亚洲男帅同性gay1069| av欧美精品.com| 日韩理论片一区二区| 91色综合久久久久婷婷| 亚洲欧美日韩综合aⅴ视频| 色综合天天综合网天天狠天天| 亚洲青青青在线视频| 99久久久精品免费观看国产蜜| 国产精品成人免费在线| 91美女片黄在线观看| 亚洲女爱视频在线| 欧美在线综合视频| 午夜精品一区二区三区三上悠亚| 欧美美女视频在线观看| 蜜臀久久久久久久| 精品日韩一区二区三区免费视频| 蜜臀久久99精品久久久久久9| 2017欧美狠狠色| 精品第一国产综合精品aⅴ| 国产精品亚洲成人| 成人欧美一区二区三区黑人麻豆 | 亚洲综合偷拍欧美一区色| 欧美伊人久久大香线蕉综合69| 亚洲国产视频在线| 91精品国产综合久久福利软件| 韩国av一区二区三区| 日本一区二区三区在线不卡| 色又黄又爽网站www久久| 亚洲国产精品久久人人爱| 日韩一区二区三区在线观看| 国产不卡视频一区| 亚洲国产精品久久人人爱| 精品国产伦一区二区三区免费| 99久久国产免费看|