示例#1
0
文件: sod.py 项目: dotnet/performance
 def __init__(self):
     if helixpayload() and os.path.exists(os.path.join(helixpayload(), 'SOD')):
         self._setsodpath(os.path.join(helixpayload(), 'SOD'))
     elif helixworkitempayload() and os.path.exists(os.path.join(helixworkitempayload(), 'SOD')):
         self._setsodpath(os.path.join(helixworkitempayload(), 'SOD'))
     else:
         relpath = os.path.join(get_artifacts_directory(), 'SOD')
         sodproj = os.path.join('..',
                                    '..',
                                    'tools',
                                    'ScenarioMeasurement',
                                    'SizeOnDisk',
                                    'SizeOnDisk.csproj')
         sod = CSharpProject(CSharpProjFile(sodproj,
                                                sys.path[0]),
                                                os.path.join(os.path.dirname(sodproj),
                                 os.path.join(get_artifacts_directory(), 'SOD')))
         if not os.path.exists(relpath):
             sod.restore(get_packages_directory(),
                             True,
                             getruntimeidentifier())
             sod.publish('Release',
                             relpath,
                             True,
                             get_packages_directory(),
                             None,
                             getruntimeidentifier(),
                             None, 
                             '--no-restore'
                             )
         self._setsodpath(sod.bin_path)
示例#2
0
 def __init__(self):
     startupdir = 'startup'
     self.reportjson = os.path.join(TRACEDIR, 'perf-lab-report.json')
     if helixpayload() and os.path.exists(os.path.join(helixpayload(), startupdir)):
         self._setstartuppath(os.path.join(helixpayload(), startupdir))
     elif helixworkitempayload() and os.path.exists(os.path.join(helixworkitempayload(), startupdir)):
         self._setstartuppath(os.path.join(helixworkitempayload(), startupdir))
     else:
         relpath = os.path.join(get_artifacts_directory(), startupdir)
         startupproj = os.path.join('..',
                                    '..',
                                    'tools',
                                    'ScenarioMeasurement',
                                    'Startup',
                                    'Startup.csproj')
         startup = CSharpProject(CSharpProjFile(startupproj,
                                                sys.path[0]),
                                                os.path.join(os.path.dirname(startupproj),
                                                os.path.join(get_artifacts_directory(), startupdir)))
         if not os.path.exists(relpath):
             startup.restore(get_packages_directory(),
                             True,
                             getruntimeidentifier())
             startup.publish('Release',
                             relpath,
                             True,
                             get_packages_directory(),
                             None,
                             getruntimeidentifier(),
                             None,
                             '--no-restore'
                             )
         self._setstartuppath(startup.bin_path)
示例#3
0
def __get_benchmarkdotnet_arguments(framework: str, args: tuple) -> list:
    run_args = ['--']
    if args.corerun:
        run_args += ['--coreRun'] + args.corerun
    if args.cli:
        run_args += ['--cli', args.cli]
    if args.enable_pmc:
        run_args += [
            '--counters',
            'BranchMispredictions+CacheMisses+InstructionRetired',
        ]
    if args.filter:
        run_args += ['--filter'] + args.filter

    # Extra BenchmarkDotNet cli arguments.
    if args.bdn_arguments:
        run_args += args.bdn_arguments

    if args.bdn_artifacts:
        run_args += ['--artifacts', args.bdn_artifacts] 

    # we need to tell BenchmarkDotNet where to restore the packages
    # if we don't it's gonna restore to default global folder
    run_args += ['--packages', get_packages_directory()]

    # Required for CoreRT where:
    #   host process framework != benchmark process framework
    if args.wasm:
        run_args += ['--runtimes', 'wasm']
    else:
        run_args += ['--runtimes', framework]

    return run_args
