`
wjm901215
  • 浏览: 147758 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Eclipse的TPTP使用方法

    博客分类:
  • java
阅读更多

 

EclipseTPTP工具使用方法:
1.        TPTP是什么:
TPTP是Eclipse的一个顶级工程(Top-Level Project),TPTP项目封装了一大堆公共的操作接口与数据,甚至一个远程执行环境,以供其它的TPTP工具使用。另外,它还提供了扩展点以方便进行定制编码。实际上就是一个依托于Eclipse的JAVA的Profile与分析工具,还提供了整合SWT GUI的Record与Replay功能(另外的文章中进行介绍)。

2.下载要安装的各种plugin。

以TPTP4.1为例
   a.解决安装信赖条件:
     Eclipse SDK 3.1.0
     JDK 1.4
     EMF SDK 2.1.0
     XSD 2.1.0

    b.Agent Controller安装
      下载
       将下载完的安装包解压到想安装的目录。
       将<unzip directory>\bin加到系统PATH环境变量中,不能有双引号。
      执行<unzip directory>\bin下的SetConfig.bat生成基本配置环境。
      执行RAServer.exe,运行守护进程。

  c.安装TPTP,此处选择手动安装。
     下载TPTP4.1
      解压到eclipse\plugins下。

完成安装。


测试
新建一个工程(Java Project)
将下列类导入到工程中:
package com.yadong.testtptp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CarModel { /* Required car parts: 1 Engine, 4 wheels, and 2 doors */
	public Engine engine = new Engine();

	public Wheel[] wheel = new Wheel[4];

	public Door left = new Door(), right = new Door();

	public CarModel() {
		for (int i = 0; i < 4; i++)
			wheel = new Wheel();
	} /* Launcher */

	public static void main(String[] args) throws IOException {
		final String LINE_SEPARATOR = System.getProperty("line.separator");
		final int BORDER_CHAR_LENGTH = 40;
		final int UNREF_OBJ_CREATED = 10;
		StringBuffer menu = new StringBuffer();
		CarModel car = new CarModel(); /* Create the menu */
		for (int i = 0; i < BORDER_CHAR_LENGTH; i++)
			menu.append('-');
		menu.append(LINE_SEPARATOR).append("   (1) Simulate car usage");
		menu.append(LINE_SEPARATOR)
				.append("   (2) Create unreferenced objects");
		menu.append(LINE_SEPARATOR).append("   (q) Quit");
		menu.append(LINE_SEPARATOR);
		for (int i = 0; i < BORDER_CHAR_LENGTH; i++)
			menu.append('-'); /* Display the menu */
		System.out.println("CarModel started" + LINE_SEPARATOR + "Menu:");
		System.out.println(menu.toString());
		System.out.println("Choose an option:");
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String input = in.readLine().trim(); /*
												 * Accept input for the desired
												 * option
												 */
		while (!input.equalsIgnoreCase("q")) { /* Check for invalid entry */
			if (input == null || input.length() != 1
					|| !Character.isDigit(input.charAt(0))) {
				System.err.println("Wrong option");
				input = in.readLine().trim();
				continue;
			}
			switch (Integer.valueOf(input).intValue()) {
			case 1:
				simulateCarUsage(car);
				break;
			case 2:
				for (int i = 0; i < UNREF_OBJ_CREATED; i++)
					new CarModel();
				System.out.println(UNREF_OBJ_CREATED
						+ " unreferenced objects of CarModel has been created");
				break;
			default:
				System.err.println("Wrong option");
			}
			input = in.readLine().trim();
		}
	} /* Simulates car usage */

	public static void simulateCarUsage(CarModel car) {
		car.left.window.rollup();
		car.engine.start();
		car.engine.rev();
		car.wheel[0].align();
		car.engine.stop();
	}
}/* Inner classes used to model car parts */

class Engine {
	public void start() {
		System.out.println("Start the car.");
	}

	public void rev() {
		System.out.println("Rev the engine.");
	}

	public void stop() {
		System.out.println("Car stopped.");
	}
}

class Wheel {
	public void align() {
		System.out.println("Tires aligned.");
	}
}

class Window {
	public void rollup() {
		System.out.println("Rollup the window.");
	}

	public void rolldown() {
		System.out.println("Rolldown the window.");
	}
}

class Door {
	public Window window = new Window();

	public void open() {
		System.out.println("Open()");
	}

	public void close() {
		System.out.println("Close()");
	}
}
 
右键点击CarModel.java,这时会在弹出菜单中显示出Profile As ->Java Application
运行.
同时切换视图到”Profiling and logging”,这样就可以得到正在运行中程序的Profile
在这个视图中如果设置得当的话可以查看到如下结果:

1.        Coverage
2.        Execution flow
3.        Memory
4.        Object Reference
5.        UML2 object/class/Thread Interaction


下载地址:
  Eclipse SDK 3.1.0(Win32):   www.eclipse.com/downloads/index.php
JDK 1.4(Win32):    java.sun.com
EMF SDK 2.1.0(Win32): www.eclipse.com/downloads/index.php
XSD 2.1.0(Win32):http://download.eclipse.org/tools/emf/downloads/drops/2.1.0/R200507070200/xsd-SDK-2.1.0.zip:TPTP(Win32)
http://download.eclipse.org/tptp/4.1.0/TPTP-4.1.0-200511150100/tptp.runtime-TPTP-4.1.0-200511150100.zip
Agent Controller(Win32):http://download.eclipse.org/tptp/4.1.0/TPTP-4.1.0-200511150100/tptpdc.win_ia32-TPTP-4.1.0-200511150100.zip
<!--++ plugin_code qcomic begin--><!--++ plugin_code qcomic end-->

 

分享到:
评论

相关推荐

    eclipse TPTP 资源 包

    eclipse tptp THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE ...

    Eclipse TPTP平台配置详细步骤Ver1.0

    Eclipse TPTP平台配置详细步骤Ver1.0.doc

    Eclipse TPTP

    如何利用TPTP进行性能监视

    Eclipse TPTP平台配置详细步骤Ver1.0(永久空间).doc

    Eclipse Test & Performance Tools Platform Project TPTP平台搭建详细步骤与截图,以及注意事项。 原创:http://hi.baidu.com/qqwwwgame

    TPTP详细教程

    基于eclipse下开源自动化测试工具tptp的详细教程

    性能测试工具tptp使用

    什么是tptpEclipseTestandPerformanceToolsPlatform(TPTP)用它可以监测运行的并发线程数据、内存的使用情况等,是不款非常不错的性能测试工具,它是eclipse官方的一款插件项目.可以进行程序执行时间的统计分析、...

    Eclipse Test and Performance Tools Platform 简介

    学习如何使用 Eclipse Test and Performance Tools Platform(TPTP)分析 Java™ 应用程序,并研究如何测量内存使用量、识别内存泄漏并隔离性能瓶颈。

    Eclipse(中文语言包

    Eclipse(中文语言包下载地址)Indigo,Helios,Galileo,Ganymede,Europa EclipseJSFMyeclipseLinux Babel Language Packs for Europa 3.3 (MyEclipse 6.5) • BabelLanguagePack-birt-zh_3.3.1.v20101211042632.zip...

    TPTP Web TEST-开源

    在您的Web应用程序的不同版本之间自动测试HTML页面的内容。 断言:文本,正则表达式,XPath和业务属性(名称-值属性)。 根据记录自动生成断言。 Eclipse插件。

    emf-sdo-xsd-SDK-2.3.2.zip

    Eclipse安装TPTP插件时会用到的emf-sdo-xsd-SDK-2.3.2.zip文件

    使用EclipseCallisto分析应用程序

    Callisto包括一个功能强大的分析工具,此工具称为Eclipse测试与性能工具平台,简称TPTP。TPTP提供了一套功能全面的开源性能-测试和分析工具,包括集成的应用程序监控、测试、跟踪和分析功能,以及静态代码分析工具。...

Global site tag (gtag.js) - Google Analytics