itrace
Instrumented Trace
itrace.h File Reference

Logger and profiler APIs accessible from the CPU and DSPs. More...

#include "itrace_types.h"
#include "itrace_utils.h"

Go to the source code of this file.

Macros

#define ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS(itrace_section_id_param)
 Define the start of a section to monitor without tracking registered events. More...
 
#define ITRACE_END_SECTION_WITH_CONTEXT_NO_EVENTS()   itrace_end_section_with_context_no_events(itrace_section_id, &itrace_section_no_events_context);
 Define the end of a section to monitor without tracking registered events.
 
#define ITRACE_START_SECTION_WITH_CONTEXT(itrace_section_id_param)
 Define the start of a section to monitor. More...
 
#define ITRACE_END_SECTION_WITH_CONTEXT()   itrace_end_section_with_context(itrace_section_id, &itrace_section_context);
 Define the end of a section to monitor.
 
#define ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS(itrace_section_id_param)
 Define the start of a section to monitor without tracking registered events. More...
 
#define ITRACE_END_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS(itrace_section_id_param)   itrace_end_section_with_context_no_events(itrace_section_id_##itrace_section_id_param, &itrace_section_no_events_context_##itrace_section_id_param);
 Define the end of a section to monitor without tracking registered events. More...
 
#define ITRACE_START_SECTION_WITH_CONTEXT_MSPS(itrace_section_id_param)
 Define the start of a section to monitor. More...
 
#define ITRACE_END_SECTION_WITH_CONTEXT_MSPS(itrace_section_id_param)   itrace_end_section_with_context(itrace_section_id_##itrace_section_id_param, &itrace_section_context_##itrace_section_id_param);
 Define the end of a section to monitor. More...
 

Functions

itrace_return_t itrace_open_logger (int domain, itrace_logger_handle_t *logger_handle_ptr)
 Open logger instance. More...
 
itrace_return_t itrace_remote_open (itrace_logger_handle_t *logger_handle_ptr, int is_blocking_call)
 Enable client to control itrace remotely. More...
 
itrace_return_t itrace_remote_close (void)
 Disable client from controlling itrace remotely. More...
 
itrace_return_t itrace_close_logger (itrace_logger_handle_t logger_handle)
 Close logger instance. More...
 
itrace_return_t itrace_set_root_filename (itrace_logger_handle_t logger_handle, const char *root_filename)
 Specify the root name of the files created by the logger. More...
 
itrace_return_t itrace_get_root_filename (itrace_logger_handle_t logger_handle, char *root_filename)
 Return the current root name being used by the logger. More...
 
itrace_return_t itrace_flush_logs (itrace_logger_handle_t logger_handle)
 Flush the logs of all opened profilers. More...
 
itrace_return_t itrace_close_files (itrace_logger_handle_t logger_handle)
 Close the logger output files. More...
 
itrace_return_t itrace_set_target_files (itrace_logger_handle_t logger_handle, uint32_t file_types)
 Specify the types of files generated by the logger. More...
 
itrace_return_t itrace_open_profiler (itrace_logger_handle_t logger_handle, uint32_t domain, size_t log_size, itrace_profiler_handle_t *profiler_handle_ptr)
 Open profiler instance. More...
 
itrace_return_t itrace_close_profiler (itrace_profiler_handle_t profiler_handle)
 Close profiler instance. More...
 
itrace_return_t itrace_add_event (itrace_profiler_handle_t profiler_handle, itrace_event_t *event)
 Add an event to be registered. More...
 
itrace_return_t itrace_add_event_by_id (itrace_profiler_handle_t profiler_handle, uint32_t event_id)
 Add an event to be registered by specifying only its id. More...
 
itrace_return_t itrace_add_events (itrace_profiler_handle_t profiler_handle, itrace_event_t *events, int num_events)
 Add multiple events to be registered. More...
 
itrace_return_t itrace_add_events_from_file (itrace_profiler_handle_t profiler_handle, const char *events_filename)
 Add events to be registered from a file. More...
 
itrace_return_t itrace_add_all_pmu_events (itrace_profiler_handle_t profiler_handle)
 Add all published PMU events supported on the current domain. More...
 
itrace_return_t itrace_remove_all_events (itrace_profiler_handle_t profiler_handle)
 Remove all events to be registered. More...
 
