示例#1
0
def __main(args: list) -> int:
    validate_supported_runtime()
    args = __process_arguments(args)
    verbose = not args.quiet
    setup_loggers(verbose=verbose)

    # This validation could be cleaner
    if args.generate_benchview_data and not args.benchview_submission_name:
        raise RuntimeError("""In order to generate BenchView data,
            `--benchview-submission-name` must be provided.""")

    target_framework_monikers = micro_benchmarks \
        .FrameworkAction \
        .get_target_framework_monikers(args.frameworks)
    # Acquire necessary tools (dotnet, and BenchView)
    init_tools(architecture=args.architecture,
               dotnet_versions=args.dotnet_versions,
               target_framework_monikers=target_framework_monikers,
               verbose=verbose)

    # WORKAROUND
    # The MicroBenchmarks.csproj targets .NET Core 2.0, 2.1, 2.2 and 3.0
    # to avoid a build failure when using older frameworks (error NETSDK1045:
    # The current .NET SDK does not support targeting .NET Core $XYZ)
    # we set the TFM to what the user has provided.
    os.environ['PYTHON_SCRIPT_TARGET_FRAMEWORKS'] = ';'.join(
        target_framework_monikers)

    # dotnet --info
    dotnet.info(verbose=verbose)

    BENCHMARKS_CSPROJ = dotnet.CSharpProject(project=args.csprojfile,
                                             bin_directory=args.bin_directory)

    if not args.run_only:
        # .NET micro-benchmarks
        # Restore and build micro-benchmarks
        micro_benchmarks.build(BENCHMARKS_CSPROJ, args.configuration,
                               target_framework_monikers, args.incremental,
                               verbose)

    # Run micro-benchmarks
    if not args.build_only:
        for framework in args.frameworks:
            micro_benchmarks.run(BENCHMARKS_CSPROJ, args.configuration,
                                 framework, verbose, args)

        benchview.run_scripts(args, verbose, BENCHMARKS_CSPROJ)

        if args.upload_to_perflab_container:
            if args.architecture == 'arm64':
                globpath = os.path.join(
                    get_artifacts_directory() if not args.bdn_artifacts else
                    args.bdn_artifacts, '**', '*perf-lab-report.json')

                upload.upload(globpath, 'results', 'PERFLAB_UPLOAD_TOKEN',
                              'pvscmdupload.blob.core.windows.net')
            else:
                AzCopy.upload_results('', args.bdn_artifacts, verbose=verbose)
示例#2
0
def __main(args: list) -> int:
    validate_supported_runtime()
    args = __process_arguments(args)
    verbose = not args.quiet
    setup_loggers(verbose=verbose)

    # This validation could be cleaner
    if args.generate_benchview_data and not args.benchview_submission_name:
        raise RuntimeError("""In order to generate BenchView data,
            `--benchview-submission-name` must be provided.""")

    target_framework_monikers = micro_benchmarks \
        .FrameworkAction \
        .get_target_framework_monikers(args.frameworks)
    # Acquire necessary tools (dotnet, and BenchView)
    init_tools(architecture=args.architecture,
               target_framework_monikers=target_framework_monikers,
               verbose=verbose)

    # WORKAROUND
    # The MicroBenchmarks.csproj targets .NET Core 2.0, 2.1, 2.2 and 3.0
    # to avoid a build failure when using older frameworks (error NETSDK1045:
    # The current .NET SDK does not support targeting .NET Core $XYZ)
    # we set the TFM to what the user has provided.
    os.environ['PYTHON_SCRIPT_TARGET_FRAMEWORKS'] = ';'.join(
        target_framework_monikers)

    # dotnet --info
    dotnet.info(verbose=verbose)

    BENCHMARKS_CSPROJ = dotnet.CSharpProject(project=args.csprojfile,
                                             bin_directory=args.bin_directory)

    if not args.run_only:
        # .NET micro-benchmarks
        # Restore and build micro-benchmarks
        micro_benchmarks.build(BENCHMARKS_CSPROJ, args.configuration,
                               target_framework_monikers, args.incremental,
                               verbose)

    # Run micro-benchmarks
    if not args.build_only:
        for framework in args.frameworks:
            micro_benchmarks.run(BENCHMARKS_CSPROJ, args.configuration,
                                 framework, verbose, args)

        benchview.run_scripts(args, verbose, BENCHMARKS_CSPROJ)