class Node

Defined at line 526 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

A node under which properties, metrics, and other nodes may be nested.

All methods wrap the corresponding functionality on |State|.

Public Methods

void ~Node ()

Defined at line 336 of file ../../zircon/system/ulib/inspect/vmo/types.cc

Node & operator= (Node && other)

Defined at line 342 of file ../../zircon/system/ulib/inspect/vmo/types.cc

Node CreateChild (std::string_view name)

Create a new |Node| with the given name that is a child of this node.

If this node is not stored in a buffer, the created node will

also not be stored in a buffer.

Defined at line 353 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordChild (std::string_view name, RecordChildCallbackFn callback)

Create a new |Node| with the given name that is a child of this node.

The new child lifetime will be the same as the parent node.

Defined at line 360 of file ../../zircon/system/ulib/inspect/vmo/types.cc

IntProperty CreateInt (std::string_view name, int64_t value)

Create a new |IntProperty| with the given name that is a child of this node.

If this node is not stored in a buffer, the created metric will

also not be stored in a buffer.

Defined at line 366 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordInt (std::string_view name, int64_t value)

Create a new |IntProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 373 of file ../../zircon/system/ulib/inspect/vmo/types.cc

UintProperty CreateUint (std::string_view name, uint64_t value)

Create a new |UintProperty| with the given name that is a child of this node.

If this node is not stored in a buffer, the created metric will

also not be stored in a buffer.

Defined at line 377 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordUint (std::string_view name, uint64_t value)

Create a new |UintProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 384 of file ../../zircon/system/ulib/inspect/vmo/types.cc

DoubleProperty CreateDouble (std::string_view name, double value)

Create a new |DoubleProperty| with the given name that is a child of this node.

If this node is not stored in a buffer, the created metric will

also not be stored in a buffer.

Defined at line 388 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordDouble (std::string_view name, double value)

Create a new |DoubleProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 395 of file ../../zircon/system/ulib/inspect/vmo/types.cc

BoolProperty CreateBool (std::string_view name, bool value)

Create a new |BoolProperty| with the given name that is a child of this node.

If this node is not stored in a buffer, the created metric will

also not be stored in a buffer.

Defined at line 399 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordBool (std::string_view name, bool value)

Create a new |BoolProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 406 of file ../../zircon/system/ulib/inspect/vmo/types.cc

StringProperty CreateString (std::string_view name, const std::string & value)

Create a new |StringProperty| with the given name and value that is a child of this node.

If this node is not stored in a buffer, the created property will

also not be stored in a buffer.

Defined at line 410 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordString (std::string_view name, const std::string & value)

Create a new |StringProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 417 of file ../../zircon/system/ulib/inspect/vmo/types.cc

ByteVectorProperty CreateByteVector (std::string_view name, cpp20::span<const uint8_t> value)

Create a new |ByteVectorProperty| with the given name and value that is a child of this node.

If this node is not stored in a buffer, the created property will

also not be stored in a buffer.

Defined at line 421 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void RecordByteVector (std::string_view name, cpp20::span<const uint8_t> value)

Create a new |ByteVectorProperty| with the given name that is a child of this node.

The new property lifetime will be the same as the parent node.

Defined at line 428 of file ../../zircon/system/ulib/inspect/vmo/types.cc

IntArray CreateIntArray (std::string_view name, size_t slots)

Create a new |IntArray| with the given name and slots that is a child of this node.

If this node is not stored in a buffer, the created value will

also not be stored in a buffer.

Defined at line 432 of file ../../zircon/system/ulib/inspect/vmo/types.cc

UintArray CreateUintArray (std::string_view name, size_t slots)

Create a new |UintArray| with the given name and slots that is a child of this node.

If this node is not stored in a buffer, the created value will

also not be stored in a buffer.

Defined at line 439 of file ../../zircon/system/ulib/inspect/vmo/types.cc

DoubleArray CreateDoubleArray (std::string_view name, size_t slots)

Create a new |DoubleArray| with the given name and slots that is a child of this node.