示例#4
0
def build(
        BENCHMARKS_CSPROJ: dotnet.CSharpProject,
        configuration: str,
        target_framework_monikers: list,
        incremental: str,
        verbose: bool) -> None:
    '''Restores and builds the benchmarks'''

    packages = get_packages_directory()

    if incremental == 'no':
        __log_script_header("Removing packages, bin and obj folders.")
        binary_folders = [
            packages,
            path.join(BENCHMARKS_CSPROJ.bin_path),
        ]
        for binary_folder in binary_folders:
            remove_directory(path=binary_folder)

    # dotnet restore
    __log_script_header("Restoring .NET micro benchmarks")
    BENCHMARKS_CSPROJ.restore(packages_path=packages, verbose=verbose)

    # dotnet build
    build_title = "Building .NET micro benchmarks for '{}'".format(
        ' '.join(target_framework_monikers))
    __log_script_header(build_title)
    BENCHMARKS_CSPROJ.build(
        configuration=configuration,
        target_framework_monikers=target_framework_monikers,
        verbose=verbose,
        packages_path=packages)
示例#5
0
def __get_benchmarkdotnet_arguments(framework: str, args: tuple) -> list:
    run_args = ['--']
    if args.corerun:
        run_args += ['--coreRun'] + args.corerun
    if args.cli:
        run_args += ['--cli', args.cli]
    if args.enable_pmc:
        run_args += [
            '--counters',
            'BranchMispredictions+CacheMisses+InstructionRetired',
        ]
    if args.filter:
        run_args += ['--filter'] + args.filter

    # Extra BenchmarkDotNet cli arguments.
    if args.bdn_arguments:
        run_args += args.bdn_arguments

    if args.bdn_artifacts:
        run_args += ['--artifacts', args.bdn_artifacts] 

    # we need to tell BenchmarkDotNet where to restore the packages
    # if we don't it's gonna restore to default global folder
    run_args += ['--packages', get_packages_directory()]

    # Required for CoreRT where:
    #   host process framework != benchmark process framework
    if args.wasm:
        run_args += ['--runtimes', 'wasm']

    # Increase default 2 min build timeout to accommodate slow (or even very slow) hardware
    if not args.bdn_arguments or '--buildTimeout' not in args.bdn_arguments:
    	run_args += ['--buildTimeout', '600']

    return run_args
示例#6
0
 def _publish(self, configuration: str, framework: str = None, runtime_identifier: str = None):
     self.project.publish(configuration=configuration,
                          output_dir=const.PUBDIR, 
                          verbose=True,
                          packages_path=os.path.join(get_packages_directory(), ''), # blazor publish targets require the trailing slash for joining the paths
                          target_framework_moniker=framework,
                          runtime_identifier=runtime_identifier
                          )
示例#7
0
 def _publish(self, configuration: str, framework: str = None, runtime_identifier: str = None):
     self.project.publish(configuration,
                          const.PUBDIR, 
                          True,
                          os.path.join(get_packages_directory(), ''), # blazor publish targets require the trailing slash for joining the paths
                          framework,
                          runtime_identifier,
                          self.msbuild or "",
                          '-bl:%s' % self.binlog if self.binlog else ""
                          )
示例#8
0
 def __init__(self):
     payload = helixpayload()
     if payload:
         self._setstartuppath(os.path.join(payload, 'Startup'))
     else:
         startupproj = os.path.join('..', '..', 'tools',
                                    'ScenarioMeasurement', 'Startup',
                                    'Startup.csproj')
         startup = CSharpProject(
             CSharpProjFile(startupproj, sys.path[0]),
             os.path.join(
                 os.path.dirname(startupproj),
                 os.path.join(get_artifacts_directory(), 'startup')))
         startup.restore(get_packages_directory(), True)
         startup.build(configuration='Release',
                       verbose=True,
                       packages_path=get_packages_directory(),
                       output_to_bindir=True)
         self._setstartuppath(startup.bin_path)
示例#9
0
 def _publish(self,
              configuration: str,
              framework: str = None,
              runtime_identifier: str = None):
     self.project.publish(configuration=configuration,
                          output_dir=const.PUBDIR,
                          verbose=True,
                          packages_path=get_packages_directory(),
                          target_framework_moniker=framework,
                          runtime_identifier=runtime_identifier)
示例#10
0
 def _build(self,
            configuration: str,
            framework: str = None,
            build_args: list = []):
     self.project.build(configuration=configuration,
                        verbose=True,
                        packages_path=get_packages_directory(),
                        target_framework_monikers=[framework],
                        output_to_bindir=True,
                        *build_args)
