性能测试工具 simperf

码农软件 · 软件分类 · 性能测试和优化 · 2019-11-27 20:12:57

软件介绍

Simperf 是一个简单的性能测试工具,它提供了一个多线程测试框架

Example:

1. 在代码里使用Simperf

Simperf perf = new Simperf(50, 2000, 1000, 
    new SimperfThreadFactory() {
        public SimperfThread newThread() {
            return new SimperfThread();
        }
    });
// 设置结果输出文件,默认 simperf-result.log
perf.getMonitorThread().setLogFile("simperf.log");
// 开始性能测试
perf.start();

2. 在命令行里使用Simperf

public class SimperfCommandTest {
    public static void main(String[] args) {
        SimperfCommand simCommand = new SimperfCommand(args);
        Simperf perf = simCommand.create();
        if (perf == null) {
            // 参数解析失败时会返回null
            System.exit(-1);
        }
        perf.start(new SimperfThreadFactory() {
            public SimperfThread newThread() {
                return new SimperfThread();
            }
        });
    }
}

执行命令:

java SimperfCommandTest -t 10 -c 10 -i 1000
参数说明:
usage: SimperfCommand options
 -c,--count       [*] number of each thread requests count
 -i,--interval    [ ] interval of print messages, default 1000
 -j               [ ] generate jtl report
 -l,--log         [ ] log filename
 -m,--maxtps      [ ] max tps
 -t,--thread      [*] number of thread count

3. 在Junit4里使用Simperf

public class SimperfTestCaseTest extends SimperfTestCase {
    private Random              rand;
    @Test
    @Simperf(thread = 2, count = 5, interval = 1000)
    public void testXxx() {
        try {
            Thread.sleep(1000);
        } catch (Exception e) {
        }
        boolean result = rand.nextInt(10) > 1;
        Assert.assertTrue("随机生成结果", result);
    }
}

本文地址:https://codercto.com/soft/d/19933.html

互联网:碎片化生存

互联网:碎片化生存

段永朝 / 中信出版社 / 2009-11 / 42.00元

《互联网:碎片化生存》内容简介:在世界互联网人数超过17亿,中国网民接近4亿的时候,断言“这个版本的互联网没有未来”是要冒很大风险的。我们生活在比特和连线的世界,现代互联网所描绘出的“数字化”、“虚拟化”的未来是否完全值得信赖? 现代商业取得了巨大成功,但这并不是电脑和互联网精髓的自由体现,我们所使用的这个版本的电脑和互联网只不过是“被阉割”、“被劫持”的商业玩偶。 《互联网:碎片化生......一起来看看 《互联网:碎片化生存》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器