• JMeter命令行监控CPU


    JMeter 命令行执行脚本得到的报告中,是没有CPU、内存使用率等监控数据的,我们可以使用JMeter插件帮忙。

    首先,需要下载JMeterPlugins-Standard.jar,jmeter-plugins-manager-1.3.jar,并将文件放到jmeter安装包lib/ext目录下。

    1、生成jtl文件

    我们可以使用“所有数据写入一个文件”的功能,设置cpu的数据将会存到文件中:

    文件名后缀支持.xml,.jtl,.csv;这里保存为.jtl后缀的文件;

    当使用命令行“jmeter.bat -n -t  d:code.jmx(脚本路径) -l d: esult.jtl -e -o d: eport”执行脚本后,会生成上图配置的cpu.jtl文件。这个文件还不是图形,我们无法查看CPU使用率的走势。

     这里可以使用“Command-Line Graph Plotting Tool”插件,将JTL文件生成图像。

    2、安装插件

    在选项菜单中看到插件管理子菜单:

    进入插件管理界面,勾选“Command-Line Graph Plotting Tool”插件,并点击“Apply Changes and Restart JMeter”按钮:

    安装成功后,在%JMETER_HOME%in目录下,会自动生成JMeterPluginsCMD文件。

    3、jtl文件生成图像

    命令行执行“JMeterPluginsCMD.bat --generate-png test.png --input-jtl cpu.jtl --plugin-type PerfMon --width 800 --height 600”,将会生成test.png文件:

    4、详解JMeterPluginsCMD

    官方文档:https://jmeter-plugins.org/wiki/JMeterPluginsCMD/

    生成PNG示例:

    JMeterPluginsCMD.bat --generate-png test.png --input-jtl results.jtl --plugin-type ResponseTimesOverTime --width 800 --height 600

    生成CSV示例:

    JMeterPluginsCMD.bat --generate-csv test.csv --input-jtl results.jtl --plugin-type ResponseTimesOverTime

    参数定义:

    还可以通过可选参数设置图像的大小等(这里不具体描写,可参看官方文档)。

    --plugin-type可取值:
    • AggregateReport = JMeter's native Aggregate Report, can be saved only as CSV
    • SynthesisReport = mix between JMeter's native Summary Report and Aggregate Report, can be saved only as CSV
    • ThreadsStateOverTime = Active Threads Over Time
    • BytesThroughputOverTime
    • HitsPerSecond
    • LatenciesOverTime
    • PerfMon = PerfMon Metrics Collector
    • DbMon = DbMon Metrics Collector, DataBase, get performance counters via sql
    • JMXMon = JMXMon Metrics Collector, Java Management Extensions counters
    • ResponseCodesPerSecond
    • ResponseTimesDistribution
    • ResponseTimesOverTime
    • ResponseTimesPercentiles
    • ThroughputVsThreads
    • TimesVsThreads = Response Times VS Threads
    • TransactionsPerSecond
    • PageDataExtractorOverTime
    • MergeResults = MergeResults Command Line Merge Tool to simplify the comparison of two or more load tests, need properties file (like merge-results.properties)
  • 相关阅读:
    JavaScript 事件对象Event的工具类
    高度组件专一性的松耦合系统CI的MVC
    [转]解决PHP相对目录问题最有效的办法
    CodeIgniter 用户登录注册模块
    记录js的四种函数写法
    Firebug 控制台API
    jQuery实战(一)
    apache:一个ip绑定多个域名的问题(续)
    JavaScript 字符串操作(一)
    hdu 1166 敌兵布阵【树状数组入门】
  • 原文地址:https://www.cnblogs.com/susan-su/p/10684625.html
Copyright © 2020-2023  润新知