itrace_return_t itrace_register_events (itrace_profiler_handle_t profiler_handle, itrace_event_t *attempted_to_register_events, int *num_attempted_to_register_events)
 Register new events. More...
 
itrace_return_t itrace_deregister_events (itrace_profiler_handle_t profiler_handle)
 Deregister all events currently registered with this profiler instance. More...
 
itrace_return_t itrace_get_num_events_left_to_register (itrace_profiler_handle_t profiler_handle, int *num_events_left_to_register)
 Return the number of events that are still to be registered. More...
 
itrace_return_t itrace_get_registered_events (itrace_profiler_handle_t profiler_handle, itrace_event_t *registered_events, int *num_registered_events)
 Return the events currently registered. More...
 
itrace_return_t itrace_set_processing_mode (itrace_profiler_handle_t profiler_handle, itrace_processing_mode_t processing_mode)
 Set processing mode to use for all events at registration time. More...
 
itrace_return_t itrace_set_stid (itrace_profiler_handle_t profiler_handle, itrace_stid_t *stid)
 Filter all PMU events by STID. More...
 
void itrace_start_section_no_events (itrace_section_id_t section_id)
 Define the start of a section without monitoring registered events. More...
 
void itrace_end_section_no_events (void)
 Define the end of a section without monitoring registered events. More...
 
itrace_return_t itrace_start_section (itrace_profiler_handle_t profiler_handle, const char *section_name, itrace_measured_events_t *measured_events)
 Define the start of a section for which all registered events will be monitored. More...
 
itrace_return_t itrace_start_section_with_section_id (itrace_profiler_handle_t profiler_handle, itrace_section_id_t section_id, itrace_measured_events_t *measured_events)
 Define the start of a section for which all registered events will be monitored. This section is identified by an unsigned identifier. More...
 
itrace_return_t itrace_end_section (itrace_profiler_handle_t profiler_handle, itrace_measured_events_t *measured_events)
 Define the end of a section for which all registered events will be monitored. More...
 
itrace_return_t itrace_read_events (itrace_profiler_handle_t profiler_handle, itrace_measured_events_t *measured_events)
 Read events. More...
 
itrace_return_t itrace_add_marker (itrace_profiler_handle_t profiler_handle, const char *marker_name)
 Add a marker. More...
 
itrace_return_t itrace_start_periodic_events_reader (itrace_profiler_handle_t profiler_handle, uint32_t events_reader_period_us, uint32_t thread_priority)
 Start a periodic event reader measuring registered events at regular intervals. More...
 
itrace_return_t itrace_end_periodic_events_reader (itrace_profiler_handle_t profiler_handle)
 End the periodic event reader. More...
 
itrace_return_t itrace_start_periodic_logs_flusher (itrace_logger_handle_t logger_handle, uint32_t flushing_period_us)
 Create a background thread to periodically flush and parse the log buffers for each active profiler. More...
 
itrace_return_t itrace_end_periodic_logs_flusher (itrace_logger_handle_t logger_handle)
 Destroy the thread that is flushing and parsing the log buffers for each active profiler. More...
 
itrace_return_t itrace_setup_from_file (itrace_logger_handle_t *logger_handle_ptr, const char *setup_filename)
 Setup itrace from a configuration file or using defaults. More...
 
itrace_return_t itrace_teardown (itrace_logger_handle_t logger_handle)
 Close itrace when utilizing CPU and/or DSP automation. More...
 
itrace_return_t itrace_flush_log (itrace_profiler_handle_t profiler_handle)
 Flush the log of the current profiler. More...
 
itrace_return_t itrace_set_default_profiler (itrace_profiler_handle_t profiler_handle)
 Set the specified profiler instance as default. More...
 
itrace_return_t itrace_get_dsp_version (itrace_profiler_handle_t profiler_handle, char *dsp_version)
 Get the DSP Version index of the profiler. More...
 
itrace_return_t itrace_get_domain (itrace_profiler_handle_t profiler_handle, uint32_t *domain_id)
 Get the domain id of the profiler. More...
 
itrace_return_t itrace_get_itrace_version (itrace_profiler_handle_t profiler_handle, uint32_t *version)
 Return the itrace library version running on the specified domain. More...
 
