33using BenchmarkDotNet . Environments ;
44using BenchmarkDotNet . Jobs ;
55using BenchmarkDotNet . Running ;
6- using BenchmarkDotNet . Toolchains ;
76using BenchmarkDotNet . Toolchains . DotNetCli ;
87using BenchmarkDotNet . Toolchains . MonoWasm ;
98
@@ -12,11 +11,12 @@ namespace BenchmarkDotNet.Samples
1211 // *** Command Line Arguments ***
1312 public class IntroWasmCmdConfig
1413 {
15- // the args must contain:
16- // an information that we want to run benchmark as Wasm:
17- // --runtimes Wasm
18- // path to dotnet cli
19- // --cli /home/adam/projects/runtime/dotnet.sh
14+ // Example:
15+ // --runtimes wasmnet8.0
16+ // --cli /path/to/dotnet (optional)
17+ // --wasmEngine v8 (optional)
18+ // --wasmArgs "--expose_wasm" (optional)
19+ // --wasmDataDir /path/to/data (optional)
2020 public static void Run ( string [ ] args ) => BenchmarkSwitcher . FromAssembly ( typeof ( IntroWasmCmdConfig ) . Assembly ) . Run ( args ) ;
2121
2222 [ Benchmark ]
@@ -31,16 +31,16 @@ public class IntroWasmFluentConfig
3131 {
3232 public static void Run ( )
3333 {
34- // the Wasm Toolchain requires two mandatory arguments:
35- const string cliPath = @"/home/adam/projects/runtime/dotnet.sh ";
34+ // Optional: set this to use a custom `dotnet` (for example, a local dotnet/runtime build).
35+ const string cliPath = " ";
3636
3737 WasmRuntime runtime = new WasmRuntime ( msBuildMoniker : "net8.0" , RuntimeMoniker . WasmNet80 , "Wasm .net8.0" , false , "v8" ) ;
3838 NetCoreAppSettings netCoreAppSettings = new NetCoreAppSettings (
3939 targetFrameworkMoniker : "net8.0" , runtimeFrameworkVersion : "" , name : "Wasm" ,
4040 customDotNetCliPath : cliPath ) ;
41- IToolchain toolChain = WasmToolchain . From ( netCoreAppSettings ) ;
41+ var toolChain = WasmToolchain . From ( netCoreAppSettings ) ;
4242
43- BenchmarkRunner . Run < IntroCustomMonoFluentConfig > ( DefaultConfig . Instance
43+ BenchmarkRunner . Run < IntroWasmFluentConfig > ( DefaultConfig . Instance
4444 . AddJob ( Job . ShortRun . WithRuntime ( runtime ) . WithToolchain ( toolChain ) ) ) ;
4545 }
4646
0 commit comments