If this node is not stored in a buffer, the created value will

also not be stored in a buffer.

Defined at line 446 of file ../../zircon/system/ulib/inspect/vmo/types.cc

StringArray CreateStringArray (std::string_view name, size_t slots)

Create a new |StringArray| with the given name and slots that is a child of this node.

If this node is not stored in a buffer, the created value will

also not be stored in a buffer.

Defined at line 453 of file ../../zircon/system/ulib/inspect/vmo/types.cc

LinearIntHistogram CreateLinearIntHistogram (std::string_view name, int64_t floor, int64_t step_size, size_t buckets)

Create a new |LinearIntHistogram| with the given name and format that is a child of this

node. If this node is not stored in a buffer, the created value will also not be stored in

a buffer.

Defined at line 466 of file ../../zircon/system/ulib/inspect/vmo/types.cc

LinearUintHistogram CreateLinearUintHistogram (std::string_view name, uint64_t floor, uint64_t step_size, size_t buckets)

Create a new |LinearUintHistogram| with the given name and format that is a child of this

node. If this node is not stored in a buffer, the created value will also not be stored in

a buffer.

Defined at line 477 of file ../../zircon/system/ulib/inspect/vmo/types.cc

LinearDoubleHistogram CreateLinearDoubleHistogram (std::string_view name, double floor, double step_size, size_t buckets)

Create a new |LinearDoubleHistogram| with the given name and format that is a child of this

node. If this node is not stored in a buffer, the created value will also not be stored in

a buffer.

Defined at line 488 of file ../../zircon/system/ulib/inspect/vmo/types.cc

ExponentialIntHistogram CreateExponentialIntHistogram (std::string_view name, int64_t floor, int64_t initial_step, int64_t step_multiplier, size_t buckets)

Create a new |ExponentialIntHistogram| with the given name and format that is a child of this

node. If this node is not stored in a buffer, the created value will also not be stored in

a buffer.

Defined at line 499 of file ../../zircon/system/ulib/inspect/vmo/types.cc

ExponentialUintHistogram CreateExponentialUintHistogram (std::string_view name, uint64_t floor, uint64_t initial_step, uint64_t step_multiplier, size_t buckets)

Create a new |ExponentialUintHistogram| with the given name and format that is a child of this

node. If this node is not stored in a buffer, the created value will also not be stored in

a buffer.

Defined at line 512 of file ../../zircon/system/ulib/inspect/vmo/types.cc

ExponentialDoubleHistogram CreateExponentialDoubleHistogram (std::string_view name, double floor, double initial_step, double step_multiplier, size_t buckets)

Create a new |ExponentialDoubleHistogram| with the given name and format that is a child of

this node. If this node is not stored in a buffer, the created value will also not be

stored in a buffer.

Defined at line 525 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void Node ()

Construct a default node. Operations on this node are

no-ops.

Defined at line 530 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

void Node (const Node & other)

Allow moving, disallow copying.

Defined at line 534 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

void Node (Node && other)

Defined at line 535 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

Node & operator= (const Node & other)

Defined at line 536 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

LazyNode CreateLazyNode (std::string_view name, LazyNodeCallbackFn callback)

Create a new |LazyNode| with the given name that is populated by the given callback on demand.

The passed |callback| will live as long as the returned LazyNode, and will not be called

concurrently by multiple threads.

For example:

auto a = root.CreateChild("a");

a.CreateLazyNode("b", [] {

Inspector insp;

ValueList values;

insp.GetRoot().CreateInt("val", 2,

&values

);

return fpromise::make_ok_result(insp);

});

Output:

root:

a:

b:

val = 2

Defined at line 546 of file ../../zircon/system/ulib/inspect/vmo/types.cc

template <typename T>
void CreateChild (std::string_view name, T * list)

Same as CreateChild, but emplaces the value in the given container.

The type of |list| must have method emplace(Node).

inspect::ValueList is recommended for most use cases.

Defined at line 549 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

void RecordLazyNode (std::string_view name, LazyNodeCallbackFn callback)

