From: hyokeun.jeon Date: Fri, 30 Jul 2021 04:18:30 +0000 (+0900) Subject: Profiling - Do not save log files X-Git-Tag: accepted/tizen/devbase/tools/20210903.085151~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2be603d7080d499a9924aa0696ef5d860958bcc3;p=tools%2Fgbs.git Profiling - Do not save log files Change-Id: I7f6916c389be8179c79f2d222954a5ebbc19385b --- diff --git a/bsr/bsr/__version__.py b/bsr/bsr/__version__.py index f00359c..6c9ad8f 100644 --- a/bsr/bsr/__version__.py +++ b/bsr/bsr/__version__.py @@ -3,8 +3,8 @@ __title__ = 'bsr' __description__ = 'Tizen Build Statistics Reporter.' __url__ = 'https://tizen.org' -__version__ = '0.0.5' -__build__ = 0x20210531 +__version__ = '0.0.6' +__build__ = 0x20210730 __author__ = 'Hyokeun Jeon' __author_email__ = 'hyokeun.jeon@samsung.com' __license__ = 'Apache 2.0' diff --git a/bsr/bsr/bsr b/bsr/bsr/bsr index 2291c57..6664307 100755 --- a/bsr/bsr/bsr +++ b/bsr/bsr/bsr @@ -262,7 +262,7 @@ def report_main(args): save_result(tgt_dir, 'depends.xml', action.gbs.depends_xml_file_content, raw=True) #### Hard link log files - save_logs(tgt_dir, action.roots['user_log_dir']) + #save_logs(tgt_dir, action.roots['user_log_dir']) #### Meta Information #### meta_info = gather_meta_information( \ diff --git a/bsr/bsr/network/dep_parse.py b/bsr/bsr/network/dep_parse.py index 2f3f702..49a36a9 100644 --- a/bsr/bsr/network/dep_parse.py +++ b/bsr/bsr/network/dep_parse.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#-*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # @@ -76,12 +76,12 @@ class GlobalStorage: def make_edges(nodes, sorted_info, dep_packages, cycle_edges, reduced_info): """Edge information""" - edges=set() + edges = set() - level=0 - while level < len(sorted_info)-1: + level = 0 + while level < len(sorted_info) - 1: for src_pkg in sorted_info[level]: - next_level = level+1 + next_level = level + 1 for dst_pkg in sorted_info[next_level]: if src_pkg in dep_packages and dst_pkg in dep_packages[src_pkg]: edges.add((src_pkg, dst_pkg, 'false')) @@ -89,9 +89,9 @@ def make_edges(nodes, sorted_info, dep_packages, cycle_edges, reduced_info): for short_item in reduced_info[src_pkg]: if short_item[0] == src_pkg and short_item not in edges: edges.add(short_item) - level=level+1 + level = level + 1 - for src_pkg,dst_pkgs in cycle_edges.items(): + for src_pkg, dst_pkgs in cycle_edges.items(): for dst_pkg in dst_pkgs: if src_pkg in nodes and dst_pkg in nodes: edges.add((src_pkg, dst_pkg, 'true')) @@ -102,7 +102,7 @@ def make_edges(nodes, sorted_info, dep_packages, cycle_edges, reduced_info): def make_full_edges(nodes, dep_packages, cycle_edges): """Full Edge information""" - edges=set() + edges = set() for pkg in nodes: if pkg in dep_packages: @@ -110,22 +110,23 @@ def make_full_edges(nodes, dep_packages, cycle_edges): if dst_pkg in nodes: edges.add((pkg, dst_pkg, 'false')) - for src_pkg,dst_pkgs in cycle_edges.items(): + for src_pkg, dst_pkgs in cycle_edges.items(): for dst_pkg in dst_pkgs: if src_pkg in nodes and dst_pkg in nodes: edges.add((src_pkg, dst_pkg, 'true')) return edges + # pylint: disable=R0914 def topology_sort_package(nodes, dep_packages, in_edge_count, cycle_edges, reduced_info): """Process topology sorting""" - level=0 - pkg_count=0 - total_pkg_count=len(nodes) - sorted_info=[] - pkg_level={} + level = 0 + pkg_count = 0 + total_pkg_count = len(nodes) + sorted_info = [] + pkg_level = {} # loop until all packages are inserted to sorted_packages while pkg_count < total_pkg_count: @@ -134,32 +135,32 @@ def topology_sort_package(nodes, dep_packages, in_edge_count, cycle_edges, reduc for pkg in nodes: if pkg not in in_edge_count or in_edge_count[pkg] == 0: sorted_info[level].append(pkg) - in_edge_count[pkg]=-1 - pkg_level[pkg]=level - pkg_count=pkg_count+1 + in_edge_count[pkg] = -1 + pkg_level[pkg] = level + pkg_count = pkg_count + 1 # if no packages in this level, but pkg_count < total_pkg_count, # It is the case there is a cycle. Currently, we cannot solve this case. - if( len(sorted_info[level]) == 0 and pkg_count < total_pkg_count ): + if (len(sorted_info[level]) == 0 and pkg_count < total_pkg_count): print('Cycles should be removed before calling TopologySortPackages!') sys.exit(0) - #decrease in_edge_count for target packages + # decrease in_edge_count for target packages for pkg in sorted_info[level]: if pkg in dep_packages: for dep_pkg in dep_packages[pkg]: in_edge_count[dep_pkg] = in_edge_count[dep_pkg] - 1 - level = level+1 + level = level + 1 # compensate nodes. # if a node is in cycle_edges, insert it into the nodes. - for src,dst_pkgs in cycle_edges.items(): + for src, dst_pkgs in cycle_edges.items(): if src not in nodes: continue for dst_pkg in dst_pkgs: if dst_pkg not in nodes: nodes.add(dst_pkg) - pkg_level[dst_pkg]=pkg_level[src]+1 + pkg_level[dst_pkg] = pkg_level[src] + 1 edges = make_edges(nodes, sorted_info, dep_packages, cycle_edges, reduced_info) full_edges = make_full_edges(nodes, dep_packages, cycle_edges) @@ -195,12 +196,12 @@ def insert_sub_package(pkg_name, sub_pkg_name, share_var): """Insert sub package""" if not pkg_name in share_var.main_sub_pkg: - share_var.main_sub_pkg[pkg_name]=[] + share_var.main_sub_pkg[pkg_name] = [] share_var.main_sub_pkg[pkg_name].append(sub_pkg_name) if sub_pkg_name in share_var.sub_main_pkg: print('Subpackage ' + sub_pkg_name + ' is related to one or more main ' + 'packages(' \ - + share_var.sub_main_pkg[sub_pkg_name] + ','+ pkg_name + ')!\n') + + share_var.sub_main_pkg[sub_pkg_name] + ',' + pkg_name + ')!\n') share_var.sub_main_pkg[sub_pkg_name] = pkg_name share_var.pkg_print_index[sub_pkg_name] = 0 @@ -210,19 +211,19 @@ def insert_edge(pkg_name, dep_pkg_name, share_var): """Edge information""" if not dep_pkg_name in share_var.sub_pkg_edges: - share_var.sub_pkg_edges[dep_pkg_name]=[] + share_var.sub_pkg_edges[dep_pkg_name] = [] insert_package(dep_pkg_name, share_var) insert_package(pkg_name, share_var) share_var.sub_pkg_edges[dep_pkg_name].append(pkg_name) - #pprint.PrettyPrinter(indent=4).pprint(sub_pkg_edges) + # pprint.PrettyPrinter(indent=4).pprint(sub_pkg_edges) def remove_cycle(main_pkg_edges, full_in_edge_count): """Remove redundant cycle information""" - cycle_edges={} - visited=set() - path=set() + cycle_edges = {} + visited = set() + path = set() def visit(level, node): if node in visited: @@ -230,23 +231,23 @@ def remove_cycle(main_pkg_edges, full_in_edge_count): if node not in main_pkg_edges: return - #for i in range(1,level): - #print " ", - #print "("+str(level)+")visiting "+node + # for i in range(1,level): + # print " ", + # print "("+str(level)+")visiting "+node visited.add(node) path.add(node) - dst_pkgs=main_pkg_edges[node].copy() + dst_pkgs = main_pkg_edges[node].copy() for dst in dst_pkgs: if dst in path: - #cycle! - print("removing cycle (" + node + "->"+dst+")") + # cycle! + print("removing cycle (" + node + "->" + dst + ")") if node not in cycle_edges: - cycle_edges[node]=set() + cycle_edges[node] = set() cycle_edges[node].add(dst) main_pkg_edges[node].remove(dst) - full_in_edge_count[dst]=full_in_edge_count[dst]-1 + full_in_edge_count[dst] = full_in_edge_count[dst] - 1 else: - visit(level+1, dst) + visit(level + 1, dst) path.remove(node) for pkg in main_pkg_edges.keys(): @@ -264,37 +265,37 @@ def make_sub_graph(pkg_to_start, main_pkg_edges, cycle_edges, share_var): in_edge_count = {} pkg_name = find_main_package_name(pkg_to_start, share_var) - more_packages=1 + more_packages = 1 while more_packages: - more_packages=0 - #print 'adding pkg '+pkg_name + more_packages = 0 + # print 'adding pkg '+pkg_name nodes.add(pkg_name) if pkg_name in main_pkg_edges: for dst_pkg_name in main_pkg_edges[pkg_name]: if pkg_name not in dep_packages: - dep_packages[pkg_name]=[] + dep_packages[pkg_name] = [] dep_packages[pkg_name].append(dst_pkg_name) if dst_pkg_name not in in_edge_count: in_edge_count[dst_pkg_name] = 0 in_edge_count[dst_pkg_name] = in_edge_count[dst_pkg_name] + 1 if dst_pkg_name not in pkg_status: - #print 'pkg_status['+dst_pkg_name+']=visited' - pkg_status[dst_pkg_name]='visited' + # print 'pkg_status['+dst_pkg_name+']=visited' + pkg_status[dst_pkg_name] = 'visited' if pkg_name in cycle_edges: for dst_pkg_name in cycle_edges[pkg_name]: if pkg_name not in dep_packages: - dep_packages[pkg_name]=[] + dep_packages[pkg_name] = [] dep_packages[pkg_name].append(dst_pkg_name) if dst_pkg_name not in pkg_status: - #print 'pkg_status['+dst_pkg_name+']=visited' - pkg_status[dst_pkg_name]='visited' + # print 'pkg_status['+dst_pkg_name+']=visited' + pkg_status[dst_pkg_name] = 'visited' pkg_status[pkg_name] = 'printed' for pkg_st in pkg_status: if pkg_status[pkg_st] == 'visited': pkg_name = pkg_st - more_packages=1 + more_packages = 1 break return nodes, dep_packages, in_edge_count @@ -322,9 +323,9 @@ def print_vis_format(nodes, edges, pkg_level, share_var): if src_pkg_id not in data_edges: data_edges[src_pkg_id] = [] data_edges[src_pkg_id].append(share_var.pkg_id[item[1]]) - #data_out = {"nodes": data_nodes, "edges": data_edges} + # data_out = {"nodes": data_nodes, "edges": data_edges} - #with open(filename, 'w') as out_f: + # with open(filename, 'w') as out_f: # json.dump(data_out, out_f) return data_nodes, data_edges, link_list @@ -384,7 +385,7 @@ def make_dep_graph(input_file_contents, dest_dir_name, package_name_ids): # if there are no sub packages, insert itself. if not pkg_name in share_var.main_sub_pkg: - share_var.main_sub_pkg[pkg_name]=[] + share_var.main_sub_pkg[pkg_name] = [] share_var.main_sub_pkg[pkg_name].append(pkg_name) # make dependence (dep_pkg_list -> sub_pkg_name) @@ -392,12 +393,12 @@ def make_dep_graph(input_file_contents, dest_dir_name, package_name_ids): for sub_pkg_name in share_var.main_sub_pkg[pkg_name]: insert_edge(sub_pkg_name, dep_pkg_name, share_var) - main_pkg_edges={} - full_in_edge_count={} - main_pkg_reverse_edges={} - full_in_reverse_edge_count={} - #generate main_pkg_edges using sub_pkg_edges - for src,dst_pkgs in share_var.sub_pkg_edges.items(): + main_pkg_edges = {} + full_in_edge_count = {} + main_pkg_reverse_edges = {} + full_in_reverse_edge_count = {} + # generate main_pkg_edges using sub_pkg_edges + for src, dst_pkgs in share_var.sub_pkg_edges.items(): src_main = find_main_package_name(src, share_var) if src_main is None: continue @@ -406,73 +407,75 @@ def make_dep_graph(input_file_contents, dest_dir_name, package_name_ids): if dst_main is None: continue - #for main_pkg_edges + # for main_pkg_edges if not src_main in main_pkg_edges: - main_pkg_edges[src_main]=set() + main_pkg_edges[src_main] = set() if dst_main not in main_pkg_edges[src_main]: main_pkg_edges[src_main].add(dst_main) if dst_main not in full_in_edge_count: - full_in_edge_count[dst_main]=0 - full_in_edge_count[dst_main]=full_in_edge_count[dst_main]+1 + full_in_edge_count[dst_main] = 0 + full_in_edge_count[dst_main] = full_in_edge_count[dst_main] + 1 # for main_pkg_reverse_edges if not dst_main in main_pkg_reverse_edges: - main_pkg_reverse_edges[dst_main]=set() + main_pkg_reverse_edges[dst_main] = set() if src_main not in main_pkg_reverse_edges[dst_main]: main_pkg_reverse_edges[dst_main].add(src_main) if src_main not in full_in_reverse_edge_count: - full_in_reverse_edge_count[src_main]=0 - full_in_reverse_edge_count[src_main]=full_in_reverse_edge_count[src_main]+1 - + full_in_reverse_edge_count[src_main] = 0 + full_in_reverse_edge_count[src_main] = full_in_reverse_edge_count[src_main] + 1 - #print 'Removing cycles...' + # print 'Removing cycles...' main_pkg_edges, cycle_edges, full_in_edge_count = \ remove_cycle(main_pkg_edges, full_in_edge_count) main_pkg_reverse_edges, cycle_reverse_edges, full_in_reverse_edge_count = \ remove_cycle(main_pkg_reverse_edges, full_in_reverse_edge_count) ## for dependency graph - #make build_dep + # make build_dep shutil.rmtree(dest_dir_name, ignore_errors=True) os.makedirs(dest_dir_name) - #make a dependency graph for each package. + list_main_sub = [] + # make a dependency graph for each package. for pkg in share_var.main_sub_pkg: - #print 'processing package for dependence graph: ' + pkg + list_main_sub.append(pkg) + # print 'processing package for dependence graph: ' + pkg nodes, dep_packages, in_edge_count = \ make_sub_graph(pkg, main_pkg_edges, cycle_edges, share_var) nodes, edges, pkg_level, full_edges = \ topology_sort_package(nodes, dep_packages, in_edge_count, \ - cycle_edges, share_var.reduced_edges) - share_var.reduced_edges[pkg]=edges.copy() + cycle_edges, share_var.reduced_edges) + share_var.reduced_edges[pkg] = edges.copy() generate_output(pkg, nodes, edges, pkg_level, full_edges, False, share_var) - #make a full dependency graph - #print 'printing full package dependency graph...' + # make a full dependency graph + # print 'printing full package dependency graph...' nodes, edges, pkg_level, full_edges = \ - topology_sort_package(share_var.main_sub_pkg.keys(), main_pkg_edges, \ - full_in_edge_count, cycle_edges, share_var.reduced_edges) + topology_sort_package(list_main_sub, main_pkg_edges, \ + full_in_edge_count, cycle_edges, share_var.reduced_edges) generate_output('index', nodes, edges, pkg_level, full_edges, False, share_var) - #-------------------------------------------------------------------------------- + # -------------------------------------------------------------------------------- ## for reverse dependency graph - #make a reverse dependency graph for each package. + # make a reverse dependency graph for each package. for pkg in share_var.main_sub_pkg: - #print 'processing package for reverse dependence graph: ' + pkg + # print 'processing package for reverse dependence graph: ' + pkg nodes, dep_packages, in_edge_count = \ make_sub_graph(pkg, main_pkg_reverse_edges, cycle_reverse_edges, share_var) nodes, edges, pkg_level, full_edges = \ topology_sort_package(nodes, dep_packages, in_edge_count, cycle_reverse_edges, \ - share_var.reduced_edges_reverse) - share_var.reduced_edges_reverse[pkg]=edges.copy() + share_var.reduced_edges_reverse) + share_var.reduced_edges_reverse[pkg] = edges.copy() generate_output(pkg, nodes, edges, pkg_level, full_edges, True, share_var) - #make a full dependency graph - #print 'printing full package reverse dependency graph...' + # make a full dependency graph + # print 'printing full package reverse dependency graph...' nodes, edges, pkg_level, full_edges = \ - topology_sort_package(share_var.main_sub_pkg.keys(), main_pkg_reverse_edges, \ - full_in_reverse_edge_count, cycle_reverse_edges, share_var.reduced_edges_reverse) + topology_sort_package(list_main_sub, main_pkg_reverse_edges, \ + full_in_reverse_edge_count, cycle_reverse_edges, + share_var.reduced_edges_reverse) generate_output('index', nodes, edges, pkg_level, full_edges, True, share_var) share_var.flush_output_to_file(dest_dir_name) diff --git a/bsr/bsr/report/depends_xml.py b/bsr/bsr/report/depends_xml.py index 885856f..575bb86 100755 --- a/bsr/bsr/report/depends_xml.py +++ b/bsr/bsr/report/depends_xml.py @@ -54,7 +54,7 @@ class DependsXml: bucket[src_name]['subpkg'].append(src_name) if src_name not in sub_to_main_map: sub_to_main_map[src_name] = src_name - console('Loaded... # of total packages: {}'.format(len(bucket.keys())), \ + console('Loaded... # of total packages: {}'.format(len(bucket)), \ verbose=self.verbose) self.init_items(bucket) diff --git a/bsr/bsr/report/info_meta.py b/bsr/bsr/report/info_meta.py index 6db1fa3..909ce3e 100755 --- a/bsr/bsr/report/info_meta.py +++ b/bsr/bsr/report/info_meta.py @@ -12,10 +12,6 @@ # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. -# -# Generate basic information -# - """Generate basic information""" import os diff --git a/bsr/bsr/tests/test_build_time.py b/bsr/bsr/tests/test_build_time.py index 46e9ecd..989df78 100644 --- a/bsr/bsr/tests/test_build_time.py +++ b/bsr/bsr/tests/test_build_time.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -29,6 +28,8 @@ class TestBuildTime(unittest.TestCase): """Testing build_time.py""" local_log_dir = None + remote_profile_log_url = os.getenv('BuildProfiling_Test_Url') + remote_profile_report_url = os.getenv('BuildProfiling_Test_Report_Url') test_packages = { 'package-a': {'start_time': 'Mon Mar 2 23:31:45 UTC 2021', 'end_time': 'Mon Mar 2 23:50:21 UTC 2021', 'thread_no': 0}, 'package-b': {'start_time': 'Mon Mar 2 23:50:23 UTC 2021', 'end_time': 'Tue Mar 3 00:34:11 UTC 2021', 'thread_no': 0}, @@ -101,6 +102,40 @@ class TestBuildTime(unittest.TestCase): self.assertEqual('pass', b.build_time['package-b']['status']) self.assertEqual(2628, int(b.build_time['package-b']['duration'])) + def test_search_remote_logfile_negative(self): + """Check finding remote log files""" + + with self.assertRaises(Exception): + b = BuildTime(local_log_dir=TestBuildTime.local_log_dir, \ + reference_url=TestBuildTime.remote_profile_log_url, \ + verbose=True) + + def test_search_remote_profile_result_negative(self): + """Check finding logs from previous profling report""" + + b = BuildTime(local_log_dir=TestBuildTime.local_log_dir, verbose=True) + self.assertNotEqual(len(b.build_time), 0) + + try: + b = BuildTime(local_log_dir=TestBuildTime.local_log_dir, \ + reference_url=None, \ + profile_ref=TestBuildTime.remote_profile_report_url, \ + verbose=True) + except Exception: + pass + + def test_build_time_profile_ref_negative(self): + """Check profile reference""" + + b = BuildTime(local_log_dir=TestBuildTime.local_log_dir, verbose=True) + self.assertNotEqual(len(b.build_time), 0) + + try: + b.process_profile_ref(TestBuildTime.remote_profile_report_url) + except Exception: + pass + + if __name__ == '__main__': """Entry point""" diff --git a/bsr/bsr/tests/test_data_analyzer.py b/bsr/bsr/tests/test_data_analyzer.py index afd95f2..1aaad5d 100644 --- a/bsr/bsr/tests/test_data_analyzer.py +++ b/bsr/bsr/tests/test_data_analyzer.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -16,10 +15,12 @@ import unittest import os import sys from pprint import pprint +from datetime import datetime sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'bsr')) from bsr.analyzer.data_analyzer import DataAnalyzer +from bsr.utility.utils import str_to_date class TestDataAnalyzer(unittest.TestCase): @@ -31,13 +32,67 @@ class TestDataAnalyzer(unittest.TestCase): """Default fixture""" class SampleXml: - package_names = ['a', 'b', 'c'] - nodes = [0, 1, 2] - edges = {0: [1, 2], 1: [], 2: []} - in_degree = [0, 1, 1] + """Sample XML""" + + package_names = None + build_time = None + + def __init__(self): + """Default init function""" + + self.package_names = [] + self.build_time = {} + + self.package_names = ['a', 'chromium-efl', 'k'] + self.nodes = [0, 1, 2] + self.edges = {0: [1, 2], 1: [], 2: []} + self.in_degree = [0, 1, 1] + self.topology_sorted = [[0], [1, 2]] + self.chromium = ['a', 'chromium-efl'] + self.top_without_zero = ['a'] + self.zero_links = ['chromium-efl', 'k'] + self.links = {'edges_full': {0: [1, 2], 1: [], 2: []}, + 'links': [{'level': 0, 'links': 2, 'y': 0}, + {'level': 1, 'links': 0, 'y': 0}, + {'level': 1, 'links': 0, 'y': 1}], + 'nodes': [0, 1, 2], + 'package_names': ['a', 'chromium-efl', 'k']} + self.max_depth = ['a', 'k'] + + self.build_time = { + 'a': { + 'package': 'a', + 'status': 'pass', + 'start': datetime.strptime('2021-02-15 03:35:50', '%Y-%m-%d %H:%M:%S'), + 'end': datetime.strptime('2021-02-15 03:36:19', '%Y-%m-%d %H:%M:%S'), + 'thread': 'thread:01', + 'version': '1.1.0-0', + 'duration': 29.0 + }, + 'chromium-efl': { + 'package': 'chromium-efl', + 'status': 'pass', + 'start': datetime.strptime('2021-02-15 03:35:51', '%Y-%m-%d %H:%M:%S'), + 'end': datetime.strptime('2021-02-15 03:37:21', '%Y-%m-%d %H:%M:%S'), + 'thread': 'thread:02', + 'version': '1.1.0-0', + 'duration': 90.0 + }, + 'k': { + 'package': 'k', + 'status': 'pass', + 'start': datetime.strptime('2021-02-15 03:36:23', '%Y-%m-%d %H:%M:%S'), + 'end': datetime.strptime('2021-02-15 03:38:23', '%Y-%m-%d %H:%M:%S'), + 'thread': 'thread:01', + 'version': '1.1.0-0', + 'duration': 120.0 + } + } + TestDataAnalyzer.xml_inst = SampleXml() + def tearDown(self): """Destroy fixture""" @@ -46,12 +101,80 @@ class TestDataAnalyzer(unittest.TestCase): def test_analyzer(self): """Check input parameters""" - d = DataAnalyzer(TestDataAnalyzer.xml_inst) + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst) + self.assertEqual(d.package_names, TestDataAnalyzer.xml_inst.package_names) + self.assertEqual(d.nodes, TestDataAnalyzer.xml_inst.nodes) + self.assertEqual(d.edges, TestDataAnalyzer.xml_inst.edges) + self.assertEqual(d.in_degree, TestDataAnalyzer.xml_inst.in_degree) + + def test_analyzer_with_buildtime(self): + """Check with build time""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst, \ + build_time=TestDataAnalyzer.xml_inst.build_time) self.assertEqual(d.package_names, TestDataAnalyzer.xml_inst.package_names) self.assertEqual(d.nodes, TestDataAnalyzer.xml_inst.nodes) self.assertEqual(d.edges, TestDataAnalyzer.xml_inst.edges) self.assertEqual(d.in_degree, TestDataAnalyzer.xml_inst.in_degree) + def test_analyzer_without_xml(self): + """Check withhout xml""" + + d = DataAnalyzer(build_time=TestDataAnalyzer.xml_inst.build_time) + self.assertEqual(sorted(d.package_names), \ + sorted(TestDataAnalyzer.xml_inst.package_names)) + self.assertEqual(d.nodes, TestDataAnalyzer.xml_inst.nodes) + + def test_analyzer_topology_sort_negative(self): + """Check topology sort""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst) + d.topology_sorting() + self.assertEqual(d.topology_sorted, TestDataAnalyzer.xml_inst.topology_sorted) + + def test_analyzer_before_chromium_negative(self): + """Check before chromium_efl""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst) + d.topology_sorting() + c = d.get_all_packages_before_chromium_efl() + self.assertEqual(c, TestDataAnalyzer.xml_inst.chromium) + + def test_analyzer_link_info_negative(self): + """Check link info""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst) + d.topology_sorting() + d.get_all_packages_before_chromium_efl() + d.get_link_ordered_packages(buildtime_order=True, highdeps_order=True) + self.assertEqual(d.top_orders_without_zero, \ + TestDataAnalyzer.xml_inst.top_without_zero) + self.assertEqual(sorted(d.zero_links), \ + sorted(TestDataAnalyzer.xml_inst.zero_links)) + self.assertEqual(d.link_info, TestDataAnalyzer.xml_inst.links) + + def test_analyzer_with_buildtime_links_negative(self): + """Check with build time with link info""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst, \ + build_time=TestDataAnalyzer.xml_inst.build_time) + d.topology_sorting() + d.get_link_ordered_packages(buildtime_order=True, highdeps_order=True) + self.assertEqual(sorted(d.zero_links), \ + sorted(TestDataAnalyzer.xml_inst.zero_links)) + + + def test_analyzer_find_max_depth_negative(self): + """Check find max depth""" + + d = DataAnalyzer(inst_xml=TestDataAnalyzer.xml_inst, \ + build_time=TestDataAnalyzer.xml_inst.build_time) + d.topology_sorting() + d.get_link_ordered_packages(buildtime_order=True, highdeps_order=True) + d.find_max_depth() + self.assertEqual(list(d.max_depth.keys()), TestDataAnalyzer.xml_inst.max_depth) + + if __name__ == '__main__': """Entry point""" diff --git a/bsr/bsr/tests/test_depends_xml.py b/bsr/bsr/tests/test_depends_xml.py index 383fefc..8fdd18c 100644 --- a/bsr/bsr/tests/test_depends_xml.py +++ b/bsr/bsr/tests/test_depends_xml.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -54,8 +53,8 @@ class TestReadXmlFile(unittest.TestCase): try: os.remove(TestReadXmlFile.testcontent) - except: - pass + except (IOError, OSError) as e: + print('Error removing test file') def test_read_dep_xml(self): """Check package names""" @@ -83,7 +82,7 @@ class TestReadXmlFile(unittest.TestCase): for package_id in d.nodes: self.assertIsInstance(package_id, int) - def test_check_edges(self): + def test_check_edges_negative(self): """Check edge list""" # edges = {0: [1, 2], 1: [], 2: []} @@ -94,7 +93,7 @@ class TestReadXmlFile(unittest.TestCase): self.assertIn(1, d.edges) self.assertIn(2, d.edges) - def test_check_indegree(self): + def test_check_indegree_negative(self): """Check in degree list for topology sorting""" # in_degree = [0, 1, 1] diff --git a/bsr/bsr/tests/test_gbs_actions.py b/bsr/bsr/tests/test_gbs_actions.py index 887d539..b869784 100644 --- a/bsr/bsr/tests/test_gbs_actions.py +++ b/bsr/bsr/tests/test_gbs_actions.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -55,6 +54,9 @@ repos = repo.tizen_base url = http://download.tizen.org/snapshots/tizen/base/latest/repos/standard/packages/ ''') + TestGbsAction.reference_build_url = os.getenv('BuildProfiling_Test_Url') + + def tearDown(self): """Destroy fixture""" @@ -66,9 +68,49 @@ url = http://download.tizen.org/snapshots/tizen/base/latest/repos/standard/packa def test_gbs_action(self): """Check gbs parameters""" - g = GbsAction(roots=TestGbsAction.test_gbs_param) + g = GbsAction(roots=TestGbsAction.test_gbs_param, verbose=True) + self.assertEqual('armv7l', g.configs['arch']) + + def test_gbs_action_with_conf(self): + """Check .gbs.conf.bsr""" + + shutil.copy(TestGbsAction.test_gbs_param['conf_file'], + os.path.join(os.getcwd(), '.gbs.conf.bsr')) + g = GbsAction(roots=TestGbsAction.test_gbs_param, verbose=True) + self.assertEqual('armv7l', g.configs['arch']) + + def test_gbs_action_preview_negative(self): + """Check preview option""" + + g = GbsAction(roots=TestGbsAction.test_gbs_param, preview=True, verbose=True) + self.assertEqual('armv7l', g.configs['arch']) + + def test_gbs_action_previe_with_ref_negative(self): + """Check preview option with reference""" + + try: + g = GbsAction(roots=TestGbsAction.test_gbs_param, preview=True, verbose=True, \ + reference_url=TestGbsAction.reference_build_url) + self.assertEqual('armv7l', g.configs['arch']) + except Exception: + pass + + def test_gbs_action_depends_negative(self): + """Check gbs depends command""" + + g = GbsAction(roots=TestGbsAction.test_gbs_param, verbose=True) self.assertEqual('armv7l', g.configs['arch']) + try: + g.call_depends() + except Exception: + pass + + try: + g.find_depends_xml_file() + except Exception: + pass + if __name__ == '__main__': """Entry point""" diff --git a/bsr/bsr/tests/test_info_meta.py b/bsr/bsr/tests/test_info_meta.py index 92f87ea..7f9c5a0 100644 --- a/bsr/bsr/tests/test_info_meta.py +++ b/bsr/bsr/tests/test_info_meta.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -17,71 +16,130 @@ import os import sys import shutil import json +import time from pprint import pprint import datetime sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'bsr')) -from bsr.report.info_meta import gather_meta_information +from bsr.report.info_meta import gather_meta_information, reconstruct_new_format +from bsr.utility.monitoring import Monitoring +from bsr.utility.utils import json_datetime_serializer class TestInfoMeta(unittest.TestCase): """Testing info_meta.py""" test_build_time = {} - + local_repo_dir = None def setUp(self): """Default fixture""" TestInfoMeta.test_build_time = { - 'package-a': {'duration': 1116.0, - 'end': datetime.datetime(2021, 3, 3, 8, 50, 21), - 'package': 'package-a', - 'start': datetime.datetime(2021, 3, 3, 8, 31, 45), - 'status': 'pass', - 'thread': 'test-server:0', - 'version': '1.16.0-0'}, - 'package-b': {'duration': 2628.0, - 'end': datetime.datetime(2021, 3, 3, 9, 34, 11), - 'package': 'package-b', - 'start': datetime.datetime(2021, 3, 3, 8, 50, 23), - 'status': 'pass', - 'thread': 'test-server:0', - 'version': '1.16.0-0'}, - 'package-c': {'duration': 489.0, - 'end': datetime.datetime(2021, 3, 3, 8, 58, 32), - 'package': 'package-c', - 'start': datetime.datetime(2021, 3, 3, 8, 50, 23), - 'status': 'pass', - 'thread': 'test-server:1', - 'version': '1.16.0-0'}, - 'package-d': {'duration': 2299.0, - 'end': datetime.datetime(2021, 3, 3, 10, 12, 33), - 'package': 'package-d', - 'start': datetime.datetime(2021, 3, 3, 9, 34, 14), - 'status': 'pass', - 'thread': 'test-server:0', - 'version': '1.16.0-0'} + 'package-a': { + 'duration': 1116.0, + 'end': datetime.datetime(2021, 3, 3, 8, 50, 21), + 'package': 'package-a', + 'start': datetime.datetime(2021, 3, 3, 8, 31, 45), + 'status': 'pass', + 'thread': 'test-server:0', + 'version': '1.16.0-0' + }, + 'package-b': { + 'duration': 2628.0, + 'end': datetime.datetime(2021, 3, 3, 9, 34, 11), + 'package': 'package-b', + 'start': datetime.datetime(2021, 3, 3, 8, 50, 23), + 'status': 'pass', + 'thread': 'test-server:0', + 'version': '1.16.0-0' + }, + 'package-c': { + 'duration': 489.0, + 'end': datetime.datetime(2021, 3, 3, 8, 58, 32), + 'package': 'package-c', + 'start': datetime.datetime(2021, 3, 3, 8, 50, 23), + 'status': 'pass', + 'thread': 'test-server:1', + 'version': '1.16.0-0' + }, + 'package-d': { + 'duration': 2299.0, + 'end': datetime.datetime(2021, 3, 3, 10, 12, 33), + 'package': 'package-d', + 'start': datetime.datetime(2021, 3, 3, 9, 34, 14), + 'status': 'pass', + 'thread': 'test-server:0', + 'version': '1.16.0-0' + } } + TestInfoMeta.local_repo_dir = os.path.join(os.getcwd(), 'test_build_logs') + gbs_repo_dir = os.path.join(TestInfoMeta.local_repo_dir, \ + 'local', 'repos', 'tizen', 'armv7l') + shutil.rmtree(gbs_repo_dir, ignore_errors=True) + os.makedirs(gbs_repo_dir) + report_d = { + "summary": { + "packages_total": 4, + "packages_export_error": 0, + "packages_expansion_error": 0, + "packages_build_error": 0, + "packages_succeeded": "4" + } + } + + TestInfoMeta.sample_dir = os.path.join(os.getcwd(), 'sample_data') + shutil.rmtree(TestInfoMeta.sample_dir, ignore_errors=True) + os.makedirs(os.path.join(TestInfoMeta.sample_dir, 'depends')) + os.makedirs(os.path.join(TestInfoMeta.sample_dir, 'datasets')) + + with open(os.path.join(gbs_repo_dir, 'report.json'), 'w') as log_file: + json.dump(report_d, log_file, default=json_datetime_serializer) + def tearDown(self): """Destroy fixture""" TestInfoMeta.test_build_time = {} + TestInfoMeta.local_repo_dir = None def test_info_meta(self): """Check processing meta information""" - test_meta = gather_meta_information(TestInfoMeta.test_build_time, {}, {}) + test_meta = gather_meta_information(None, TestInfoMeta.test_build_time, {}) self.assertIn('BuildDetail', test_meta) self.assertIn('ReferenceDetail', test_meta) - def test_meta_keys(self): + def test_info_meta_keys(self): """Check detailed keys exist""" - test_meta = gather_meta_information(TestInfoMeta.test_build_time, {}, {}) - self.assertEqual(sorted(['Total', 'StartTime', 'EndTime', 'RunTime', 'Pass', 'Fail']), sorted(test_meta['BuildDetail'].keys())) + test_meta = gather_meta_information(None, TestInfoMeta.test_build_time, {}) + self.assertEqual(sorted(['Total', 'StartTime', 'EndTime', 'RunTime', 'Pass', 'Fail']), + sorted(test_meta['BuildDetail'].keys())) + + + def test_info_meta_keys_with_local_repo_negative(self): + """Check from local repos""" + + test_meta = gather_meta_information(TestInfoMeta.local_repo_dir, \ + TestInfoMeta.test_build_time, \ + TestInfoMeta.test_build_time) + self.assertEqual(sorted(['Total', 'StartTime', 'EndTime', 'RunTime', 'Pass', 'Fail']), + sorted(test_meta['BuildDetail'].keys())) + + + def test_info_meta_reconstruct_negative(self): + """Check reconstruct""" + + Monitoring().start_recording(os.path.join(os.getcwd(), 'cpu.records')) + time.sleep(2) + Monitoring().stop_recording_without_cleanup(os.path.join(os.getcwd(), 'cpu.records')) + test_meta = gather_meta_information(None, TestInfoMeta.test_build_time, {}) + reconstruct_new_format(TestInfoMeta.sample_dir , os.path.join(os.getcwd(), 'cpu.records')) + + test_meta = gather_meta_information(None, TestInfoMeta.test_build_time, {}) + self.assertIn('BuildDetail', test_meta) if __name__ == '__main__': diff --git a/bsr/bsr/tests/test_network.py b/bsr/bsr/tests/test_network.py index 305f7e6..c431e42 100644 --- a/bsr/bsr/tests/test_network.py +++ b/bsr/bsr/tests/test_network.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2021 Samsung Electronics.Co.Ltd. # # This program is free software; you can redistribute it and/or modify it @@ -99,7 +98,7 @@ class TestNetwork(unittest.TestCase): self.assertTrue(os.path.isfile(os.path.join(TestNetwork.network_root, '9999.json'))) - def test_partial_full_keys(self): + def test_partial_full_keys_negative(self): """Check all the keys are included for partial/full""" create_build_dep_graph(TestNetwork.test_xml_content, TestNetwork.depends_root, TestNetwork.package_names) @@ -112,7 +111,7 @@ class TestNetwork(unittest.TestCase): "prn", "pre", "prl", "frn", "fre", "frl"]: self.assertIn(type_key, network_json) - def test_json_data(self): + def test_json_data_negative(self): """Check json data""" create_build_dep_graph(TestNetwork.test_xml_content, TestNetwork.depends_root, TestNetwork.package_names) diff --git a/bsr/bsr/tests/test_utils.py b/bsr/bsr/tests/test_utils.py new file mode 100644 index 0000000..7e2cc23 --- /dev/null +++ b/bsr/bsr/tests/test_utils.py @@ -0,0 +1,99 @@ +# Copyright (c) 2021 Samsung Electronics.Co.Ltd. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +"""Test cases for gbs_actions.py""" + +import unittest +import os +import sys +import shutil +import json +from pprint import pprint +import datetime +import signal + +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'bsr')) + +from bsr.utility.utils import * + + +class TestUtils(unittest.TestCase): + """Testing utils.py""" + + test_gbs_param = {} + + def setUp(self): + """Default fixture""" + + def tearDown(self): + """Destroy fixture""" + + def test_utils_console(self): + """Check console""" + + console('Logging this message', level='INFO', verbose=True) + test_string = 'Forever' + self.assertEqual(test_string, 'Forever') + + def test_utils_pushd(self): + """Check pushd""" + + sample_text = 'Hello World' + sample_filename = 'test.log' + test_dir = os.path.join(os.getcwd(), 'pushd_test_dir') + shutil.rmtree(test_dir, ignore_errors=True) + os.makedirs(test_dir) + + with pushd(test_dir): + with open(sample_filename, 'w') as test_f: + test_f.write(sample_text) + + with open(os.path.join(test_dir, sample_filename), 'r') as read_f: + full_text = read_f.read() + self.assertEqual(sample_text, full_text) + + shutil.rmtree(test_dir, ignore_errors=True) + + def test_utils_temp_dir_negative(self): + """Check temporary_directory""" + + sample_text = 'Hello World' + sample_filename = 'test.log' + + with temporary_directory(): + with open(sample_filename, 'w') as test_f: + test_f.write(sample_text) + self.assertEqual(sample_text, 'Hello World') + + def test_utils_serve_web_negative(self): + """Check web servings""" + + def handler(signum, frame): + raise Exception("end of time") + + def serve_forever(): + serve_web(8007, os.getcwd()) + + test_string = 'Forever' + self.assertEqual(test_string, 'Forever') + signal.signal(signal.SIGALRM, handler) + signal.alarm(2) + + try: + serve_forever() + except Exception: + pass + + +if __name__ == '__main__': + """Entry point""" + + unittest.main() diff --git a/bsr/bsr/utility/monitoring.py b/bsr/bsr/utility/monitoring.py index a1ad726..6649e87 100755 --- a/bsr/bsr/utility/monitoring.py +++ b/bsr/bsr/utility/monitoring.py @@ -36,11 +36,10 @@ class Monitoring: values = [] if os.path.isfile(target_file): - with open(target_file, 'r') as hw_rec: - for item in hw_rec.readlines()[1:]: - tstamp, cpu_usage, mem_usage = item.strip().split(',') - values.append([int(tstamp), \ - round(float(cpu_usage), 2), round(float(mem_usage), 2)]) + with open(target_file, 'r') as cpu_rec: + for item in cpu_rec.readlines()[1:]: + tstamp, usage = item.strip().split(',') + values.append([int(tstamp), float(usage)]) return values @@ -51,17 +50,10 @@ class Monitoring: stringed_command = """import time, psutil while True: - with open('__DEST__', 'a') as wf: - wf.write('{},{},{}\\n'.format(int(time.time()), - round(psutil.cpu_percent(interval=5), 2), - round(float(psutil.virtual_memory().used)/1024/1024/1024, 2))) - if sum(1 for line in open('__DEST__')) > 17280: + with open('__DEST__', 'a') as wf: + wf.write('{},{}\\n'.format(int(time.time()), psutil.cpu_percent(interval=5))) + if sum(1 for line in open('__DEST__')) > 7200: break - try: - if len([x.name() for x in psutil.process_iter() if 'depanneur' in x.name()]) <= 0: - break - except Exception as err: - pass """.replace('__DEST__', target_file) pid = subprocess.Popen(['python', '-c', stringed_command]).pid diff --git a/bsr/bsr/web_dist/asset-manifest.json b/bsr/bsr/web_dist/asset-manifest.json index 27200f5..7162d67 100644 --- a/bsr/bsr/web_dist/asset-manifest.json +++ b/bsr/bsr/web_dist/asset-manifest.json @@ -1,7 +1,7 @@ { "files": { "main.css": "./static/css/main.c6b1a691.chunk.css", - "main.js": "./static/js/main.3b57cdf5.chunk.js", + "main.js": "./static/js/main.3223a277.chunk.js", "runtime-main.js": "./static/js/runtime-main.bc689076.js", "static/css/2.e905ac86.chunk.css": "./static/css/2.e905ac86.chunk.css", "static/js/2.b0fd9646.chunk.js": "./static/js/2.b0fd9646.chunk.js", @@ -14,6 +14,6 @@ "static/css/2.e905ac86.chunk.css", "static/js/2.b0fd9646.chunk.js", "static/css/main.c6b1a691.chunk.css", - "static/js/main.3b57cdf5.chunk.js" + "static/js/main.3223a277.chunk.js" ] } \ No newline at end of file diff --git a/bsr/bsr/web_dist/index.html b/bsr/bsr/web_dist/index.html index e98fb0e..a9677c9 100644 --- a/bsr/bsr/web_dist/index.html +++ b/bsr/bsr/web_dist/index.html @@ -1 +1 @@ -Tizen Build Profiling
\ No newline at end of file +Tizen Build Profiling
\ No newline at end of file diff --git a/bsr/bsr/web_dist/static/js/main.3223a277.chunk.js b/bsr/bsr/web_dist/static/js/main.3223a277.chunk.js new file mode 100644 index 0000000..b7e9ee4 --- /dev/null +++ b/bsr/bsr/web_dist/static/js/main.3223a277.chunk.js @@ -0,0 +1 @@ +(this["webpackJsonptizen-build-performance"]=this["webpackJsonptizen-build-performance"]||[]).push([[0],{595:function(e,t,a){},596:function(e,t,a){},601:function(e,t,a){},843:function(e,t,a){},975:function(e,t,a){"use strict";a.r(t);var n=a(5),i=a(0),r=a.n(i),c=a(20),l=a.n(c),s=(a(595),a(35));var o=function(e){var t=Object(i.useState)({data_home:null,metaData:null,maxDepth:null,dependsLink:null,buildTime:null,buildTimeRef:null,hwTrend:null}),a=Object(s.a)(t,2),r=a[0],c=a[1],l=(r.data_home,r.metaData),o=r.maxDepth,d=r.dependsLink,j=r.buildTime,u=r.buildTimeRef,p=(r.hwTrend,e.public_data_location+"result_meta.json"),h=e.public_data_location+"max_depth.json",m=e.public_data_location+"depends_link.json",b=e.public_data_location+"buildtime.json",f=e.public_data_location+"buildtime_ref.json",x=e.public_data_location+"hw_resource.json",v=e.public_data_location+"dep_graph/default/arch/index.html";return Object(i.useEffect)((function(){Promise.all([fetch(p),fetch(h),fetch(m),fetch(b),fetch(f),fetch(x)]).then((function(e){var t=Object(s.a)(e,6),a=t[0],n=t[1],i=t[2],r=t[3],c=t[4],l=t[5];return Promise.all([a.json(),n.json(),i.json(),r.json(),c.json(),l.json()])})).then((function(t){var a=Object(s.a)(t,6),n=a[0],i=a[1],r=a[2],l=a[3],o=a[4],d=a[5];c({data_home:e.public_data_location,metaData:n,maxDepth:i,dependsLink:r,buildTime:l,buildTimeRef:o,hwTrend:d}),function(t){var a=t;a.dependsPath=v,e.onChange(a)}({data_home:e.public_data_location,metaData:n,maxDepth:i,dependsLink:r,buildTime:l,buildTimeRef:o,hwTrend:d})}))}),[]),l&&o&&d&&j&&u?Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"All data prepared..."})}):Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})},d=(a(596),a(71)),j=a(108),u=a(44),p=a(1032);a(435);var h=a(113);var m=function(e,t){var a=t.defaultActive,r=e.history.location,c=(localStorage.getItem("lastActiveItem"),Object(i.useState)({activeItem:a})),l=Object(s.a)(c,2),o=l[0],d=l[1],j=o.activeItem;Object(i.useEffect)((function(){d({activeItem:r.pathname})}),[r]);var u=function(t,a){return function(t){e.history.push({pathname:t})}(a.name)};return Object(n.jsxs)(p.a,{compact:!0,icon:"labeled",pointing:!0,secondary:!0,children:[Object(n.jsxs)(p.a.Item,{name:"/overview",active:"/overview"===j,onClick:u,children:[Object(n.jsx)(h.f,{name:"/overview"}),Object(n.jsx)("div",{style:{display:"flex",paddingTop:"5px"},children:"Overview"})]}),Object(n.jsxs)(p.a.Item,{name:"/dependencygraph",active:"/dependencygraph"===j,onClick:u,children:[Object(n.jsx)(h.b,{name:"/dependencygraph"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Dependency"})]}),Object(n.jsxs)(p.a.Item,{name:"/criticalpath",active:"/criticalpath"===j,onClick:u,children:[Object(n.jsx)(h.g,{name:"/criticalpath"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Critical Path"})]}),Object(n.jsxs)(p.a.Item,{name:"/buildtime",active:"/buildtime"===j,onClick:u,children:[Object(n.jsx)(h.d,{name:"/buildtime"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Build Time"})]}),Object(n.jsxs)(p.a.Item,{name:"/timeline",active:"/timeline"===j,onClick:u,children:[Object(n.jsx)(h.e,{name:"/timeline"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Timeline"})]}),Object(n.jsxs)(p.a.Item,{name:"/timecompare",active:"/timecompare"===j,onClick:u,children:[Object(n.jsx)(h.c,{name:"/timecompare"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Compare"})]})]})};var b=function(e){return Object(n.jsxs)("div",{children:[Object(n.jsx)(m,{deploy_url:e.deploy_url,history:e.history}),Object(n.jsx)("div",{style:{display:"flex",margin:"5px"},children:Object(n.jsx)("div",{style:{backgroundColor:"#F4F6F6",width:"100%",height:"100vh",marginLeft:"10px"},children:Object(n.jsx)("div",{style:{backgroundColor:"#F4F6F6"},children:e.children})})})]})},f=a(436),x=a(1017),v=a(1019),O=a(144),g=a(154),y=a(1016),_=a(355),k=Object(f.a)({root:{minWidth:275},bullet:{display:"inline-block",margin:"0 2px",transform:"scale(0.8)"},title:{fontSize:14},pos:{marginBottom:12}}),T=Object(g.a)({typography:{fontFamily:["-apple-system","SFMono-Regular","Menlo,Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"].join(",")}});function D(e){var t,a,i=k();return"1"===e.happy?a="#0acf97":"0"===e.happy&&(a="#fa5c7c"),"+"===e.diff?t=Object(n.jsx)(_.b,{}):"-"===e.diff&&(t=Object(n.jsx)(_.a,{})),Object(n.jsx)("div",{style:{margin:"10px"},children:Object(n.jsx)(y.a,{theme:T,children:Object(n.jsx)(x.a,{className:i.root,variant:"outlined",children:Object(n.jsxs)(v.a,{children:[Object(n.jsx)(O.a,{variant:"h6",component:"h6",color:"textSecondary",children:e.title}),Object(n.jsx)(O.a,{className:i.pos,color:"textSecondary"}),Object(n.jsx)(O.a,{variant:"h4",component:"h4",color:"textSecondary",children:Object(n.jsx)("b",{children:e.value})}),Object(n.jsx)("div",{style:{display:"flex",marginTop:"10px"},children:Object(n.jsxs)("div",{style:{display:"flex",marginTop:"10px"},children:[Object(n.jsx)("span",{style:{color:a},children:Object(n.jsx)("div",{style:{marginTop:"5px",paddingRight:"5px"},children:Object(n.jsx)(O.a,{variant:"body1",component:"p",color:"inherit",children:t})})}),Object(n.jsx)("span",{style:{color:a},children:Object(n.jsx)("div",{children:e.diff_value})}),Object(n.jsx)("div",{style:{paddingLeft:"5px"},children:" Since reference"})]})})]})})})})}var w=Object(u.f)((function(e){var t=e.meta_data;function a(e){e<0&&(e=0-e),e=Number(e/1e3);var t=Math.floor(e/3600),a=Math.floor(e%3600/60),n=Math.floor(e%3600%60);return t<10&&(t="0"+t),a<10&&(a="0"+a),n<10&&(n="0"+n),t+":"+a+":"+n}if(t){var i={total:{check:"",val:"0",happy:""},time:{check:"",val:"0",happy:""},pass:{check:"",val:"0",happy:""},fail:{check:"",val:"0",happy:""}},r=a(t.BuildDetail.RunTime);return i.total.val=t.BuildDetail.Total-t.ReferenceDetail.Total,t.BuildDetail.Total>t.ReferenceDetail.Total?(i.total.check="+",i.total.happy="0"):t.BuildDetail.Totalt.ReferenceDetail.Pass?(i.pass.check="+",i.pass.happy="1"):t.BuildDetail.Passt.ReferenceDetail.Fail&&(i.fail.check="-",i.fail.happy="0"),i.time.val=a(t.BuildDetail.RunTime-t.ReferenceDetail.RunTime),t.BuildDetail.RunTimet.ReferenceDetail.RunTime&&(i.time.check="+",i.time.happy="0"),Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)("div",{style:{padding:"20px"},children:[Object(n.jsxs)("div",{style:{display:"flex"},children:[Object(n.jsx)(D,{title:"Total Packages",value:t.BuildDetail.Total,diff:i.total.check,diff_value:i.total.val,happy:i.total.happy}),Object(n.jsx)(D,{title:"Build Time",value:r,diff:i.time.check,diff_value:i.time.val,happy:i.time.happy})]}),Object(n.jsxs)("div",{style:{display:"flex"},children:[Object(n.jsx)(D,{title:"Pass",value:t.BuildDetail.Pass,diff:i.pass.check,diff_value:i.pass.val,happy:i.pass.happy}),Object(n.jsx)(D,{title:"Fail",value:t.BuildDetail.Fail,diff:i.fail.check,diff_value:i.fail.val,happy:i.fail.happy})]})]})})}return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})}));var F=Object(u.f)((function(e){return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:Object(n.jsx)(w,{meta_data:e.meta_data})})})})),S=(a(601),a(286)),C=function(e){console.log("flow loaded:",e),e.fitView()},R={30:"#DCEDC8",180:"#AED581",300:"#8BC34A",600:"#4FC3F7",900:"#03A9F4",1200:"#F7DC6F",1800:"#FFEB3B",2700:"#FBC02D",3e3:"#FF6F00",3600:"#F44336"},P=Object.keys(R).reverse();function I(e){var t,a=0,n=0;return e/60/60>0&&(a=parseInt(e/60/60)),e/60-60*a>0&&(n=parseInt(e/60-60*a)),t=e-60*a*60-60*n,a>0?a+"h "+n+"m "+t+"s":n>0?n+"m "+t+"s":t+"s"}var B=function(e){for(var t=e.critical_path,a=[],i=0;iparseInt(P[a])){t=R[P[a]];break}return t},s=0;su)&&(o=u),(null===d||d=m.length-1||(m[T].cpu=D,m[T].memory=w))}return Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)(G.Chart,{scale:{cpu:{alias:"CPU (%)_____________",tickCount:5,min:0,type:"linear-strict"},memory:{alias:"___________Mem (GB)",tickCount:5,min:0,type:"linear-strict"},threads:{alias:"Running Threads (No.)",tickCount:5,min:0,type:"linear-strict"},time:{alias:"Time (seconds) ",type:"timeCat",mask:"YYYY-MM-DD HH:mm:ss"}},autoFit:!0,height:200,data:m,area:!0,onGetG2Instance:function(e){i=e},children:[Object(n.jsx)(G.Axis,{name:"threads",title:!0}),Object(n.jsx)(G.Axis,{name:"cpu",title:!0}),Object(n.jsx)(G.Axis,{name:"memory",title:!0}),Object(n.jsx)(G.Axis,{name:"time",title:!0,label:c}),Object(n.jsx)(G.Legend,{custom:!0,allowAllCanceled:!0,items:[{value:"threads",name:"No. of threads",marker:{symbol:"hyphen",style:{stroke:r[0],r:5,lineWidth:3}}},{value:"memory",name:"Memory usage (GB)",marker:{symbol:"hyphen",style:{stroke:r[2],r:5,lineWidth:3}}},{value:"cpu",name:"CPU usage (%)",marker:{symbol:"hyphen",style:{stroke:r[1],r:5,lineWidth:3}}}],onChange:function(e){for(var t=e.item,a=t.value,n=!t.unchecked,r=i.geometries,c=0;c1&&void 0!==arguments[1]?arguments[1]:0,n=3735928559^a,i=1103547991^a,r=0;r>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&(i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(e+e);return"#"+((255&t)>>0).toString(16).padStart(2,"0")+((16711680&t)>>16).toString(16).padStart(2,"0")+((65280&t)>>8).toString(16).padStart(2,"0")}var K=Object(u.f)((function(e){var t=e.build_time,a=e.hw_trend,r=Object(i.useRef)(null),c=Object(i.useRef)(null),l=function(e){var t=[{group:"",data:[]}],a=[],n=null,i=null;for(var r in e){var c=e[r].thread;a.includes(c)||(a.push(c),t[0].data.push({label:"".concat(c),data:[]}));var l=new Date(e[r].start).getTime(),s=new Date(e[r].end).getTime();(null===n||li)&&(i=s)}for(var r in e){var o=e[r].thread,d=new Date(e[r].start).getTime(),j=new Date(e[r].end).getTime(),u=a.indexOf(o);t[0].data[u].data.push({timeRange:[d,j],val:r})}return{data:t,min_start:n}}(e.build_time),s=l.data,o=l.min_start,d=Object(N.a)().domain(Object.keys(t).sort()).range(Object.keys(t).sort().map((function(e){return Y(e)})));return Object(i.useEffect)((function(){c.current=(new H.a).data(s)(r.current),c.current.zColorScale(d).xTickFormat((function(e){return parseInt((e.getTime()-o)/1e3/60)+"\ubd84"})).width(1300).timeFormat("%H:%M:%S").segmentTooltipContent((function(e){return function(e){var t=e.val,a=e.timeRange[0],n=e.timeRange[1];return"[ "+t+" ]
Duration "+(n.getTime()-a.getTime())/1e3+" sec.
Thread: "+e.label+"
Start: "+a.toLocaleTimeString()+"
End: "+n.toLocaleTimeString()}(e)}))}),[]),Object(i.useEffect)((function(){})),Object(n.jsxs)(n.Fragment,{children:[Object(n.jsx)("div",{style:{margin:"10px",padding:"10px"},children:Object(n.jsx)("div",{children:Object(n.jsx)(O.a,{variant:"h6",component:"h6",color:"textSecondary",children:"This is a chart showing the distribution of overall package build times."})})}),Object(n.jsx)("div",{style:{width:"1210px",marginLeft:"5px"},children:Object(n.jsx)("div",{ref:r})}),Object(n.jsx)("div",{style:{width:"1210px",marginLeft:"50px"},children:Object(n.jsx)(U,{build_time:t,hw_trend:a})})]})})),V=a(545),J=a(546),Q=a(547),q=a(565),X=a(1033),Z=a(1031),$=a(560),ee=a(561),te=a(288),ae=a(213),ne=a(566),ie=function(e){Object(Q.a)(a,e);var t=Object(q.a)(a);function a(){return Object(V.a)(this,a),t.apply(this,arguments)}return Object(J.a)(a,[{key:"render",value:function(){var e=this.props,t=e.x,a=e.y,i=(e.stroke,e.payload);return Object(n.jsx)("g",{transform:"translate(".concat(t,",").concat(a,")"),children:Object(n.jsx)("text",{x:0,y:0,dy:4,textAnchor:"end",fill:"#666",fontSize:12,transform:"rotate(-35)",children:i.value})})}}]),a}(i.PureComponent);var re=Object(u.f)((function(e){var t=e.build_time,a=e.build_time_ref;if(t&&a){var i=[];for(var r in t){var c=0;r in a&&(c=a[r].duration),i.push({name:t[r].package,current:parseInt(t[r].duration),reference:parseInt(c)})}var l=[].concat(i).sort((function(e,t){return(e.current-e.reference)*(e.current-e.reference)>(t.current-t.reference)*(t.current-t.reference)?-1:1}));return l=l.slice(0,40).sort((function(e,t){return e.current>t.current?-1:1})),Object(n.jsxs)(n.Fragment,{children:[Object(n.jsx)("div",{style:{margin:"10px",padding:"10px"},children:Object(n.jsx)("div",{children:Object(n.jsxs)(O.a,{variant:"h6",component:"h6",color:"textSecondary",children:["This graph shows the top ",40," packages with a large time difference from the previous build."]})})}),Object(n.jsxs)(X.a,{width:1e3,height:500,margin:{top:50,right:10,left:10,bottom:10},data:l,barCategoryGap:3,barGap:0,children:[Object(n.jsx)(Z.a,{strokeDasharray:"3 3"}),Object(n.jsx)($.a,{dataKey:"name",interval:0,tick:Object(n.jsx)(ie,{})}),Object(n.jsx)(ee.a,{}),Object(n.jsx)(te.a,{}),Object(n.jsx)(ae.a,{wrapperStyle:{top:10,left:25}}),Object(n.jsx)(ne.a,{dataKey:"current",fill:"#EC951F"}),Object(n.jsx)(ne.a,{dataKey:"reference",fill:"#82ca9d"})]})]})}return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})})),ce=a(485),le=a(474),se=a(1034),oe=a(478),de=a(475),je=a(348),ue=a(562);function pe(e,t){var a=e;return e<300+6*t&&(a=300+6*t),a}var he=function(e){var t=null,a=Object(i.useRef)(null),r=Object(i.useRef)(null),c=function(e,t,a,n){var i={nodes:[],edges:[],max_y_offset:0},r="p";"partial"===e?r="p":"partial_reverse"===e?r="pr":"full"===e?r="f":"full_reverse"===e&&(r="fr");for(var c=0;c=0&&(t=r.current.getConnectedNodes(e),a=r.current.getConnectedEdges(e));var n=c.nodes.map((function(a){return-1===e||e===a.id||t.includes(a.id)?Object(d.a)(Object(d.a)({},a),{},{color:void 0}):Object(d.a)(Object(d.a)({},a),{},{color:"#F2F3F4"})})),i=c.edges.map((function(t){return-1===e||e===t.id||a.includes(t.id)?Object(d.a)(Object(d.a)({},t),{},{hidden:!1}):Object(d.a)(Object(d.a)({},t),{},{hidden:!0})}));e>=0&&r.current.focus(e,o),r.current.body.data.nodes.update(n),r.current.body.data.edges.update(i)}return Object(i.useEffect)((function(){r.current=new ue.a(a.current,c,l)}),[a,r,c,l]),Object(i.useEffect)((function(){e.searched_id&&j(e.searched_id),r.current.on("select",(function(e){var a=e.nodes;1!==t&&setTimeout((function(){1!==t?a.length>0?j(a[0]):j(-1):t=null}),200)})),r.current.on("doubleClick",(function(a){var n=a.nodes;t=1,e.onChange(n[0])}))})),Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:Object(n.jsx)("div",{style:{height:c.max_y_offset.toString()+"px"},ref:a})})})};var me=function(e){var t="p";"partial"===e.radio_type?t="p":"partial_reverse"===e.radio_type?t="pr":"full"===e.radio_type?t="f":"full_reverse"===e.radio_type&&(t="fr");for(var a=[],i=0;i *":{margin:e.spacing(1),width:"25ch"}}}}));var fe=Object(u.f)((function(e){var t=be(),a=r.a.useState("partial"),c=Object(s.a)(a,2),l=c[0],o=c[1],d=e.selected_id;d||(d=9999);var j=r.a.useState(d),u=Object(s.a)(j,2),p=u[0],h=u[1],m=Object(i.useState)({packageNameData:null,singlePackageData:null}),b=Object(s.a)(m,2),f=b[0],x=b[1],v=f.packageNameData,O=f.singlePackageData,g=r.a.useState(null),y=Object(s.a)(g,2),_=y[0],k=y[1],T=Object(i.useRef)(null);return Object(i.useEffect)((function(){!function(){var t=e.data_home+"networks/package_names.json",a=e.data_home+"networks/"+p+".json";Promise.all([fetch(t),fetch(a)]).then((function(e){var t=Object(s.a)(e,2),a=t[0],n=t[1];return Promise.all([a.json(),n.json()])})).then((function(e){var t=Object(s.a)(e,2),a=t[0],n=t[1];return x({packageNameData:a,singlePackageData:n})}))}()}),[p]),v&&O?Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)("div",{children:[Object(n.jsxs)("div",{style:{display:"flex",margin:"10px"},children:[Object(n.jsx)("div",{children:Object(n.jsx)("div",{style:{display:"flex",margin:"10px"},children:Object(n.jsxs)("div",{className:t.root,noValidate:!0,autoComplete:"off",children:[Object(n.jsx)(ce.a,{id:"standard-basic",label:"Package Name",inputRef:T}),Object(n.jsx)(le.a,{style:{marginTop:"20px"},variant:"outlined",color:"primary",onClick:function(){k(v.indexOf(T.current.value))},children:"Search"})]})})}),Object(n.jsx)("div",{style:{marginLeft:"50px",border:"1px solid #cdcdcd"},children:Object(n.jsx)(je.a,{component:"fieldset",style:{width:"100%"},children:Object(n.jsxs)(oe.a,{row:!0,"aria-label":"position",name:"position",defaultValue:"top",value:l,onChange:function(e){o(e.target.value)},children:[Object(n.jsx)(de.a,{value:"partial",control:Object(n.jsx)(se.a,{color:"primary"}),label:"Partial",labelPlacement:"bottom",checked:"partial"===l}),Object(n.jsx)(de.a,{value:"partial_reverse",control:Object(n.jsx)(se.a,{color:"primary"}),label:"Partial Reverse",labelPlacement:"bottom",checked:"partial_reverse"===l}),Object(n.jsx)(de.a,{value:"full",control:Object(n.jsx)(se.a,{color:"primary"}),label:"Full",labelPlacement:"bottom",checked:"full"===l}),Object(n.jsx)(de.a,{value:"full_reverse",control:Object(n.jsx)(se.a,{color:"primary"}),label:"Full Reverse",labelPlacement:"bottom",checked:"full_reverse"===l})]})})})]}),Object(n.jsx)(he,{package_names:v,network_data:O,radio_type:l,selected_id:p,searched_id:_,onChange:function(e){k(null),h(e)}}),Object(n.jsx)(me,{package_names:v,level_data:O,radio_type:l})]})}):Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})}));var xe=function(e){var t=e.data_prepared;return Object(n.jsx)(j.a,{children:Object(n.jsx)(u.a,{render:function(e){return Object(n.jsx)(b,Object(d.a)(Object(d.a)({},e),{},{deploy_url:t.metaData.DeployUrl,children:Object(n.jsx)("div",{children:Object(n.jsxs)(u.c,{children:[Object(n.jsx)(u.a,{path:"/",exact:!0,render:function(){return Object(n.jsx)(F,{meta_data:t.metaData})}}),Object(n.jsx)(u.a,{path:"/overview",render:function(){return Object(n.jsx)(F,{meta_data:t.metaData})}}),Object(n.jsx)(u.a,{path:"/dependencygraph",render:function(){return Object(n.jsx)(fe,Object(d.a)(Object(d.a)({},e),{},{app_home:t.app_home,data_home:t.data_home}))}}),Object(n.jsx)(u.a,{path:"/criticalpath",render:function(){return Object(n.jsx)(B,{critical_path:t.maxDepth})}}),Object(n.jsx)(u.a,{path:"/buildtime",render:function(){return Object(n.jsx)(E,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef,data_home:t.data_home})}}),Object(n.jsx)(u.a,{path:"/timeline",render:function(){return Object(n.jsx)(K,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef,hw_trend:t.hwTrend})}}),Object(n.jsx)(u.a,{path:"/timecompare",render:function(){return Object(n.jsx)(re,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef})}}),Object(n.jsx)(u.a,{render:function(){return Object(n.jsx)(F,{meta_data:t.metaData})}})]})})}))}})})},ve={display:"flex",alignItems:"left"};var Oe=function(){var e=Object(i.useState)(null),t=Object(s.a)(e,2),a=t[0],r=t[1],c=window.location.pathname.split("/");(c=c.splice(0,c.length-1).join("/"))&&""!==c||(c=".");var l="".concat(".");l.startsWith("./")?l=l.slice(2):l.startsWith("/")&&(l=l.slice(1));var d=c+"/"+l+"/sample_data/datasets/default/";return Object(i.useEffect)((function(){}),[]),null==a?Object(n.jsxs)("div",{className:"App",id:"outer-container",children:[Object(n.jsx)(o,{data_prepared:a,onChange:function(e){r(e)},public_data_location:d}),Object(n.jsx)("div",{style:ve,children:"Waiting..."})]}):Object(n.jsx)(xe,{data_prepared:a})};l.a.render(Object(n.jsx)(Oe,{}),document.getElementById("root"))}},[[975,1,2]]]); \ No newline at end of file diff --git a/bsr/bsr/web_dist/static/js/main.3b57cdf5.chunk.js b/bsr/bsr/web_dist/static/js/main.3b57cdf5.chunk.js deleted file mode 100644 index da72b14..0000000 --- a/bsr/bsr/web_dist/static/js/main.3b57cdf5.chunk.js +++ /dev/null @@ -1 +0,0 @@ -(this["webpackJsonptizen-build-performance"]=this["webpackJsonptizen-build-performance"]||[]).push([[0],{595:function(e,t,a){},596:function(e,t,a){},601:function(e,t,a){},843:function(e,t,a){},975:function(e,t,a){"use strict";a.r(t);var n=a(5),i=a(0),r=a.n(i),c=a(20),l=a.n(c),s=(a(595),a(35));var o=function(e){var t=Object(i.useState)({data_home:null,metaData:null,maxDepth:null,dependsLink:null,buildTime:null,buildTimeRef:null,hwTrend:null}),a=Object(s.a)(t,2),r=a[0],c=a[1],l=(r.data_home,r.metaData),o=r.maxDepth,d=r.dependsLink,j=r.buildTime,u=r.buildTimeRef,p=(r.hwTrend,e.public_data_location+"result_meta.json"),h=e.public_data_location+"max_depth.json",m=e.public_data_location+"depends_link.json",b=e.public_data_location+"buildtime.json",f=e.public_data_location+"buildtime_ref.json",x=e.public_data_location+"hw_resource.json",v=e.public_data_location+"dep_graph/default/arch/index.html";return Object(i.useEffect)((function(){Promise.all([fetch(p),fetch(h),fetch(m),fetch(b),fetch(f),fetch(x)]).then((function(e){var t=Object(s.a)(e,6),a=t[0],n=t[1],i=t[2],r=t[3],c=t[4],l=t[5];return Promise.all([a.json(),n.json(),i.json(),r.json(),c.json(),l.json()])})).then((function(t){var a=Object(s.a)(t,6),n=a[0],i=a[1],r=a[2],l=a[3],o=a[4],d=a[5];c({data_home:e.public_data_location,metaData:n,maxDepth:i,dependsLink:r,buildTime:l,buildTimeRef:o,hwTrend:d}),function(t){var a=t;a.dependsPath=v,e.onChange(a)}({data_home:e.public_data_location,metaData:n,maxDepth:i,dependsLink:r,buildTime:l,buildTimeRef:o,hwTrend:d})}))}),[]),l&&o&&d&&j&&u?Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"All data prepared..."})}):Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})},d=(a(596),a(71)),j=a(108),u=a(44),p=a(1032);a(435);var h=a(113);var m=function(e){return Object(n.jsx)(p.a,{compact:!0,icon:"labeled",secondary:!0,title:"Full Screen",children:Object(n.jsxs)(p.a.Item,{name:"fullscreen",active:!1,onClick:function(t,a){a.name;return function(t){var a=window.location.hostname,n=window.location.href.split(a)[0]+a+window.location.href.split(a)[1].split("/")[0]+"/"+e.deploy_url+"/index.html";window.open(n,"_blank")}()},children:[Object(n.jsx)(h.a,{name:"fullscreen"}),Object(n.jsx)("div",{style:{marginTop:"-5px"},children:"\xa0"})]})})};var b=function(e,t){var a=t.defaultActive,r=e.history.location,c=(localStorage.getItem("lastActiveItem"),Object(i.useState)({activeItem:a})),l=Object(s.a)(c,2),o=l[0],d=l[1],j=o.activeItem;Object(i.useEffect)((function(){d({activeItem:r.pathname})}),[r]);var u=function(t,a){return function(t){e.history.push({pathname:t})}(a.name)};return Object(n.jsxs)(p.a,{compact:!0,icon:"labeled",pointing:!0,secondary:!0,children:[Object(n.jsxs)(p.a.Item,{name:"/overview",active:"/overview"===j,onClick:u,children:[Object(n.jsx)(h.f,{name:"/overview"}),Object(n.jsx)("div",{style:{display:"flex",paddingTop:"5px"},children:"Overview"})]}),Object(n.jsxs)(p.a.Item,{name:"/dependencygraph",active:"/dependencygraph"===j,onClick:u,children:[Object(n.jsx)(h.b,{name:"/dependencygraph"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Dependency"})]}),Object(n.jsxs)(p.a.Item,{name:"/criticalpath",active:"/criticalpath"===j,onClick:u,children:[Object(n.jsx)(h.g,{name:"/criticalpath"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Critical Path"})]}),Object(n.jsxs)(p.a.Item,{name:"/buildtime",active:"/buildtime"===j,onClick:u,children:[Object(n.jsx)(h.d,{name:"/buildtime"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Build Time"})]}),Object(n.jsxs)(p.a.Item,{name:"/timeline",active:"/timeline"===j,onClick:u,children:[Object(n.jsx)(h.e,{name:"/timeline"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Timeline"})]}),Object(n.jsxs)(p.a.Item,{name:"/timecompare",active:"/timecompare"===j,onClick:u,children:[Object(n.jsx)(h.c,{name:"/timecompare"}),Object(n.jsx)("div",{style:{paddingTop:"5px"},children:"Compare"})]}),Object(n.jsx)(m,{deploy_url:e.deploy_url})]})};var f=function(e){return Object(n.jsxs)("div",{children:[Object(n.jsx)(b,{deploy_url:e.deploy_url,history:e.history}),Object(n.jsx)("div",{style:{display:"flex",margin:"5px"},children:Object(n.jsx)("div",{style:{backgroundColor:"#F4F6F6",width:"100%",height:"100vh",marginLeft:"10px"},children:Object(n.jsx)("div",{style:{backgroundColor:"#F4F6F6"},children:e.children})})})]})},x=a(436),v=a(1017),O=a(1019),g=a(144),y=a(154),_=a(1016),k=a(355),w=Object(x.a)({root:{minWidth:275},bullet:{display:"inline-block",margin:"0 2px",transform:"scale(0.8)"},title:{fontSize:14},pos:{marginBottom:12}}),T=Object(y.a)({typography:{fontFamily:["-apple-system","SFMono-Regular","Menlo,Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"].join(",")}});function D(e){var t,a,i=w();return"1"===e.happy?a="#0acf97":"0"===e.happy&&(a="#fa5c7c"),"+"===e.diff?t=Object(n.jsx)(k.b,{}):"-"===e.diff&&(t=Object(n.jsx)(k.a,{})),Object(n.jsx)("div",{style:{margin:"10px"},children:Object(n.jsx)(_.a,{theme:T,children:Object(n.jsx)(v.a,{className:i.root,variant:"outlined",children:Object(n.jsxs)(O.a,{children:[Object(n.jsx)(g.a,{variant:"h6",component:"h6",color:"textSecondary",children:e.title}),Object(n.jsx)(g.a,{className:i.pos,color:"textSecondary"}),Object(n.jsx)(g.a,{variant:"h4",component:"h4",color:"textSecondary",children:Object(n.jsx)("b",{children:e.value})}),Object(n.jsx)("div",{style:{display:"flex",marginTop:"10px"},children:Object(n.jsxs)("div",{style:{display:"flex",marginTop:"10px"},children:[Object(n.jsx)("span",{style:{color:a},children:Object(n.jsx)("div",{style:{marginTop:"5px",paddingRight:"5px"},children:Object(n.jsx)(g.a,{variant:"body1",component:"p",color:"inherit",children:t})})}),Object(n.jsx)("span",{style:{color:a},children:Object(n.jsx)("div",{children:e.diff_value})}),Object(n.jsx)("div",{style:{paddingLeft:"5px"},children:" Since reference"})]})})]})})})})}var F=Object(u.f)((function(e){var t=e.meta_data;function a(e){e<0&&(e=0-e),e=Number(e/1e3);var t=Math.floor(e/3600),a=Math.floor(e%3600/60),n=Math.floor(e%3600%60);return t<10&&(t="0"+t),a<10&&(a="0"+a),n<10&&(n="0"+n),t+":"+a+":"+n}if(t){var i={total:{check:"",val:"0",happy:""},time:{check:"",val:"0",happy:""},pass:{check:"",val:"0",happy:""},fail:{check:"",val:"0",happy:""}},r=a(t.BuildDetail.RunTime);return i.total.val=t.BuildDetail.Total-t.ReferenceDetail.Total,t.BuildDetail.Total>t.ReferenceDetail.Total?(i.total.check="+",i.total.happy="0"):t.BuildDetail.Totalt.ReferenceDetail.Pass?(i.pass.check="+",i.pass.happy="1"):t.BuildDetail.Passt.ReferenceDetail.Fail&&(i.fail.check="-",i.fail.happy="0"),i.time.val=a(t.BuildDetail.RunTime-t.ReferenceDetail.RunTime),t.BuildDetail.RunTimet.ReferenceDetail.RunTime&&(i.time.check="+",i.time.happy="0"),Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)("div",{style:{padding:"20px"},children:[Object(n.jsxs)("div",{style:{display:"flex"},children:[Object(n.jsx)(D,{title:"Total Packages",value:t.BuildDetail.Total,diff:i.total.check,diff_value:i.total.val,happy:i.total.happy}),Object(n.jsx)(D,{title:"Build Time",value:r,diff:i.time.check,diff_value:i.time.val,happy:i.time.happy})]}),Object(n.jsxs)("div",{style:{display:"flex"},children:[Object(n.jsx)(D,{title:"Pass",value:t.BuildDetail.Pass,diff:i.pass.check,diff_value:i.pass.val,happy:i.pass.happy}),Object(n.jsx)(D,{title:"Fail",value:t.BuildDetail.Fail,diff:i.fail.check,diff_value:i.fail.val,happy:i.fail.happy})]})]})})}return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})}));var S=Object(u.f)((function(e){return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:Object(n.jsx)(F,{meta_data:e.meta_data})})})})),C=(a(601),a(286)),R=function(e){console.log("flow loaded:",e),e.fitView()},P={30:"#DCEDC8",180:"#AED581",300:"#8BC34A",600:"#4FC3F7",900:"#03A9F4",1200:"#F7DC6F",1800:"#FFEB3B",2700:"#FBC02D",3e3:"#FF6F00",3600:"#F44336"},B=Object.keys(P).reverse();function I(e){var t,a=0,n=0;return e/60/60>0&&(a=parseInt(e/60/60)),e/60-60*a>0&&(n=parseInt(e/60-60*a)),t=e-60*a*60-60*n,a>0?a+"h "+n+"m "+t+"s":n>0?n+"m "+t+"s":t+"s"}var L=function(e){for(var t=e.critical_path,a=[],i=0;iparseInt(B[a])){t=P[B[a]];break}return t},s=0;su)&&(o=u),(null===d||d=m.length-1||(m[w].cpu=T,m[w].memory=D))}return Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)(z.Chart,{scale:{cpu:{alias:"CPU (%)_____________",tickCount:5,min:0,type:"linear-strict"},memory:{alias:"___________Mem (GB)",tickCount:5,min:0,type:"linear-strict"},threads:{alias:"Running Threads (No.)",tickCount:5,min:0,type:"linear-strict"},time:{alias:"Time (seconds) ",type:"timeCat",mask:"YYYY-MM-DD HH:mm:ss"}},autoFit:!0,height:200,data:m,area:!0,onGetG2Instance:function(e){i=e},children:[Object(n.jsx)(z.Axis,{name:"threads",title:!0}),Object(n.jsx)(z.Axis,{name:"cpu",title:!0}),Object(n.jsx)(z.Axis,{name:"memory",title:!0}),Object(n.jsx)(z.Axis,{name:"time",title:!0,label:c}),Object(n.jsx)(z.Legend,{custom:!0,allowAllCanceled:!0,items:[{value:"threads",name:"No. of threads",marker:{symbol:"hyphen",style:{stroke:r[0],r:5,lineWidth:3}}},{value:"memory",name:"Memory usage (GB)",marker:{symbol:"hyphen",style:{stroke:r[2],r:5,lineWidth:3}}},{value:"cpu",name:"CPU usage (%)",marker:{symbol:"hyphen",style:{stroke:r[1],r:5,lineWidth:3}}}],onChange:function(e){for(var t=e.item,a=t.value,n=!t.unchecked,r=i.geometries,c=0;c1&&void 0!==arguments[1]?arguments[1]:0,n=3735928559^a,i=1103547991^a,r=0;r>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&(i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(e+e);return"#"+((255&t)>>0).toString(16).padStart(2,"0")+((16711680&t)>>16).toString(16).padStart(2,"0")+((65280&t)>>8).toString(16).padStart(2,"0")}var V=Object(u.f)((function(e){var t=e.build_time,a=e.hw_trend,r=Object(i.useRef)(null),c=Object(i.useRef)(null),l=function(e){var t=[{group:"",data:[]}],a=[],n=null,i=null;for(var r in e){var c=e[r].thread;a.includes(c)||(a.push(c),t[0].data.push({label:"".concat(c),data:[]}));var l=new Date(e[r].start).getTime(),s=new Date(e[r].end).getTime();(null===n||li)&&(i=s)}for(var r in e){var o=e[r].thread,d=new Date(e[r].start).getTime(),j=new Date(e[r].end).getTime(),u=a.indexOf(o);t[0].data[u].data.push({timeRange:[d,j],val:r})}return{data:t,min_start:n}}(e.build_time),s=l.data,o=l.min_start,d=Object(H.a)().domain(Object.keys(t).sort()).range(Object.keys(t).sort().map((function(e){return K(e)})));return Object(i.useEffect)((function(){c.current=(new G.a).data(s)(r.current),c.current.zColorScale(d).xTickFormat((function(e){return parseInt((e.getTime()-o)/1e3/60)+"\ubd84"})).width(1300).timeFormat("%H:%M:%S").segmentTooltipContent((function(e){return function(e){var t=e.val,a=e.timeRange[0],n=e.timeRange[1];return"[ "+t+" ]
Duration "+(n.getTime()-a.getTime())/1e3+" sec.
Thread: "+e.label+"
Start: "+a.toLocaleTimeString()+"
End: "+n.toLocaleTimeString()}(e)}))}),[]),Object(i.useEffect)((function(){})),Object(n.jsxs)(n.Fragment,{children:[Object(n.jsx)("div",{style:{margin:"10px",padding:"10px"},children:Object(n.jsx)("div",{children:Object(n.jsx)(g.a,{variant:"h6",component:"h6",color:"textSecondary",children:"This is a chart showing the distribution of overall package build times."})})}),Object(n.jsx)("div",{style:{width:"1210px",marginLeft:"5px"},children:Object(n.jsx)("div",{ref:r})}),Object(n.jsx)("div",{style:{width:"1210px",marginLeft:"50px"},children:Object(n.jsx)(Y,{build_time:t,hw_trend:a})})]})})),J=a(545),Q=a(546),q=a(547),X=a(565),Z=a(1033),$=a(1031),ee=a(560),te=a(561),ae=a(288),ne=a(213),ie=a(566),re=function(e){Object(q.a)(a,e);var t=Object(X.a)(a);function a(){return Object(J.a)(this,a),t.apply(this,arguments)}return Object(Q.a)(a,[{key:"render",value:function(){var e=this.props,t=e.x,a=e.y,i=(e.stroke,e.payload);return Object(n.jsx)("g",{transform:"translate(".concat(t,",").concat(a,")"),children:Object(n.jsx)("text",{x:0,y:0,dy:4,textAnchor:"end",fill:"#666",fontSize:12,transform:"rotate(-35)",children:i.value})})}}]),a}(i.PureComponent);var ce=Object(u.f)((function(e){var t=e.build_time,a=e.build_time_ref;if(t&&a){var i=[];for(var r in t){var c=0;r in a&&(c=a[r].duration),i.push({name:t[r].package,current:parseInt(t[r].duration),reference:parseInt(c)})}var l=[].concat(i).sort((function(e,t){return(e.current-e.reference)*(e.current-e.reference)>(t.current-t.reference)*(t.current-t.reference)?-1:1}));return l=l.slice(0,40).sort((function(e,t){return e.current>t.current?-1:1})),Object(n.jsxs)(n.Fragment,{children:[Object(n.jsx)("div",{style:{margin:"10px",padding:"10px"},children:Object(n.jsx)("div",{children:Object(n.jsxs)(g.a,{variant:"h6",component:"h6",color:"textSecondary",children:["This graph shows the top ",40," packages with a large time difference from the previous build."]})})}),Object(n.jsxs)(Z.a,{width:1e3,height:500,margin:{top:50,right:10,left:10,bottom:10},data:l,barCategoryGap:3,barGap:0,children:[Object(n.jsx)($.a,{strokeDasharray:"3 3"}),Object(n.jsx)(ee.a,{dataKey:"name",interval:0,tick:Object(n.jsx)(re,{})}),Object(n.jsx)(te.a,{}),Object(n.jsx)(ae.a,{}),Object(n.jsx)(ne.a,{wrapperStyle:{top:10,left:25}}),Object(n.jsx)(ie.a,{dataKey:"current",fill:"#EC951F"}),Object(n.jsx)(ie.a,{dataKey:"reference",fill:"#82ca9d"})]})]})}return Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})})),le=a(485),se=a(474),oe=a(1034),de=a(478),je=a(475),ue=a(348),pe=a(562);function he(e,t){var a=e;return e<300+6*t&&(a=300+6*t),a}var me=function(e){var t=null,a=Object(i.useRef)(null),r=Object(i.useRef)(null),c=function(e,t,a,n){var i={nodes:[],edges:[],max_y_offset:0},r="p";"partial"===e?r="p":"partial_reverse"===e?r="pr":"full"===e?r="f":"full_reverse"===e&&(r="fr");for(var c=0;c=0&&(t=r.current.getConnectedNodes(e),a=r.current.getConnectedEdges(e));var n=c.nodes.map((function(a){return-1===e||e===a.id||t.includes(a.id)?Object(d.a)(Object(d.a)({},a),{},{color:void 0}):Object(d.a)(Object(d.a)({},a),{},{color:"#F2F3F4"})})),i=c.edges.map((function(t){return-1===e||e===t.id||a.includes(t.id)?Object(d.a)(Object(d.a)({},t),{},{hidden:!1}):Object(d.a)(Object(d.a)({},t),{},{hidden:!0})}));e>=0&&r.current.focus(e,o),r.current.body.data.nodes.update(n),r.current.body.data.edges.update(i)}return Object(i.useEffect)((function(){r.current=new pe.a(a.current,c,l)}),[a,r,c,l]),Object(i.useEffect)((function(){e.searched_id&&j(e.searched_id),r.current.on("select",(function(e){var a=e.nodes;1!==t&&setTimeout((function(){1!==t?a.length>0?j(a[0]):j(-1):t=null}),200)})),r.current.on("doubleClick",(function(a){var n=a.nodes;t=1,e.onChange(n[0])}))})),Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:Object(n.jsx)("div",{style:{height:c.max_y_offset.toString()+"px"},ref:a})})})};var be=function(e){var t="p";"partial"===e.radio_type?t="p":"partial_reverse"===e.radio_type?t="pr":"full"===e.radio_type?t="f":"full_reverse"===e.radio_type&&(t="fr");for(var a=[],i=0;i *":{margin:e.spacing(1),width:"25ch"}}}}));var xe=Object(u.f)((function(e){var t=fe(),a=r.a.useState("partial"),c=Object(s.a)(a,2),l=c[0],o=c[1],d=e.selected_id;d||(d=9999);var j=r.a.useState(d),u=Object(s.a)(j,2),p=u[0],h=u[1],m=Object(i.useState)({packageNameData:null,singlePackageData:null}),b=Object(s.a)(m,2),f=b[0],x=b[1],v=f.packageNameData,O=f.singlePackageData,g=r.a.useState(null),y=Object(s.a)(g,2),_=y[0],k=y[1],w=Object(i.useRef)(null);return Object(i.useEffect)((function(){!function(){var t=e.data_home+"networks/package_names.json",a=e.data_home+"networks/"+p+".json";Promise.all([fetch(t),fetch(a)]).then((function(e){var t=Object(s.a)(e,2),a=t[0],n=t[1];return Promise.all([a.json(),n.json()])})).then((function(e){var t=Object(s.a)(e,2),a=t[0],n=t[1];return x({packageNameData:a,singlePackageData:n})}))}()}),[p]),v&&O?Object(n.jsx)(n.Fragment,{children:Object(n.jsxs)("div",{children:[Object(n.jsxs)("div",{style:{display:"flex",margin:"10px"},children:[Object(n.jsx)("div",{children:Object(n.jsx)("div",{style:{display:"flex",margin:"10px"},children:Object(n.jsxs)("div",{className:t.root,noValidate:!0,autoComplete:"off",children:[Object(n.jsx)(le.a,{id:"standard-basic",label:"Package Name",inputRef:w}),Object(n.jsx)(se.a,{style:{marginTop:"20px"},variant:"outlined",color:"primary",onClick:function(){k(v.indexOf(w.current.value))},children:"Search"})]})})}),Object(n.jsx)("div",{style:{marginLeft:"50px",border:"1px solid #cdcdcd"},children:Object(n.jsx)(ue.a,{component:"fieldset",style:{width:"100%"},children:Object(n.jsxs)(de.a,{row:!0,"aria-label":"position",name:"position",defaultValue:"top",value:l,onChange:function(e){o(e.target.value)},children:[Object(n.jsx)(je.a,{value:"partial",control:Object(n.jsx)(oe.a,{color:"primary"}),label:"Partial",labelPlacement:"bottom",checked:"partial"===l}),Object(n.jsx)(je.a,{value:"partial_reverse",control:Object(n.jsx)(oe.a,{color:"primary"}),label:"Partial Reverse",labelPlacement:"bottom",checked:"partial_reverse"===l}),Object(n.jsx)(je.a,{value:"full",control:Object(n.jsx)(oe.a,{color:"primary"}),label:"Full",labelPlacement:"bottom",checked:"full"===l}),Object(n.jsx)(je.a,{value:"full_reverse",control:Object(n.jsx)(oe.a,{color:"primary"}),label:"Full Reverse",labelPlacement:"bottom",checked:"full_reverse"===l})]})})})]}),Object(n.jsx)(me,{package_names:v,network_data:O,radio_type:l,selected_id:p,searched_id:_,onChange:function(e){k(null),h(e)}}),Object(n.jsx)(be,{package_names:v,level_data:O,radio_type:l})]})}):Object(n.jsx)(n.Fragment,{children:Object(n.jsx)("div",{children:"Loading..."})})}));var ve=function(e){var t=e.data_prepared;return Object(n.jsx)(j.a,{children:Object(n.jsx)(u.a,{render:function(e){return Object(n.jsx)(f,Object(d.a)(Object(d.a)({},e),{},{deploy_url:t.metaData.DeployUrl,children:Object(n.jsx)("div",{children:Object(n.jsxs)(u.c,{children:[Object(n.jsx)(u.a,{path:"/",exact:!0,render:function(){return Object(n.jsx)(S,{meta_data:t.metaData})}}),Object(n.jsx)(u.a,{path:"/overview",render:function(){return Object(n.jsx)(S,{meta_data:t.metaData})}}),Object(n.jsx)(u.a,{path:"/dependencygraph",render:function(){return Object(n.jsx)(xe,Object(d.a)(Object(d.a)({},e),{},{app_home:t.app_home,data_home:t.data_home}))}}),Object(n.jsx)(u.a,{path:"/criticalpath",render:function(){return Object(n.jsx)(L,{critical_path:t.maxDepth})}}),Object(n.jsx)(u.a,{path:"/buildtime",render:function(){return Object(n.jsx)(N,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef,data_home:t.data_home})}}),Object(n.jsx)(u.a,{path:"/timeline",render:function(){return Object(n.jsx)(V,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef,hw_trend:t.hwTrend})}}),Object(n.jsx)(u.a,{path:"/timecompare",render:function(){return Object(n.jsx)(ce,{meta_data:t.metaData,build_time:t.buildTime,build_time_ref:t.buildTimeRef})}}),Object(n.jsx)(u.a,{render:function(){return Object(n.jsx)(S,{meta_data:t.metaData})}})]})})}))}})})},Oe={display:"flex",alignItems:"left"};var ge=function(){var e=Object(i.useState)(null),t=Object(s.a)(e,2),a=t[0],r=t[1],c=window.location.pathname.split("/");(c=c.splice(0,c.length-1).join("/"))&&""!==c||(c=".");var l="".concat(".");l.startsWith("./")?l=l.slice(2):l.startsWith("/")&&(l=l.slice(1));var d=c+"/"+l+"/sample_data/datasets/default/";return Object(i.useEffect)((function(){}),[]),null==a?Object(n.jsxs)("div",{className:"App",id:"outer-container",children:[Object(n.jsx)(o,{data_prepared:a,onChange:function(e){r(e)},public_data_location:d}),Object(n.jsx)("div",{style:Oe,children:"Waiting..."})]}):Object(n.jsx)(ve,{data_prepared:a})};l.a.render(Object(n.jsx)(ge,{}),document.getElementById("root"))}},[[975,1,2]]]); \ No newline at end of file