-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmsg_speed.html
101 lines (99 loc) · 5.5 KB
/
msg_speed.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!--
Copyright 2017, Bart Butenaers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="msg-speed">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-interval"><i class="fa fa-random"></i> Frequency</label>
<input type="number" id="node-input-interval" style="width:100px;">
<select id="node-input-frequency">
<option value="sec">Second</option>
<option value="min">Minute</option>
<option value="hour">Hour</option>
</select>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-estimation" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-estimation" style="width: auto">Estimate speed during startup period</label>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-ignore" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-ignore" style="width: auto">Ignore speed during startup period</label>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-pauseAtStartup" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-pauseAtStartup" style="width: auto">Pause measurements at startup</label>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-topicDependent" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-topicDependent" style="width: auto">Topic dependent statistics</label>
</div>
</script>
<script type="text/x-red" data-help-name="msg-speed">
<p>A node to measure the flow message speed.</p>
<p>A number of examples have been included to help you do some common tasks. To use the examples, press the hamburger menu <a id="red-ui-header-button-sidemenu" class="button" href="#" onclick="RED.actions.invoke('core:show-import-dialog');"><i class="fa fa-bars"></i></a> select <b>import</b> then <b>examples</b></p>
<p><strong>Frequency</strong></p>
<p>The speed will be measured at the specified frequency.
E.g. frequency '2 hour' means that (every second) the average speed of the previous two hours will be calculated.</p>
<p><strong>Estimate speed</strong></p>
<p>In case estimation is disabled, the speed will be incorrect during the startup period.
E.g. when every second 1 message arrives, the calculated speed will only be correct after the first minute has passed.
When estimation is enabled, the final speed will be estimated during the startup interval (in this example during the first minute).
This setting is useless when frequency is 'second' (which has no startup period) or when the 'ignore speed' checkbox is selected.</p>
<p><strong>Ignore speed</strong></p>
<p>When speed is ignored during the startup period, no messages will be send to the output port during the startup period.
Moreover, the node status (in the flow editor) will not display the calculated speed.</p>
<p><strong>Pause measurements at startup</strong></p>
<p>When selected, this node will be paused automatically at startup (which means it needs to be resumed via a control message).</p>
<p>The node can be controlled via control messages:
<ul>
<li><code>msg.speed_reset = true</code>: resets all measurements and starts measuring all over again (incl. startup period).</li>
<li><code>msg.speed_pause = true</code>: pause the current speed measurement (i.e. neglect arriving input messages).</li>
<li><code>msg.speed_resume = true</code>: resume the speed measurement, in case it is paused currently.</li>
</ul>
</p>
<p><strong>Topic dependent statistics</strong></p>
<p>If enabled, the statistics will be stored per topic. Note that this might use more system resources (e.g. RAM) in case the speed is being
measured across a larger time period (e.g. per hour)!</p>
</script>
<script type="text/javascript">
RED.nodes.registerType("msg-speed", {
category: "performance",
defaults: {
name: {value:""},
frequency: {value:"sec"},
interval: {value:1, validate: function(v) { return !v || v > 0}},
estimation: {value:false},
ignore: {value:false},
pauseAtStartup: {value:false},
topicDependent: {value:false}
},
color:"#e2d96e",
inputs: 1,
outputs: 2,
outputLabels: ["speed","input msg"],
icon: "speed.png",
label: function() {
return this.name || "msg-speed";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
// Migrate old nodes which don't have an interval ye, so interval was 1 (e.g. 1 second)
$('#node-input-interval').val(this.interval || 1);
}
});
</script>