示例#11
0
    def __init__(self):
        payload = helixpayload()
        if payload:
            self._setstartuppath(os.path.join(payload, 'Startup'))
        else:
            startupproj = os.path.join('..', '..', 'tools',
                                       'ScenarioMeasurement', 'Startup',
                                       'Startup.csproj')
            startup = CSharpProject(
                CSharpProjFile(startupproj, sys.path[0]),
                os.path.join(
                    os.path.dirname(startupproj),
                    os.path.join(get_artifacts_directory(), 'startup')))

            startup.restore(get_packages_directory(), True,
                            getruntimeidentifier())
            startup.publish('Release',
                            os.path.join(get_artifacts_directory(), 'startup'),
                            True, get_packages_directory(), None,
                            getruntimeidentifier(), '--no-restore')
            self._setstartuppath(startup.bin_path)
示例#12
0
 def __init__(self):
     payload_startup = os.path.join(helixpayload(), 'Startup')
     workitem_startup = os.path.join(helixworkitempayload(), 'Startup')
     if os.path.exists(payload_startup):
         self._setstartuppath(payload_startup)
     elif os.path.exists(workitem_startup):
         self._setstartuppath(workitem_startup)
     else:
         relpath = os.path.join(get_artifacts_directory(), 'startup')
         startupproj = os.path.join('..', '..', 'tools',
                                    'ScenarioMeasurement', 'Startup',
                                    'Startup.csproj')
         startup = CSharpProject(
             CSharpProjFile(startupproj, sys.path[0]),
             os.path.join(
                 os.path.dirname(startupproj),
                 os.path.join(get_artifacts_directory(), 'startup')))
         if not os.path.exists(relpath):
             startup.restore(get_packages_directory(), True,
                             getruntimeidentifier())
             startup.publish('Release', relpath, True,
                             get_packages_directory(), None,
                             getruntimeidentifier(), '--no-restore')
         self._setstartuppath(startup.bin_path)
示例#13
0
 def _publish(self,
              configuration: str,
              framework: str = None,
              runtime_identifier: str = None,
              build_args: list = []):
     self.project.publish(
         configuration,
         const.PUBDIR,
         True,
         os.path.join(
             get_packages_directory(), ''
         ),  # blazor publish targets require the trailing slash for joining the paths
         framework if not self.windows else f'{framework}-windows',
         runtime_identifier,
         self._parsemsbuildproperties(),
         '-bl:%s' % self.binlog if self.binlog else "",
         *build_args)
示例#14
0
def build(BENCHMARKS_CSPROJ: dotnet.CSharpProject, configuration: str,
          target_framework_monikers: list, incremental: str,
          run_isolated: bool, verbose: bool) -> None:
    '''Restores and builds the benchmarks'''

    packages = get_packages_directory()

    if incremental == 'no':
        __log_script_header("Removing packages, bin and obj folders.")
        binary_folders = [
            packages,
            path.join(BENCHMARKS_CSPROJ.bin_path),
        ]
        for binary_folder in binary_folders:
            remove_directory(path=binary_folder)

    # dotnet restore
    __log_script_header("Restoring .NET micro benchmarks")
    BENCHMARKS_CSPROJ.restore(packages_path=packages, verbose=verbose)

    # dotnet build
    build_title = "Building .NET micro benchmarks for '{}'".format(
        ' '.join(target_framework_monikers))
    __log_script_header(build_title)
    BENCHMARKS_CSPROJ.build(
        configuration=configuration,
        target_framework_monikers=target_framework_monikers,
        output_to_bindir=run_isolated,
        verbose=verbose,
        packages_path=packages)

    # When running isolated, artifacts/obj/{project_name} will still be
    # there, and would interfere with any subsequent builds. So, remove
    # that
    if run_isolated:
        objDir = path.join(get_artifacts_directory(), 'obj',
                           BENCHMARKS_CSPROJ.project_name)
        remove_directory(objDir)
示例#15
0
 def _restore(self):
     self.project.restore(packages_path=get_packages_directory(), verbose=True)
示例#16
0
 def _build(self, configuration: str):
     self.project.build(configuration=configuration,
                        verbose=True,
                        packages_path=get_packages_directory(),
                        target_framework_monikers=None,
                        output_to_bindir=True)
示例#17
0
 def _publish(self, configuration: str):
     self.project.publish(configuration=configuration,
                          output_dir=const.PUBDIR,
                          verbose=True,
                          packages_path=get_packages_directory())