tree: 2d951ef02cc8d12030fe66c2fc08f34a8b7040b6 [path history] [tgz]
  1. meta/
  2. assert.h
  3. async_loop.cc
  4. async_loop.fidl
  5. atomics.cc
  6. BUILD.gn
  7. channels.cc
  8. clock.cc
  9. clock_posix.cc
  10. context_switch_overhead.cc
  11. context_switch_overhead_helper.cc
  12. events.cc
  13. example.cc
  14. fdio_spawn.cc
  15. fifos.cc
  16. filesystem.cc
  17. get_info.cc
  18. get_info_helper.cc
  19. getpid.cc
  20. handle.cc
  21. handle_creation.cc
  22. inspect.cc
  23. lazy_dir.cc
  24. main.cc
  25. main.h
  26. malloc.cc
  27. mem_alloc.cc
  28. memcpy.cc
  29. mmu.cc
  30. mutex.cc
  31. no_op_executable.cc
  32. null.cc
  33. object_wait.cc
  34. OWNERS
  35. ports.cc
  36. prng.cc
  37. process_spawn_posix.cc
  38. pseudo_dir.cc
  39. pthreads.cc
  40. random_memcpy.cc
  41. README.md
  42. restricted_enter.cc
  43. round_tripper.fidl
  44. round_trips.cc
  45. round_trips.h
  46. round_trips_futex.cc
  47. round_trips_posix.cc
  48. sleep.cc
  49. sockets.cc
  50. streams.cc
  51. syscalls.cc
  52. test_runner.h
  53. threads.cc
  54. timer.cc
  55. tracing.cc
  56. util.cc
  57. util.h
  58. vmar.cc
  59. vmo.cc
src/tests/microbenchmarks/README.md

Fuchsia Microbenchmarks

This set of tests includes microbenchmarks for core OS functionality, including Zircon syscalls and IPC primitives, as well as microbenchmarks for other layers of Fuchsia.

Some of the microbenchmarks are portable and can be run on Linux or Mac, for comparison against Fuchsia. This means that the name fuchsia_microbenchmarks should be taken to mean “microbenchmarks that are part of the Fuchsia project” rather than “microbenchmarks that only run on Fuchsia”.

This used to be called “zircon_benchmarks”, but it was renamed to reflect that it covers more than just Zircon.

Writing Benchmarks

This uses the perftest C++ library.

Running Benchmarks

fuchsia_microbenchmarks can be run the following ways:

  • Maximal: You can use the microbenchmarks_test entry point used in Infra builds on CI and CQ. For this, follow the instructions in How to run performance tests and use this command:

    fx test --e2e host_x64/microbenchmarks_test
    

    This entry point is fairly slow because it runs the fuchsia_microbenchmarks process multiple times.

    This entry point will copy the performance results (*.fuchsiaperf.json files) back to the host in out/test_out directory.

  • Minimal: Unit test mode. To check that the tests pass, without collecting any performance results, you can run the fuchsia_microbenchmarks component directly:

    ffx test run fuchsia-pkg://fuchsia.com/fuchsia_microbenchmarks#meta/fuchsia_microbenchmarks.cm
    

    This runs quickly because it runs only a small number of iterations of each benchmark.

  • In-between: If you want to run the tests differently from the microbenchmarks_test entry point above, such as to run a smaller or faster set of tests, you can invoke the fuchsia_microbenchmarks component directly and pass some of the options accepted by the perftest C++ library.

    For example, the following invocation runs only the Syscall/Null test case and prints some summary statistics:

    ffx test run fuchsia-pkg://fuchsia.com/fuchsia_microbenchmarks#meta/fuchsia_microbenchmarks.cm -- -p --filter '^Syscall/Null$'
    

    The following invocation will produce an output file in fuchsiaperf.json format and will copy it back to the host side:

    ffx test run fuchsia-pkg://fuchsia.com/fuchsia_microbenchmarks#meta/fuchsia_microbenchmarks.cm --output-directory host-output-dir -- -p --out /custom_artifacts/results.fuchsiaperf.json
    

    An alternative is to modify the microbenchmarks_test wrapper program locally to change the set of tests it runs or the number of iterations it runs.

Direct Mode Microbenchmarks

Direct mode is a way to run unmodified Fuchsia binaries under Virtualization. These binaries have direct access to Zircon syscalls and can be agnostic to whether they are running under direct mode.

The direct mode microbenchmarks are intended to be used to compare performance of direct mode to regular execution. This can help us guide optimisations, as well as to highlight regressions, while we develop direct mode.

To run the benchmarks as a unit test, use:

ffx test run fuchsia-pkg://fuchsia.com/direct_mode_microbenchmarks#meta/direct_mode_microbenchmarks.cm

Or, as a performance test, use:

ffx test run fuchsia-pkg://fuchsia.com/direct_mode_microbenchmarks#meta/direct_mode_microbenchmarks.cm -- -p

Or, as a quick performance test, use:

ffx test run fuchsia-pkg://fuchsia.com/direct_mode_microbenchmarks#meta/direct_mode_microbenchmarks.cm -- -p --runs 5