On Thu, Jan 14, 2021 at 04:36:14PM +0800, Wu Fengguang wrote:
On Thu, Jan 14, 2021 at 04:12:40PM +0800, Lu Weitao wrote:
On Thu, Jan 14, 2021 at 03:44:10PM +0800, Li Ping wrote:
[why] user extract $program result actually generating a YAML file. and compass-ci/sbin/result2stats have already support merge yaml file
Signed-off-by: Li Ping 1477412247@qq.com
lib/job.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/job.sh b/lib/job.sh index 03c49e0ad..dc65f68d8 100755 --- a/lib/job.sh +++ b/lib/job.sh @@ -318,5 +318,5 @@ run_test() run_target_stats() { local script_name=$1
- $LKP_SRC/stats/$script_name < $TMP_RESULT_ROOT/$script_name > $TMP_RESULT_ROOT/$script_name.json
- $LKP_SRC/stats/$script_name < $TMP_RESULT_ROOT/$script_name > $TMP_RESULT_ROOT/$script_name.yaml
it's only write the key-value into $script_name.yaml like: hackbench.throughput: 18277.704125399672
actually we need a matrix with josn file like: { "hackbench.throughput": [ 18277.704125399672 ] } or yaml like: hackbench.throughput: - 18277.704125399672
Why it must be an array?
if yaml like: virsh.destroy.result.ok: 17 ...
when extract stats by compass-ci/sbin/result2stats, load the yaml => { "virsh.destroy.result.ok" => 17 } the value will be value.sum / sample_size
so we met the error like: Traceback (most recent call last): 7: from /home/lwt/work2/compass-ci/sbin/result2stats:42:in `<main>' 6: from /home/lwt/work2/compass-ci/lib/matrix2.rb:54:in `create_stats' 5: from /home/lwt/work2/compass-ci/lib/matrix2.rb:54:in `each' 4: from /home/lwt/work2/compass-ci/lib/matrix2.rb:60:in `block in create_stats' 3: from /home/lwt/work2/compass-ci/lib/matrix2.rb:30:in `extract_pre_result' 2: from /home/lwt/work2/compass-ci/lib/matrix2.rb:30:in `each' 1: from /home/lwt/work2/compass-ci/lib/matrix2.rb:33:in `block in extract_pre_result' /home/lwt/work2/compass-ci/lib/matrix2.rb:22:in `set_pre_value': undefined method `sum' for 17:Integer (NoMethodError) Did you mean? succ
Main code: compass-ci/lib/matrix2.rb: def exract_pre_result(stats, monitor, file) monitor_stats = load_json file # yaml.load_json sample_size = max_cols(monitor_stats)
monitor_stats.each do |k, v| next if k == "#{monitor}.time"
stats[k] = set_pre_value(k, v, sample_size) <-------------- look here ... end
def set_pre_value(item, value, sample_size) if value.size == 1 value[0] elsif independent_counter? item value.sum elsif event_counter? item value[-1] - value[0] else value.sum / sample_size <---------------- look here end end
So if ues $LKP_SRC/stats/wrapper $script_name by $LKP_SRC/dump-stats, ouput like: { key: [value_1], ... }
Thanks, Weitao
$LKP_SRC/stats/wrapper $script_name, it will output $RESULT_ROOT/$script_name.json
Thanks, Weitao ~
}
2.23.0