Changeset 228023 in webkit


Ignore:
Timestamp:
Feb 2, 2018 12:30:23 PM (6 years ago)
Author:
ggaren@apple.com
Message:

Make MallocBench easier for non-WebKit engineers to run
https://bugs.webkit.org/show_bug.cgi?id=182415

Reviewed by Saam Barati.

  • MallocBench/MallocBench.xcodeproj/project.pbxproj: Use c++14 so we

can make_unique.

Specify that we support all Darwin platforms so you can test them.

  • MallocBench/run-malloc-benchmarks: Specify the path to MallocBench

and libmbmalloc explicitly, rather than computing them implicitly
using webkitdirs. Non-WebKit folks don't have the directory structure
required by webkitdirs.

Remove Linux-specific and cmake-specific behaviors because we only
needed them in the world of implicit path computation.

Location:
trunk/PerformanceTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r227946 r228023  
     12018-02-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Make MallocBench easier for non-WebKit engineers to run
     4        https://bugs.webkit.org/show_bug.cgi?id=182415
     5
     6        Reviewed by Saam Barati.
     7
     8        * MallocBench/MallocBench.xcodeproj/project.pbxproj: Use c++14 so we
     9        can make_unique.
     10
     11        Specify that we support all Darwin platforms so you can test them.
     12
     13        * MallocBench/run-malloc-benchmarks: Specify the path to MallocBench
     14        and libmbmalloc explicitly, rather than computing them implicitly
     15        using webkitdirs. Non-WebKit folks don't have the directory structure
     16        required by webkitdirs.
     17
     18        Remove Linux-specific and cmake-specific behaviors because we only
     19        needed them in the world of implicit path computation.
     20
    1212018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj

    r222900 r228023  
    370370                        buildSettings = {
    371371                                ALWAYS_SEARCH_USER_PATHS = NO;
    372                                 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
     372                                CLANG_CXX_LANGUAGE_STANDARD = "c++14";
    373373                                CLANG_CXX_LIBRARY = "libc++";
    374374                                CLANG_ENABLE_MODULES = YES;
     
    397397                                GCC_WARN_UNUSED_FUNCTION = YES;
    398398                                GCC_WARN_UNUSED_VARIABLE = YES;
     399                                IPHONEOS_DEPLOYMENT_TARGET = 11.3;
    399400                                MACOSX_DEPLOYMENT_TARGET = 10.9;
    400401                                ONLY_ACTIVE_ARCH = YES;
    401402                                SDKROOT = macosx;
     403                                SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
    402404                        };
    403405                        name = Debug;
     
    407409                        buildSettings = {
    408410                                ALWAYS_SEARCH_USER_PATHS = NO;
    409                                 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
     411                                CLANG_CXX_LANGUAGE_STANDARD = "c++14";
    410412                                CLANG_CXX_LIBRARY = "libc++";
    411413                                CLANG_ENABLE_MODULES = YES;
     
    429431                                GCC_WARN_UNUSED_FUNCTION = YES;
    430432                                GCC_WARN_UNUSED_VARIABLE = YES;
     433                                IPHONEOS_DEPLOYMENT_TARGET = 11.3;
    431434                                MACOSX_DEPLOYMENT_TARGET = 10.9;
    432435                                SDKROOT = macosx;
     436                                SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
    433437                        };
    434438                        name = Release;
  • trunk/PerformanceTests/MallocBench/run-malloc-benchmarks

    r222900 r228023  
    44require 'getoptlong'
    55require 'pathname'
    6 
    7 $binDir = "#{File.expand_path(File.dirname(__FILE__))}"
    8 $productDir = `perl -e 'use lib \"#{$binDir}/../../Tools/Scripts\"; use webkitdirs; print productDir()'`
    9 
    10 def determineOS
    11     case RbConfig::CONFIG["host_os"]
    12     when /darwin/i
    13         "darwin"
    14     when /linux/i
    15         "linux"
    16     when /mswin|mingw|cygwin/
    17         "windows"
    18     else
    19         $stderr.puts "Warning: unable to determine host operating system"
    20         nil
    21     end
    22 end
    23 
    24 $hostOS = determineOS unless $hostOS
    25 $cmake = false
    26 
    27 if $hostOS == 'darwin'
    28     $libraryExtension = "dylib"
    29 else
    30     $libraryExtension = "so"
    31 end
    326
    337$benchmarks_all = [
     
    9771
    9872def usage
    99         puts "run-malloc-benchmarks [options] <Name:/path/to/dylib> [<Name:/path/to/dylib>]"
     73        puts "run-malloc-benchmarks [options] /path/to/MallocBench Name:/path/to/libmbmalloc.dylib [ Name:/path/to/libmbmalloc.dylib ]"
    10074        puts
    10175        puts "    Runs a suite of memory allocation and access benchmarks."
    10276    puts
    103     puts "    <Name:/path/to/dylib> is a symbolic name followed by a folder containing a libmbmalloc.dylib."
     77    puts "    <Name:/path/to/libmbmalloc.dylib> is a symbolic name followed by a path to libmbmalloc.dylib."
    10478    puts
    10579    puts "    Specify \"SystemMalloc\" to test the built-in libc malloc."
     
    10882    puts "    Example usage:"
    10983    puts
    110     puts "        run-malloc-benchmarks SystemMalloc NanoMalloc"
    111     puts "        run-malloc-benchmarks FastMalloc:/path/to/FastMalloc/Build/Products/Release/"
    112     puts "        run-malloc-benchmarks --benchmark churn SystemMalloc FastMalloc:/path/to/FastMalloc/Build/Products/Release/"
     84    puts "        run-malloc-benchmarks /BUILD/MallocBench SystemMalloc:/BUILD/libmbmalloc.dylib NanoMalloc:/BUILD/libmbmalloc.dylib"
     85    puts "        run-malloc-benchmarks /BUILD/MallocBench FastMalloc:/BUILD/FastMalloc/libmbmalloc.dylib"
     86    puts "        run-malloc-benchmarks --benchmark churn SystemMalloc:/BUILD/libmbmalloc.dylib FastMalloc:/BUILD/FastMalloc/libmbmalloc.dylib"
    11387    puts
    11488        puts "Options:"
     
    11690    puts "    --benchmark <benchmark>      Select a single benchmark to run instead of the full suite."
    11791    puts "    --heap <heap>                Set a baseline heap size."
    118     puts "    --cmake                      Specify if build directory layout is for CMake."
    11992    puts
    12093end
     
    12699    def initialize(name, path)
    127100        @name = name
    128         @path = File.join(path, "libmbmalloc.#{$libraryExtension}")
     101        @path = path
    129102    end
    130103end
     
    239212    GetoptLong.new(
    240213        ['--benchmark', GetoptLong::REQUIRED_ARGUMENT],
    241         ['--cmake', GetoptLong::NO_ARGUMENT],
    242214        ['--memory', GetoptLong::NO_ARGUMENT],
    243215        ['--memory_warning', GetoptLong::NO_ARGUMENT],
     
    253225        when '--memory_warning'
    254226            $benchmarks = $benchmarks_memory_warning
    255         when '--cmake'
    256             $cmake = true
    257227        when '--heap'
    258228            $heap = arg
     
    265235    }
    266236
    267     if $cmake
    268         $libraryDir = "#{$productDir}/lib"
    269         $systemMallocLibraryDir = "#{$productDir}/lib/system"
    270         $binaryDir = "#{$productDir}/bin"
    271     else
    272         $libraryDir = $productDir
    273         $binaryDir = $productDir
    274         $systemMallocLibraryDir = $productDir
    275     end
    276 
    277237    if ARGV.length < 1
     238        puts "Error: No MallocBench specified."
     239        exit 1
     240    end
     241
     242    if ARGV.length < 2
    278243        puts "Error: No dylib specified."
    279244        exit 1
    280245    end
     246
     247    $mallocBench = File.absolute_path(ARGV.shift)
     248    if !File.exists?($mallocBench)
     249        puts "File not found: #{$mallocBench}."
     250        exit 1
     251    end
     252
     253    $buildDir = Pathname.new($mallocBench).dirname
    281254
    282255    dylibs = []
    283256    ARGV.each {
    284257        | arg |
    285         if arg == "SystemMalloc"
    286             dylib = Dylib.new("SystemMalloc", $systemMallocLibraryDir)
    287         elsif arg == "NanoMalloc"
    288             dylib = Dylib.new("NanoMalloc", $libraryDir)
    289         else
    290             name = arg.split(":")[0]
    291             path = arg.split(":")[1]
    292             if !name || name.length < 1 ||
    293                 !path || path.length < 1
    294                 puts "Invalid <Name:/path/to/dylib>: '#{arg}'."
    295                 exit 1
    296             end
    297 
    298             dylib = Dylib.new(name, File.expand_path(path))
    299         end
     258        name, path = arg.split(":")
     259        if !name || name.length < 1 ||
     260            !path || path.length < 1
     261            puts "Invalid <Name:/path/to/dylib>: '#{arg}'."
     262            exit 1
     263        end
     264
     265        dylib = Dylib.new(name, File.expand_path(path))
    300266
    301267        if !File.exists?(dylib.path)
     
    329295            if dylib.name == "NanoMalloc"
    330296                env += "MallocNanoZone=1 "
     297            elsif dylib.name == "SystemMalloc"
     298                env += "MallocNanoZone=0 "
    331299            end
    332             input = "cd '#{$productDir}'; #{env} '#{$binaryDir}/MallocBench' --benchmark #{benchmark} --heap #{$heap}}"
     300            input = "cd '#{$buildDir}'; #{env} '#{$mallocBench}' --benchmark #{benchmark} --heap #{$heap}}"
    333301            output =`#{input}`
    334302            splitOutput = output.split("\n")
Note: See TracChangeset for help on using the changeset viewer.