Sample CPU and Shelly power every second for energy runs
This commit is contained in:
1 parent
79bb6a11cd
commit
17f3b0dbd3
10 files changed
+13
-12
No files matched your search
@@ -41,7 +41,7 @@ Concurrency means resident simulated users, including their idle/thinking time.
|
|||||||
|
|
||||||
All six plans contain **jp@gc – PerfMon Metrics Collector**, including idle.
|
All six plans contain **jp@gc – PerfMon Metrics Collector**, including idle.
|
||||||
The listener connects over TCP to the agent on the target (default port 4444),
|
The listener connects over TCP to the agent on the target (default port 4444),
|
||||||
samples every five seconds, and writes `perfmon.csv` directly on this computer
|
samples every second, and writes `perfmon.csv` directly on this computer
|
||||||
through JMeter during the run. No server log transfer is needed. In GUI mode the
|
through JMeter during the run. No server log transfer is needed. In GUI mode the
|
||||||
listener shows live graphs; use CLI mode for actual energy experiments.
|
listener shows live graphs; use CLI mode for actual energy experiments.
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ an idle host do not establish their accuracy. Compare the readings against Linux
|
|||||||
utilities before treating the agent as a validated measurement instrument.
|
utilities before treating the agent as a validated measurement instrument.
|
||||||
|
|
||||||
The runner checks agent access/metric availability before starting. It records
|
The runner checks agent access/metric availability before starting. It records
|
||||||
`--perfmon-host`, `--perfmon-port` and `--perfmon-interval-ms` (default 5000) in
|
`--perfmon-host`, `--perfmon-port` and `--perfmon-interval-ms` (default 1000) in
|
||||||
`run.json`; by default the agent host matches `--host`. Failed, missing or widely
|
`run.json`; by default the agent host matches `--host`. Failed, missing or widely
|
||||||
spaced measurements invalidate monitoring. `perfmon-measured.csv` excludes warmup,
|
spaced measurements invalidate monitoring. `perfmon-measured.csv` excludes warmup,
|
||||||
decodes the plugin's synthetic `elapsed` field into metric values/units, and retains
|
decodes the plugin's synthetic `elapsed` field into metric values/units, and retains
|
||||||
@@ -76,7 +76,7 @@ The validation fixture uses this switch and does not connect to the NUC.
|
|||||||
## Live Shelly power in JMeter
|
## Live Shelly power in JMeter
|
||||||
|
|
||||||
Every scenario, including idle, contains one **Shelly live power** thread. It polls
|
Every scenario, including idle, contains one **Shelly live power** thread. It polls
|
||||||
`http://192.168.1.44/rpc/Switch.GetStatus?id=0` every five seconds directly from
|
`http://192.168.1.44/rpc/Switch.GetStatus?id=0` every second directly from
|
||||||
JMeter, independently of simulated users. There is no cloud dependency and no
|
JMeter, independently of simulated users. There is no cloud dependency and no
|
||||||
post-run network transfer. No switch/set/reset commands are sent.
|
post-run network transfer. No switch/set/reset commands are sent.
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ def shelly_group(tree):
|
|||||||
E.SubElement(E.SubElement(e,'elementProp',name='HTTPsampler.Arguments',elementType='Arguments'),'collectionProp',name='Arguments.arguments')
|
E.SubElement(E.SubElement(e,'elementProp',name='HTTPsampler.Arguments',elementType='Arguments'),'collectionProp',name='Arguments.arguments')
|
||||||
for k,v in [('HTTPSampler.domain','${__P(shelly_host,192.168.1.44)}'),('HTTPSampler.port','${__P(shelly_port,80)}'),('HTTPSampler.protocol','http'),('HTTPSampler.path','/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}'),('HTTPSampler.method','GET'),('HTTPSampler.implementation','HttpClient4'),('HTTPSampler.connect_timeout','3000'),('HTTPSampler.response_timeout','3000')]:prop(e,k,v)
|
for k,v in [('HTTPSampler.domain','${__P(shelly_host,192.168.1.44)}'),('HTTPSampler.port','${__P(shelly_port,80)}'),('HTTPSampler.protocol','http'),('HTTPSampler.path','/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}'),('HTTPSampler.method','GET'),('HTTPSampler.implementation','HttpClient4'),('HTTPSampler.connect_timeout','3000'),('HTTPSampler.response_timeout','3000')]:prop(e,k,v)
|
||||||
for k,v in [('HTTPSampler.follow_redirects',False),('HTTPSampler.use_keepalive',True)]:prop(e,k,v,'boolProp')
|
for k,v in [('HTTPSampler.follow_redirects',False),('HTTPSampler.use_keepalive',True)]:prop(e,k,v,'boolProp')
|
||||||
script(t,'JSR223Timer','Fixed meter cadence', "if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())")
|
script(t,'JSR223Timer','Fixed meter cadence', "if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())")
|
||||||
script(t,'JSR223PreProcessor','Clear stale power values', "['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }")
|
script(t,'JSR223PreProcessor','Clear stale power values', "['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }")
|
||||||
script(t,'JSR223Assertion','Validate and extract plug readings', """vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
|
script(t,'JSR223Assertion','Validate and extract plug readings', """vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<stringProp name="cacheKey">true</stringProp>
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
<stringProp name="filename" />
|
<stringProp name="filename" />
|
||||||
<stringProp name="parameters" />
|
<stringProp name="parameters" />
|
||||||
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())</stringProp>
|
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
|
||||||
</JSR223Timer>
|
</JSR223Timer>
|
||||||
<hashTree />
|
<hashTree />
|
||||||
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ exec python3 "$script_dir/run.py" idle \
|
|||||||
--host "${HEALTHAPP_HOST:-192.168.1.125}" \
|
--host "${HEALTHAPP_HOST:-192.168.1.125}" \
|
||||||
--shelly-host "${SHELLY_HOST:-192.168.1.44}" \
|
--shelly-host "${SHELLY_HOST:-192.168.1.44}" \
|
||||||
--warmup 1800 --duration 14400 \
|
--warmup 1800 --duration 14400 \
|
||||||
|
--perfmon-interval-ms 1000 --shelly-interval-ms 1000 \
|
||||||
--output "$script_dir/results/idle-$run_id" "$@"
|
--output "$script_dir/results/idle-$run_id" "$@"
|
||||||
@@ -17,9 +17,9 @@ p.add_argument('--session-stddev-ms',type=int,default=30000);p.add_argument('--s
|
|||||||
p.add_argument('--output',required=True);p.add_argument('--jmeter',default=str(Path.home()/'.local/bin/jmeter'))
|
p.add_argument('--output',required=True);p.add_argument('--jmeter',default=str(Path.home()/'.local/bin/jmeter'))
|
||||||
p.add_argument('--allow-shared-read-account',action='store_true')
|
p.add_argument('--allow-shared-read-account',action='store_true')
|
||||||
p.add_argument('--perfmon-host');p.add_argument('--perfmon-port',type=int,default=4444)
|
p.add_argument('--perfmon-host');p.add_argument('--perfmon-port',type=int,default=4444)
|
||||||
p.add_argument('--perfmon-interval-ms',type=int,default=5000);p.add_argument('--no-perfmon',action='store_true')
|
p.add_argument('--perfmon-interval-ms',type=int,default=1000);p.add_argument('--no-perfmon',action='store_true')
|
||||||
p.add_argument('--shelly-host',default='192.168.1.44');p.add_argument('--shelly-port',type=int,default=80)
|
p.add_argument('--shelly-host',default='192.168.1.44');p.add_argument('--shelly-port',type=int,default=80)
|
||||||
p.add_argument('--shelly-switch-id',type=int,default=0);p.add_argument('--shelly-interval-ms',type=int,default=5000);p.add_argument('--no-shelly',action='store_true')
|
p.add_argument('--shelly-switch-id',type=int,default=0);p.add_argument('--shelly-interval-ms',type=int,default=1000);p.add_argument('--no-shelly',action='store_true')
|
||||||
a=p.parse_args()
|
a=p.parse_args()
|
||||||
if a.users<1 or a.duration<1 or a.warmup<0 or a.ramp<0 or min(a.think_mean_ms,a.think_stddev_ms,a.session_pause_ms,a.session_stddev_ms)<0: p.error('Invalid timing/concurrency')
|
if a.users<1 or a.duration<1 or a.warmup<0 or a.ramp<0 or min(a.think_mean_ms,a.think_stddev_ms,a.session_pause_ms,a.session_stddev_ms)<0: p.error('Invalid timing/concurrency')
|
||||||
if a.scenario!='idle' and not a.users_file: p.error('--users-file is required')
|
if a.scenario!='idle' and not a.users_file: p.error('--users-file is required')
|
||||||
|
|||||||
Reference in new issue
Block a user