问题描述
我试图弄清楚如何使用Caliper在Eclipse中进行基准测试,但是我一无所获.我尝试按照此处找到的26分钟教程进行操作: https://code.google.com/p/caliper/,但我很快就迷路了.我已经下载了Caliper jar文件,但是我不确定它应该在哪个文件夹中.我也已经下载了Maven for Eclipse插件,但是我不确定是否有必要.是否可以从Eclipse的帮助"菜单中的安装新软件.."选项安装Caliper?我只是想能够对我为我正在学习的数据结构和算法"类创建的某些算法进行非常简单的速度测试.
I am trying to figure out how to use Caliper to do benchmark testing in Eclipse and I am getting nowhere. I tried following the 26 minute tutorial found here: https://code.google.com/p/caliper/ but I get lost quickly. I have downloaded the Caliper jar file but I'm not sure what folder it should be in. I've also downloaded Maven for Eclipse plugin but I'm not even sure if that is necessary. Is it possible to install Caliper from the 'Install New Software..' option in the Help menu in Eclipse? I just want to be able to do very simple speed tests for some of the algorithms I've created for a Data Structures and Algorithms class I am taking.
推荐答案
此答案现在已过时. Caliper在Windows中工作了至少一年,至少: https: //code.google.com/p/caliper/issues/detail?id=167
This answer is now obsolete. Caliper has worked in Windows for more than a year, at least: https://code.google.com/p/caliper/issues/detail?id=167
Caliper在Windows中不起作用.看到这种情况.您需要使用版本0.5-rc1,该版本存在其他问题,但仍然可以,并且缺少许多功能,但是在Windows中确实可以使用.
Caliper doesn't work in Windows. See this case. You need to use version 0.5-rc1, which has other issues but is still pretty okay and is missing a lot of features, but it does work in Windows.
-
如果您知道如何使用Maven,请将此pom片段添加到pom.xml中.
If you know how to use Maven, add this pom snippet to your pom.xml.
<dependency>
<groupId>com.google.caliper</groupId>
<artifactId>caliper</artifactId>
<version>0.5-rc1</version>
</dependency>
- 如果您想学习Maven,请先阅读以下内容: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
- 将您的项目转换为Maven项目(右键单击项目->配置->转换为Maven项目)
- If you want to learn maven, first read this: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
- Convert your project to a maven project (Right click on project -> Configure -> Convert to Maven Project)
- 下载0.5 -rc1 jar
- 右键单击要使用的项目,然后选择
Build Path -> Configure Build Path
- 使用
Add External Jar
将其添加到库"标签中 - Download the 0.5-rc1 jar
- Right click on the project you want to use and choose
Build Path -> Configure Build Path
- Add it to your libraries tab using
Add External Jar
完成此操作后,就可以开始编写基准测试了. 这是我为另一种Stack Overflow编写的基准测试示例问题.
Once you've done that, you can start writing benchmarks. Here is an example of a benchmark I wrote for a different Stack Overflow question.
这篇关于如何使用Caliper进行基准测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!