itrace_return_t itrace_configure_pmu_policy (itrace_profiler_handle_t profiler_handle, uint32_t min_num_pmu_events_to_register, uint32_t max_num_pmu_events_to_register, uint32_t pmu_registration_timeout_us)
 Configure PMU arbitration policy. More...
 
itrace_return_t itrace_register_thread (itrace_profiler_handle_t profiler_handle, const char *thread_name)
 Assign a name to a software thread and attempt to identify its parent thread id. More...
 

Detailed Description

Logger and profiler APIs accessible from the CPU and DSPs.

=============================================================================

Copyright (c) 2024 Qualcomm Technologies Incorporated.

All Rights Reserved. Qualcomm Proprietary and Confidential.

Macro Definition Documentation

◆ ITRACE_END_SECTION_WITH_CONTEXT_MSPS

#define ITRACE_END_SECTION_WITH_CONTEXT_MSPS (   itrace_section_id_param)    itrace_end_section_with_context(itrace_section_id_##itrace_section_id_param, &itrace_section_context_##itrace_section_id_param);

Define the end of a section to monitor.

Same as ITRACE_END_SECTION_WITH_CONTEXT but with Multi Section Per Scope support, i.e. with the ability to monitor multiple sections within the same scope.

◆ ITRACE_END_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS

#define ITRACE_END_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS (   itrace_section_id_param)    itrace_end_section_with_context_no_events(itrace_section_id_##itrace_section_id_param, &itrace_section_no_events_context_##itrace_section_id_param);

Define the end of a section to monitor without tracking registered events.

Same as ITRACE_END_SECTION_WITH_CONTEXT_NO_EVENTS but with Multi Section Per Scope support, i.e. with the ability to monitor multiple sections within the same scope.

◆ ITRACE_START_SECTION_WITH_CONTEXT

#define ITRACE_START_SECTION_WITH_CONTEXT (   itrace_section_id_param)
Value:
itrace_section_context_t itrace_section_context; \
itrace_section_id_t itrace_section_id = itrace_section_id_param; \
itrace_start_section_with_context(&itrace_section_context);
Definition: itrace_types.h:335

Define the start of a section to monitor.

◆ ITRACE_START_SECTION_WITH_CONTEXT_MSPS

#define ITRACE_START_SECTION_WITH_CONTEXT_MSPS (   itrace_section_id_param)
Value:
itrace_section_context_t itrace_section_context_##itrace_section_id_param; \
itrace_section_id_t itrace_section_id_##itrace_section_id_param = itrace_section_id_param; \
itrace_start_section_with_context(&itrace_section_context_##itrace_section_id_param);
Definition: itrace_types.h:335

Define the start of a section to monitor.

Same as ITRACE_START_SECTION_WITH_CONTEXT but with Multi Section Per Scope support, i.e. with the ability to monitor multiple sections within the same scope.

◆ ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS

#define ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS (   itrace_section_id_param)
Value:
itrace_section_no_events_context_t itrace_section_no_events_context; \
itrace_section_id_t itrace_section_id = itrace_section_id_param; \
itrace_start_section_with_context_no_events(&itrace_section_no_events_context);
Definition: itrace_types.h:329

Define the start of a section to monitor without tracking registered events.

This macro is recommended to monitor the most time-critical sections of code. Only critical statistics will be read to reduce the monitoring overhead.

Note:

  • On the CPU, only time will be monitored.
  • On the DSPs, time and the 32 LSBs of the pcycle counter will be monitored.
  • As this is a time-critical macro, we use the default profiler for the local domain.

◆ ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS

#define ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS_MSPS (   itrace_section_id_param)
Value:
itrace_section_no_events_context_t itrace_section_no_events_context_##itrace_section_id_param; \
itrace_section_id_t itrace_section_id_##itrace_section_id_param = itrace_section_id_param; \
itrace_start_section_with_context_no_events(&itrace_section_no_events_context_##itrace_section_id_param);
Definition: itrace_types.h:329

Define the start of a section to monitor without tracking registered events.

Same as ITRACE_START_SECTION_WITH_CONTEXT_NO_EVENTS but with Multi Section Per Scope support, i.e. with the ability to monitor multiple sections within the same scope.