From: Hyoun Jiil Date: Mon, 9 Sep 2013 09:21:06 +0000 (+0900) Subject: [Title] add xml format printer in performance analyzer X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5692fb600b1a373f13a1e055f42b88bb42eafe95;p=sdk%2Ftools%2Fsdk-build.git [Title] add xml format printer in performance analyzer [Type] Feature [Module] Toolchain / [Priority] Minor [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: I8f60df0cb434d4bba1f5bd96be7de09fd6196c85 --- diff --git a/test/performance_analyzer b/test/performance_analyzer index a4b75cd..c92fe17 100755 --- a/test/performance_analyzer +++ b/test/performance_analyzer @@ -112,6 +112,11 @@ class CommonJob result = result + sub_job.map{|x| x.print_cvs pre_pending, post_pending } return result end + def print_xml(pre_pending = 1) + result = [] + result.push "" + ("\t" * pre_pending) + "" + return result + end def print_multi puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [ @d_U, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_U + @sub_work_total)/(@d_total + @sub_total) * 100).round if (@d_total + @sub_total) > 0}%" end @@ -148,6 +153,9 @@ def option_parse opts.on('-c', '--csv ', 'save csv file') do |cvs| options[:cvs] = cvs end + opts.on('-x', '--xml ', 'save xml file') do |xml| + options[:xml] = xml + end opts.on('-h', '--help', 'print this message') do |help| puts "useage: performance_analizer -d \"Mysql:database=;host=;port=\" -u \"\" -p \"\" -w \"start_time >= '2013-07-21'\" -c result.cvs" puts opts.help @@ -297,34 +305,7 @@ def name_extractor(jobs, names) return jobs.select{|j| (names - j.project.split(" ")).empty? } end -if option[:cvs].nil? then - mjobs = name_extractor(multiJobs,option[:name]) - if not mjobs.empty? then - puts "multi job" - puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%" - mjobs.each do |m| - m.print_multi - end - end - - sjobs = name_extractor(singleJobs,option[:name]) - if not sjobs.empty? then - puts "single job" - puts "time, status, branch, project, os, work, upload, sub_work, total, sub_total, (work + upload + sub_work)/(total + sub_total)%" - sjobs.each do |s| - s.print_single - end - end - - rjobs = name_extractor(registerJobs,option[:name]) - if not rjobs.empty? then - puts "register job" - puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%" - rjobs.each do |r| - r.print_register - end - end -else +if not option[:cvs].nil? then File.open(option[:cvs],"w") do |f| mjobs = name_extractor(multiJobs,option[:name]) if not mjobs.empty? then @@ -351,4 +332,60 @@ else end end end +else + if not option[:xml].nil? then + File.open(option[:xml],"w") do |f| + mjobs = name_extractor(multiJobs,option[:name]) + if not mjobs.empty? then + f.puts "" + mjobs.each do |m| + f.puts m.print_xml(1) + end + f.puts "" + end + sjobs = name_extractor(singleJobs,option[:name]) + if not sjobs.empty? then + f.puts "single job" + f.puts "job, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%" + sjobs.each do |m| + f.puts m.print_xml() + end + end + rjobs = name_extractor(registerJobs,option[:name]) + if not rjobs.empty? then + f.puts "register job" + f.puts "register, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%" + rjobs.each do |m| + f.puts m.print_xml() + end + end + end + else + mjobs = name_extractor(multiJobs,option[:name]) + if not mjobs.empty? then + puts "multi job" + puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%" + mjobs.each do |m| + m.print_multi + end + end + + sjobs = name_extractor(singleJobs,option[:name]) + if not sjobs.empty? then + puts "single job" + puts "time, status, branch, project, os, work, upload, sub_work, total, sub_total, (work + upload + sub_work)/(total + sub_total)%" + sjobs.each do |s| + s.print_single + end + end + + rjobs = name_extractor(registerJobs,option[:name]) + if not rjobs.empty? then + puts "register job" + puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%" + rjobs.each do |r| + r.print_register + end + end + end end