24 Star 81 Fork 216

openEuler/compass-ci

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
compare 2.69 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env ruby
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
# frozen_string_literal: true
# Usage:
# compare "conditions_1" "conditions_2" ... -c "common_conditions"
# compare "conditions" -d "dimensions"
# compare -t template.yaml
# Eg:
# compare "id=6000,6001" "id=7000,7001"
# compare "commit=a12d232e" "commit=b3bacc31"
# compare "os=debian" "os=centos" -c "suite=iperf"
# compare os=centos -d "os_version os_arch"
# compare os=centos suite=iperf -d "os_version os_arch" --theme="classic"
require 'optparse'
require_relative '../lib/compare.rb'
common_conditions = ''
is_group = false
dimensions = nil
options = {}
options[:min_samples] = 1
template = nil
opt_parser = OptionParser.new do |opts|
opts.banner = 'Usage: compare "conditions" ... [option]'
opts.separator ''
opts.separator 'a conditions can be "id=100, ..." or "suite=iperf os=debian ..."'
opts.separator ''
opts.separator 'options:'
opts.on('-c', '--common common_conditions', 'common conditions are same with conditions',
'and will merge with each conditions') do |c|
common_conditions = c
end
opts.on('-d', '--dimension dimensions', 'this option activate group compare mode, require filter and dimenssion',
'filter like: os=openeuler,centos suite=iperf', 'dimensions like: "tbox_group os_arch os ..."') do |d|
dimensions = d
is_group = true
end
opts.on('-s', '--stats name', 'stats to filter stats_metrics of result',
'use like: -s "iperf.tcp.sender.bps iperf.tcp.receiver.bps ..."') do |f|
options[:fields] = f.split(',')
end
opts.on('--theme theme', 'turn on colorful display with theme: classic|focus_good|focus_bad',
'|striking|light|json|html') do |theme|
options[:theme] = theme
end
opts.on('--min_samples min_samples', 'give a number to litmit the min_samples of matrix which used to compare') do |min_samples|
options[:min_samples] = min_samples.to_i
end
opts.on('--transposed', 'transposed dimensions and metric in result') do
options[:transposed] = true
end
opts.on('--changed', 'filter stats_metrics of result no changed') do
options[:changed] = true
end
opts.on('-t', '--template template', 'compare with user-defined template') do |t|
template = t
end
opts.on_tail('-h', '--help', 'show this message') do
puts opts
exit
end
end
argv = if ARGV == []
['-h']
else
ARGV
end
opt_parser.parse!(argv)
if template
compare_by_template(template, options)
elsif is_group
compare_group(argv, dimensions, options)
else
compare_matrices_list(argv, common_conditions, options)
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/compass-ci.git
git@gitee.com:openeuler/compass-ci.git
openeuler
compass-ci
compass-ci
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385