Add flushing of perfetto buffer (#1417)

- Add flushing of perfetto buffer
- Add `ROCPROFSYS_PERFETTO_FLUSH_PERIOD_MS` config setting.
- Update CHANGELOG.sh
- Resolves SWDEV-518817

---------

Co-authored-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
Milan Radosavljevic
2025-10-17 15:30:29 +02:00
committed by GitHub
parent d348797017
commit 00faa48ac2
4 changed files with 23 additions and 0 deletions
@@ -4,6 +4,12 @@
Full documentation for ROCm Systems Profiler is available at [https://rocm.docs.amd.com/projects/rocprofiler-systems/en/latest/](https://rocm.docs.amd.com/projects/rocprofiler-systems/en/latest/).
## ROCm Systems Profiler 1.3.0 for ROCm 7.2.0
### Added
- Added a `ROCPROFSYS_PERFETTO_FLUSH_PERIOD_MS` configuration setting to set the flush period for Perfetto traces. The default value is 10000 ms (10 seconds).
## ROCm Systems Profiler 1.2.0 for ROCm 7.1.0
### Added
@@ -645,6 +645,10 @@ configure_settings(bool _init)
"default to the value of ROCPROFSYS_COLLAPSE_PROCESSES",
false, "perfetto", "data", "advanced");
ROCPROFSYS_CONFIG_SETTING(uint32_t, "ROCPROFSYS_PERFETTO_FLUSH_PERIOD_MS",
"Set Perfetto flush period (in ms)", uint32_t{ 10000 },
"perfetto", "data");
ROCPROFSYS_CONFIG_SETTING(
std::string, "ROCPROFSYS_PERFETTO_FILL_POLICY",
"Behavior when perfetto buffer is full. 'discard' will ignore new entries, "
@@ -1997,6 +2001,13 @@ get_perfetto_buffer_size()
return static_cast<tim::tsettings<size_t>&>(*_v->second).get();
}
uint32_t
get_perfetto_flush_period()
{
static auto _v = get_config()->find("ROCPROFSYS_PERFETTO_FLUSH_PERIOD_MS");
return static_cast<tim::tsettings<uint32_t>&>(*_v->second).get();
}
bool
get_perfetto_combined_traces()
{
@@ -252,6 +252,9 @@ get_perfetto_shmem_size_hint();
size_t
get_perfetto_buffer_size();
uint32_t
get_perfetto_flush_period();
bool
get_perfetto_combined_traces();
@@ -78,6 +78,7 @@ setup()
// environment settings
auto shmem_size_hint = config::get_perfetto_shmem_size_hint();
auto buffer_size = config::get_perfetto_buffer_size();
auto flush_period = config::get_perfetto_flush_period();
auto _policy =
config::get_perfetto_fill_policy() == "discard"
@@ -94,6 +95,8 @@ setup()
track_event_cfg.add_disabled_categories(itr);
}
cfg.set_flush_period_ms(flush_period);
auto* ds_cfg = cfg.add_data_sources()->mutable_config();
ds_cfg->set_name("track_event"); // this MUST be track_event
ds_cfg->set_track_event_config_raw(track_event_cfg.SerializeAsString());