Exemple #1
0
  public JipViewer(String title, JipRun run) {
    super(title);

    addKeyListener(this);
    mMethodModel.addChangeListener(this);

    // build the call tree
    mCallTreeRoot = new TreeNode(title);
    buildTree(run, mCallTreeRoot);

    mCallTree = new JTree(mCallTreeRoot);
    mCallTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    mCallTree.addTreeSelectionListener(this);
    mCallTree.addKeyListener(this);

    // build the allMethods table
    Collection<JipRun.PerMethodInfo> perMethodInfos = run.perMethodsInTotalTimeOrder();
    long totalTimeForAllThreads = run.getTotalTimeForAllThreads();
    for (JipRun.PerMethodInfo perMethod : perMethodInfos) {
      MethodRow row = new MethodRow(perMethod.getMethod());
      for (JipFrame frame : perMethod.allFrames()) {
        if (!frame.isReentrant()) {
          row.addFrame(frame);
        }
        row.setTimeDenominator(totalTimeForAllThreads);
      }
      mAllMethodsModel.add(row);
    }
    mMethods = MethodViewer.makeTableForMethodRows(mAllMethodsModel);
    mMethods.getSelectionModel().addListSelectionListener(this);
    mMethods.addKeyListener(this);
    mAllMethodsSorterModel = (TableSorter) mMethods.getModel();

    // make the ByPackageViewer
    mPkgViewer = new ByPackageViewer(run);
    mPkgViewer.addKeyListener(this);

    // make the RemoteController
    mRemoteController = new RemoteController();
    mRemoteController.addKeyListener(this);

    // make the methodViewer
    MethodViewer methodViewer = new MethodViewer(run, mMethodModel);

    // combine all the views
    JTabbedPane tabPane = new JTabbedPane();
    tabPane.addTab("call tree", new JScrollPane(mCallTree));
    tabPane.addTab("methods", new JScrollPane(mMethods));
    tabPane.addTab("by package", new JScrollPane(mPkgViewer));
    tabPane.addTab("remote control", mRemoteController);
    tabPane.addTab("help", new HelpViewer());
    tabPane.addKeyListener(this);
    tabPane.setMinimumSize(new Dimension(100, 200));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tabPane, methodViewer);
    setContentPane(split);

    pack();
    setSize(new Dimension(1024, 768));
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Exemple #2
0
  public JipViewer(String title, JipRun run) {
    super(title);

    addKeyListener(this);
    mMethodModel.addChangeListener(this);

    // build the call tree
    mCallTreeRoot = new TreeNode(title);
    buildTree(run, mCallTreeRoot);

    mCallTree = new JTree(mCallTreeRoot);
    mCallTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    mCallTree.addTreeSelectionListener(this);
    mCallTree.addKeyListener(this);

    // build the allMethods table
    Collection<JipRun.PerMethodInfo> perMethodInfos = run.perMethodsInTotalTimeOrder();
    long totalTimeForAllThreads = run.getTotalTimeForAllThreads();
    for (JipRun.PerMethodInfo perMethod : perMethodInfos) {
      MethodRow row = new MethodRow(perMethod.getMethod());
      for (JipFrame frame : perMethod.allFrames()) {
        if (!frame.isReentrant()) {
          row.addFrame(frame);
        }
        row.setTimeDenominator(totalTimeForAllThreads);
      }
      mAllMethodsModel.add(row);
    }
    mAllMethodsModel.sort();
    mMethods = MethodViewer.makeTableForMethodRows(mAllMethodsModel);
    mMethods.getSelectionModel().addListSelectionListener(this);
    mMethods.addKeyListener(this);
    mAllMethodsSorterModel = (TableSorter) mMethods.getModel();

    // make the ByPackageViewer
    mPkgViewer = new ByPackageViewer(run);
    mPkgViewer.addKeyListener(this);

    // Make the classs count viewer

    mClassAllocationViewer = new ClassAllocationViewer(run);
    mClassAllocationViewer.addKeyListener(this);

    if (instanceNumero == 0) {
      // make the RemoteController only if root
      mRemoteController = new RemoteController();
      mRemoteController.addKeyListener(this);
    }

    // make the methodViewer
    MethodViewer methodViewerMethods = new MethodViewer(run, mMethodModel);
    MethodViewer methodViewerCallTree = new MethodViewer(run, mMethodModel);

    // combine all the views
    JTabbedPane tabPane = new JTabbedPane();
    if (instanceNumero != 0 || FIRST_HAS_DATA) {
      JSplitPane splitPane =
          new JSplitPane(
              JSplitPane.VERTICAL_SPLIT, new JScrollPane(mCallTree), methodViewerCallTree);
      splitPane.setLayout(new BoxLayout(splitPane, BoxLayout.Y_AXIS));
      tabPane.addTab("call tree", splitPane);
      splitPane =
          new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(mMethods), methodViewerMethods);
      splitPane.setLayout(new BoxLayout(splitPane, BoxLayout.Y_AXIS));
      tabPane.addTab("methods", splitPane);
      tabPane.addTab("by package", new JScrollPane(mPkgViewer));
      tabPane.addTab("class allocation", mClassAllocationViewer);
    }

    if (instanceNumero == 0) {
      tabPane.addTab("remote control", mRemoteController);
    }

    tabPane.addTab("help", new HelpViewer());
    tabPane.addKeyListener(this);
    setContentPane(tabPane);
    pack();
    setSize(new Dimension(1024, 768));
    setVisible(true);

    if (instanceNumero == 0) {
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } else {
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    instanceNumero++;
  }