Namespaces

Enumerations

enum LogLevel
Name Value
kTerse 0
kNormal 1
kVerbose 2
kInvalid 3

Level of log detail.

Defined at line 17 of file ../../src/zircon/bin/hwstress/status.h

enum StressTest
Name Value
kCpu 0
kLight 1
kMemory 2

Subcommand to run.

Defined at line 21 of file ../../src/zircon/bin/hwstress/args.h

enum CacheMode
Name Value
kCached 0
kUncached 1

Determines if memory should have CPU caches enabled on it.

Defined at line 22 of file ../../src/zircon/bin/hwstress/memory_range.h

Records

Functions

  • zx::result<fuchsia::kernel::MemoryStats> GetMemoryStats ()

    Get current system memory statistics.

    Defined at line 14 of file ../../src/zircon/bin/hwstress/memory_stats.cc

  • zx::duration SecsToDuration (double secs)

    Convert double representing a number of seconds to a zx::duration.

    Defined at line 15 of file ../../src/zircon/bin/hwstress/util.cc

  • bool StressCpu (StatusLine * status, const CommandLineArgs & args, zx::duration duration_seconds, TemperatureSensor * sensor)

    Start a stress test.

    Return true on success.

    Defined at line 93 of file ../../src/zircon/bin/hwstress/cpu_stress.cc

  • double DurationToSecs (zx::duration d)

    Convert zx::duration to double representing the number of seconds.

    Defined at line 19 of file ../../src/zircon/bin/hwstress/util.cc

  • template <typename T>
    T HideFromCompiler (T x)

    Prevent the compiler from knowing anything about the given value.

    For example, "HideFromCompiler(1) + HideFromCompiler(1)" will prevent

    the compiler from constant-folding the resulting value down to 2,

    and instead force it to evaluate the addition.

    Will only work with basic types.

    Defined at line 20 of file ../../src/zircon/bin/hwstress/compiler.h

  • int Run (int argc, const char ** argv)

    Run the main binary with the given command line args.

    Defined at line 26 of file ../../src/zircon/bin/hwstress/hwstress.cc

  • zx::result<zx::channel> OpenDeviceChannel (std::string_view path)

    Open the given path as a FIDL channel.

    Defined at line 18 of file ../../src/zircon/bin/hwstress/device.cc

  • bool StressLight (StatusLine * status, const CommandLineArgs & args, zx::duration duration)

    Start a stress on a device light / LED.

    Return true on success.

    Defined at line 102 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • std::vector<CpuWorkload> GetCpuWorkloads ()

    Return a list of available workloads.

    Defined at line 248 of file ../../src/zircon/bin/hwstress/cpu_workloads.cc

  • std::vector<uint64_t> RotatePattern (std::vector<uint64_t> v, uint64_t n)

    Rotate the given multi-word pattern right by N bits.

    Defined at line 24 of file ../../src/zircon/bin/hwstress/memory_patterns.cc

  • std::string DoubleAsHex (double v)

    Represent a double as a hexadecimal constant.

    Defined at line 23 of file ../../src/zircon/bin/hwstress/util.cc

  • bool StressMemory (StatusLine * status, const CommandLineArgs & args, zx::duration duration_seconds, TemperatureSensor * sensor)

    Start a memory stress test.

    Return true on success.

    Defined at line 349 of file ../../src/zircon/bin/hwstress/memory_stress.cc

  • LogLevel LogLevelFromString (const std::string & value)

    Defined at line 21 of file ../../src/zircon/bin/hwstress/status.cc

  • std::vector<uint64_t> NegateWords (std::vector<uint64_t> v)

    Invert (bitwise negate) the words in the vector.

    Defined at line 46 of file ../../src/zircon/bin/hwstress/memory_patterns.cc

  • std::unique_ptr<TemperatureSensor> CreateSystemTemperatureSensor (std::string_view device_path)

    Create a temperature sensor using devices on the system.

    Defined at line 51 of file ../../src/zircon/bin/hwstress/temperature_sensor.cc

  • std::istream & operator>> (std::istream & is, CpuCoreList & result)

    Parse a CpuCoreList.

    Defined at line 64 of file ../../src/zircon/bin/hwstress/args.cc

  • bool operator== (const LightInfo & , const LightInfo & )

    Defined at line 51 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • std::unique_ptr<TemperatureSensor> CreateSystemTemperatureSensor (zx::channel channel)

    Defined at line 60 of file ../../src/zircon/bin/hwstress/temperature_sensor.cc

  • bool operator!= (const LightInfo & , const LightInfo & )

    Defined at line 54 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • std::unique_ptr<TemperatureSensor> CreateNullTemperatureSensor ()

    Create a null temperature sensor. Always returns "unknown".

    Defined at line 70 of file ../../src/zircon/bin/hwstress/temperature_sensor.cc

  • zx::result<std::vector<LightInfo>> GetLights (const fuchsia::hardware::light::LightSyncPtr & light)

    Query all lights on the given interface.

    Defined at line 64 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • TemperatureSensor * GetNullTemperatureSensor ()

    A global, null temperature sensor.

    Defined at line 74 of file ../../src/zircon/bin/hwstress/temperature_sensor.cc

  • zx::result<> TurnOnLight (const fuchsia::hardware::light::LightSyncPtr & light, uint32_t light_num)

    Turn on or off the light at the given index.

    Defined at line 56 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • zx::result<> TurnOffLight (const fuchsia::hardware::light::LightSyncPtr & light, uint32_t light_num)

    Defined at line 60 of file ../../src/zircon/bin/hwstress/light_stress.cc

  • std::string TemperatureToString (std::optional<double> temperature)

    Convert a temperature to a human-readable string.

    Defined at line 79 of file ../../src/zircon/bin/hwstress/temperature_sensor.cc

  • std::vector<MemoryWorkload> GenerateMemoryWorkloads ()

    Get all memory stress workloads.

    Defined at line 179 of file ../../src/zircon/bin/hwstress/memory_stress.cc

  • zx::unowned<zx::thread> HandleFromThread (std::thread * thread)

    Return the Zircon handle from a given C++ thread.

    Defined at line 23 of file ../../src/zircon/bin/hwstress/profile_manager.cc

  • uint64_t RepeatByte (uint8_t v)

    Create a 64-bit pattern by repeating the same 8-bit value 8 times.

    Defined at line 26 of file ../../src/zircon/bin/hwstress/util.h

  • zx::duration GetCurrentThreadCpuTime ()

    Defined at line 27 of file ../../src/zircon/bin/hwstress/cpu_stressor.cc

  • uint64_t RoundUp (uint64_t n, uint64_t k)

    Round up the given value |n| so that it is a multiple of |k|.

    Defined at line 29 of file ../../src/zircon/bin/hwstress/util.h

  • uint64_t RoundDown (uint64_t n, uint64_t k)

    Round down the given value |n| so that it is a multiple of |k|.

    Defined at line 32 of file ../../src/zircon/bin/hwstress/util.h

  • (lambda at ../../src/zircon/bin/hwstress/memory_patterns.h:34:10) SimplePattern (uint64_t word)

    Return a constant word as a pattern.

    The word is always written in memory as a big-endian word. That is, the

    pattern 0x1122334455667788 will be written out as bytes 0x11, 0x22, ..., 0x88

    at increasing memory addresses.

    Defined at line 33 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • uint64_t kiB (uint64_t n)

    Functions to simplify constants.

    Defined at line 35 of file ../../src/zircon/bin/hwstress/util.h

  • uint64_t MiB (uint64_t n)

    Defined at line 36 of file ../../src/zircon/bin/hwstress/util.h

  • uint64_t GiB (uint64_t n)

    Defined at line 37 of file ../../src/zircon/bin/hwstress/util.h

  • template <typename Pattern>
    auto InvertPattern (Pattern p)

    Invert the given pattern.

    Defined at line 39 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • (lambda at ../../src/zircon/bin/hwstress/memory_patterns.h:47:10) RandomPattern ()

    Return a pseudo-random stream of values.

    Defined at line 44 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • template <typename T>
    void HideMemoryFromCompiler (T * memory)

    Prevent the compiler from assuming anything about the given memory.

    For example, a compiler may optimize away a "memset" because it sees

    that the memory is never touched afterwards, or is only written to

    afterwards. The statement "HideMemoryFromCompiler(&memory)" prevents

    the compiler for knowing about that state of memory.

    Defined at line 45 of file ../../src/zircon/bin/hwstress/compiler.h

  • (lambda at ../../src/zircon/bin/hwstress/memory_patterns.h:63:10) MultiWordPattern (std::vector<uint64_t> pattern)

    Repeat the same multi-word pattern.

    The values are written to memory in big-endian format. That is, the

    vector [0x1122, 0x3344, 0x5566, 0x7788] will be written out as bytes

    0x11, 0x22, ..., 0x88 at increasing memory addresses.

    Defined at line 55 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • template <typename T>
    void ForceEval (T x)

    Force the compiler to evaluate the given value.

    For example, the expression "ForceEval(sin(PI))" will force the

    compiler to cacluate sin(PI), and put it in a register. Note that the

    compiler may still perform this evaluation at compile time: see

    "HideFromCompiler" to prevent that.

    Will only work with basic types.

    Defined at line 60 of file ../../src/zircon/bin/hwstress/compiler.h

  • template <typename PatternGenerator>
    void WritePattern (cpp20::span<uint8_t> range, PatternGenerator pattern)

    Write the given pattern out to memory.

    Patterns are written out in native-endian format. If a particular

    endian conversion is required, it must be converted by the PatternGenerator.

    Defined at line 71 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • void PrintUsage ()

    Print usage information to stdout.

    Defined at line 80 of file ../../src/zircon/bin/hwstress/args.cc

  • template <typename PatternGenerator>
    std::optional<std::string> VerifyPattern (cpp20::span<uint8_t> range, PatternGenerator pattern)

    Verify the given pattern is in memory.

    Defined at line 82 of file ../../src/zircon/bin/hwstress/memory_patterns.h

  • fit::result<std::string, CommandLineArgs> ParseArgs (cpp20::span<const char *const> args)

    Parse args, returning failure or the parsed arguments.

    Defined at line 132 of file ../../src/zircon/bin/hwstress/args.cc

  • zx::duration RequiredSleepForTargetUtilization (zx::duration cpu_time, zx::duration wall_time, double utilization)

    Given a thread has had |cpu_time| CPU time and |wall_time| wall time, how long must we sleep to

    achieve a utilization of |utilization|?

    Defined at line 33 of file ../../src/zircon/bin/hwstress/cpu_stressor.cc

  • template <typename PatternGenerator>
    void VerifyPatternOrDie (cpp20::span<uint8_t> range, PatternGenerator pattern)

    Defined at line 172 of file ../../src/zircon/bin/hwstress/memory_stress.cc

  • zx::result<> ReallocateMemoryAsRequired (CacheMode mode, size_t size, std::unique_ptr<MemoryRange> * result)

    Ensure that |result| contains at least |size| bytes of memory, mapped in as mode |mode|.

    Will deallocate and reallocate memory as required to achieve this.

    Defined at line 241 of file ../../src/zircon/bin/hwstress/memory_stress.cc

  • fit::result<std::string, size_t> GetMemoryToTest (const CommandLineArgs & args)

    Defined at line 258 of file ../../src/zircon/bin/hwstress/memory_stress.cc