ark::perf
Typedefs
Defined in “ark/perf/tracer.hh”:
- using TraceTimingPackPtr = std::shared_ptr< TraceTimingPack >
Classes
-
ark::perf::AllocatorStatsWidget
This is a widget which can show the AllocatorStats structure. -
ark::perf::DistillAllocatorStage
Class to distill. -
ark::perf::DistillNetworkStage
Class to distill. -
ark::perf::DistillProcessStatStage
Class to distill. -
ark::perf::DistillSystemStatsStage
Class to distill. -
ark::perf::DistillTracerReportStage
Class to distill the Perf Tracers report into a top ten list. -
ark::perf::HardwareHealthStage
This stage will periodically collect and publish hardware health information. -
ark::perf::PerfEventCollectorStage
This stage allows you to define various kernel-level counters that you wish to capture and log on the robot. This uses the kernel ‘perf’ API, and depending on the quantity and types of counters subscribed to, may incur a performance hit.All data that is collected is the ‘raw’ data you must use tools offboard to decode it.
-
ark::perf::PerfEventHandle
This is a wrapper around the Linux kernel perf event system. It allows you to stream perf events (at the moment, samples) from the kernel. It will simply return copies of the data being read from the ring buffer it’s up to calling code to parse that into useful samples. -
ark::perf::PerfEventReport
This class will aggregate raw perf data into state suitable for emitting a ’tracer’-style JSON report suitable for viewing in Perfetto or the like. -
ark::perf::SchedSwitchDecoder
This class is capable of decoding arbitrary ‘sched_switch’ counters. It must be initialized with a schema, and then you can pass in the raw_data field from the perf event samples. -
ark::perf::SchedWakingDecoder
This class is capable of decoding arbitrary ‘sched_waking’ counters. It must be initialized with a schema, and then you can pass in the raw_data field from the perf event samples. -
ark::perf::ScopedTrace
This class provides RAII semantics for starting/stopping a trace. You only need to instantiate the class, you don’t need to worry about stopping it, it will stop when your scope exits. -
ark::perf::TracerCollectorStage
This stage will initialize the global profiler, and then periodically collect and emit statistics, suitable for display in the GUI (or logging). -
ark::perf::TracerHost
The ’trace host’ singleton. All threads register themselves with this singleton, and the user can query it periodically to get a list of all the completed traces. -
ark::perf::TracerPlugin
This plugin allows you to visualize messages coming from the tracer/profiler. It can allow you to debug performance issues live. -
ark::perf::TracerReport
This class can aggragate all of the individual scope timings and produce a report for you this can produce either a flat text table showing min/max/averages, or it can output a chrome-style JSON report. -
ark::perf::TracerTableModel
This class can take in a TraceTimingReport and visualize it in a table. -
ark::perf::PerfEventHandleConfig
Configuration for a new perf event handle. -
ark::perf::PerfEventSample
Contains a partially decoded event sample. This contains the common fields of the sample; you must use schema-specific decoders to look at the raw data. -
ark::perf::PerfEventSampleList
A list of parsed out perf event samples, containing both the list of samples, and metadata (such as lost samples). -
ark::perf::PerfEventSchema
A configuration structure for this handle this contains information that is necessary to decode the perf events. -
ark::perf::SchedSwitchCounter
Contains the raw ‘sched_switch’ information for sched/sched_switch. -
ark::perf::SchedWakingCounter
Contains the raw ‘waking’ counter information for sched/sched_waking. -
ark::perf::TraceTimingPack
A timing pack is a grouping of trace timings that a particular thread has collected. These are accumulated on a per-thread basis until the tracer host captures them. -
ark::perf::TraceTimingSummary
A structure containing summarized information from the scope timings. -
ark::perf::TraceTimingValues
A structure containing summarized information about a min/max/average pair. Used for both durations and spacing. -
ark::perf::TraceTimings
A structure that contains timing information related to a particular trace. For example, this tracks the duration of time that a trace took to execute. -
ark::perf::TracerReportConfig
A structure representing configuration for the tracer report.
Functions
Declared in “ark/perf/loadavg.hh”:
-
LoadAverage populate_load_average(std::istream & is)
Parse the load average statistics from the input stream. The data format should match that from /proc/loadavg. -
LoadAverage read_load_average(const std::filesystem::path & proc_root)
Read the load average statistics from the /proc like filesystem.
Declared in “ark/perf/meminfo.hh”:
-
int64_t get_kernel_page_size_bytes()
Get the kernel memory page size. -
MemInfo populate_meminfo(std::istream & is)
Parse the system memory information from the input stream. The data format should match that from /proc/meminfo. -
MemInfo read_meminfo(const std::filesystem::path & proc_root)
Read the system memory information from the /proc like filesystem.
Declared in “ark/perf/net.hh”:
-
NetworkDevices populate_network_devices_status(std::istream & is, const std::filesystem::path & sysfs_root)
Parse the network devices status information. -
NetworkDevices read_network_devices_status(const std::filesystem::path & proc_root, const std::filesystem::path & sysfs_root)
Read the network interface status from the /proc like filesystem.
Declared in “ark/perf/perf_event_decoder.hh”:
- PerfEventSampleList decode_perf_event_samples(const PerfEventSchema & schema, const core::ByteBuffer & buffer)
Decodes the given byte buffer into an array of samples. This raw byte buffer must remain active for the lifetime of these samples.
Declared in “ark/perf/perf_event_schema.hh”:
-
PerfEventSchema create_perf_event_schema(const std::string & event_name)
Creates a perf event schema, to be used to initialize a PerfEventHandle. This will load the format and configuration information for the given event name, along with assigning the default sample types that will be loaded. -
PerfEventSchema create_perf_event_schema(const std::string & event_name, const std::filesystem::path & tracefs_root)
Creates a perf event schema, to be used to initialize a PerfEventHandle. This will load the format and configuration information for the given event name, along with assigning the default sample types that will be loaded.This will load schema (format and ID) information from the given path. Use this API if your tracefs is mounted in a different location.
-
PerfEventDataSchema to_data_schema(const PerfEventSchema & schema)
Converts a PerfEventSchema into an rbuf schema object. -
PerfEventSchema from_data_schema(const std::string & event_name, const PerfEventDataSchema & schema)
Converts a PerfEventSchema from an rbuf schema object.
Declared in “ark/perf/preallocate.hh”:
- void preallocate_memory(std::size_t bytes)
Preallocates the given number of bytes, and adjusts the internal allocator configuration to stop returning these bytes to the host operating system.
Declared in “ark/perf/process.hh”:
-
ProcessStat read_process_info(int64_t page_size_bytes, uint64_t pid, const std::filesystem::path & proc_root)
Reads all of the process information for the given PID. -
ProcessStats read_all_process_info(int64_t page_size_bytes, const std::filesystem::path & proc_root)
Read all process statistics from the given proc mount. -
void populate_process_scheduler_info(ProcessSchedulerStat & scheduler_stat, const std::filesystem::path & task_root)
Read scheduler info (‘schedstat’) from within the given task root (ie, /proc/1). -
void populate_process_threads_info(ProcessStat & process_stat, const std::filesystem::path & proc_root)
Reads and populate the threads information for the given PID defined in the ProcessStat structure.
Declared in “ark/perf/process_execution_id.hh”:
-
std::string get_process_execution_id()
Returns an identifier containing a unique “process identifier” that can be passed to other processes on the same machine to uniquely determine a process.This is expanded from a standard PID in that it includes additional metadata in case a PID was reused.
-
bool is_process_running(const std::string & process_execution_id)
Returns true if the given process is still running, or false otherwise. This consumes a token previously constructed with get_process_execution_id().
Declared in “ark/perf/smart.hh”:
- SmartLog read_smart_log_from_nvme_device(const std::filesystem::path & path)
Opens the given NVME device (such as /dev/nvme0n1) and reads the latest SMART information from it. This is returned.
Declared in “ark/perf/stat.hh”:
-
int64_t get_clock_ticks_per_second()
Get the number of clock ticks per second for this platform. -
KernelStats populate_kernel_stats(int64_t clock_ticks_per_second, std::istream & is)
Parse the kernel/system statistics from the input stream. The data format should match that from /proc/stat. -
KernelStats read_kernel_stats(int64_t clock_ticks_per_second, const std::filesystem::path & proc_root)
Read the kernel/system statistics from the /proc like filesystem. -
HostStats read_host_stats(const std::filesystem::path & dmi_root)
Reads host information (such as operating system, architecture, etc) and DMI information. Note: Some DMI related data requires root access. Try to read the data but return an empty string if the process does not have permissions. -
std::vector< ThermalInfo > read_thermal_zones(const std::filesystem::path & sysclass_thermal)
Read thermal information from any thermal zones for the system. -
SystemStats read_system_stats(int64_t clock_ticks_per_second, const std::filesystem::path & proc_root, const std::filesystem::path & dmi_root, const std::filesystem::path & sysclass_thermal)
Read the system statistics from the /proc like filesystem as well as the DMI data in /sys/class/dmi/id -
CpuInfo read_cpu_stats(const std::filesystem::path & sysfs_device_root, const std::filesystem::path & hwmon_root)
Reads the collection of CPU attributes.
Declared in “ark/perf/tcmalloc_info.hh”:
- AllocatorStats populate_allocator_stats()
Returns statistics related to tcmalloc, useful for debugging internal memory usage.
Declared in “ark/perf/tracer.hh”:
-
void start_trace(const char * name)
Called to open a new trace. The given name must point to a constant string on the heap, as we only capture a pointer to that name, a copy is not made.Scopes can be nested. It is assumed that a trace will be stopped on the same thread that started it.
-
void start_trace(const std::string & name)
Called to open a new trace, but with a dynamic string. This is a slight performance hit, as we need to store off the string somewhere safe.This calls start_trace() once we have established a permenant position for the name pointer.
-
void stop_trace()
Stops the active trace. This writes out the end counter information, and pushes it into the active pack.
Declared in “ark/perf/uptime.hh”:
- std::chrono::nanoseconds get_host_uptime()
Returns the uptime of the underlying host operating system running the software.