ark::perf

Typedefs

Defined in “ark/perf/tracer.hh”:

Classes

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”:

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.