Create a new |LazyNode| with the given name that is a child of this node.

The new child lifetime will be the same as the parent node.

Defined at line 553 of file ../../zircon/system/ulib/inspect/vmo/types.cc

template <typename T>
void Record (T value)

Associates the lifetime of the given value with the node lifetime.

Defined at line 555 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

void RecordLazyValues (std::string_view name, LazyNodeCallbackFn callback)

Create a new |LazyNode| with the given name that is a child of this node.

The new child lifetime will be the same as the parent node.

Defined at line 565 of file ../../zircon/system/ulib/inspect/vmo/types.cc

LazyNode CreateLazyValues (std::string_view name, LazyNodeCallbackFn callback)

Create a new |LazyNode| whose children and properties are added to this node on demand.

The passed |callback| will live as long as the returned LazyNode, and will not be called

concurrently by multiple threads.

The name is only used if inflating the tree callback fails.

WARNING: It is the caller's responsibility to avoid name collisions with other properties

on this node.

For example:

auto a = root.CreateChild("a");

a.CreateLazy("b", [] {

Inspector insp;

ValueList values;

insp.GetRoot().CreateInt("val", 2).enlist(

&values

);

return fpromise::make_ok_promise(insp);

});

Output:

root:

a:

val = 2

Alternatively:

a.CreateLazyNode("b", [] {

return fpromise::make_error_promise();

});

Possible output:

root:

a:

b [Failed to open link]

Defined at line 558 of file ../../zircon/system/ulib/inspect/vmo/types.cc

void AtomicUpdate (AtomicUpdateCallbackFn callback)

Runs |callback| on this node.

All operations performed by |callback| are guaranteed to appear in the same generation when

reading Inspect data.

Defined at line 570 of file ../../zircon/system/ulib/inspect/vmo/types.cc

std::string UniqueName (const std::string & prefix)

Create a unique name for children of this node.

The returned strings are guaranteed to be at least unique within the context of this Node,

except in the case that this is a default no-op node, in which case this always returns the

empty string.

Defined at line 539 of file ../../zircon/system/ulib/inspect/vmo/types.cc

template <typename T>
void CreateInt (std::string_view name, int64_t value, T * list)

Same as CreateInt, but emplaces the value in the given container.

The type of |list| must have method emplace(IntProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 577 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename T>
void CreateUint (std::string_view name, uint64_t value, T * list)

Same as CreateUint, but emplaces the value in the given container.

The type of |list| must have method emplace(UintProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 595 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename T>
void CreateDouble (std::string_view name, double value, T * list)

Same as CreateDouble, but emplaces the value in the given container.

The type of |list| must have method emplace(DoubleProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 613 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename T>
void CreateBool (std::string_view name, bool value, T * list)

Same as CreateBool, but emplaces the value in the given container.

The type of |list| must have method emplace(BoolProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 631 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename T>
void CreateString (std::string_view name, const std::string & value, T * list)

Same as CreateString, but emplaces the value in the given container.

The type of |list| must have method emplace(StringProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 649 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename T>
void CreateByteVector (std::string_view name, cpp20::span<const uint8_t> value, T * list)

Same as CreateByteVector, but emplaces the value in the given container.

The type of |list| must have method emplace(ByteVectorProperty).

inspect::ValueList is recommended for most use cases.

Defined at line 668 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename F, typename T>
void CreateLazyNode (std::string_view name, F callback, T * list)

Same as CreateLazyNode, but emplaces the value in the given container.

The type of |list| must have method emplace(LazyNode).

inspect::ValueList is recommended for most use cases.

Defined at line 767 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

template <typename F, typename T>
void CreateLazyValues (std::string_view name, F callback, T * list)

Same as CreateLazyValues, but emplaces the value in the given container.

The type of |list| must have method emplace(LazyNode).

inspect::ValueList is recommended for most use cases.

Defined at line 817 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

bool operator bool ()

Return true if this node is stored in a buffer. False otherwise.

Defined at line 828 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/types.h

Friends

class State