Skip to content

Commit d6b7ecd

Browse files
committed
Removed tests needing hardware performance counters during GitHub CI. Fixed warnings on using optionls without testing.
1 parent e4e450d commit d6b7ecd

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
run: cmake --build build --target tests
3434

3535
- name: Test
36-
run: ./build/bin/tests ~[EventCounter] ~[Sampler] ~[HardwareInfo]
36+
run: ./build/bin/tests ~[EventCounter] ~[Sampler] ~[HardwareInfo] ~[MultiThreadEventCounter] ~[MultiThreadSampler]

src/counter/counter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,12 @@ perf::Counter::create_perf_event_attribute(const bool is_disabled,
271271
/// have a sample type but are not truly sampling. We assume that true sampling is only requested when
272272
/// period/frequency and precision is set since both are needed for sampling but not for reading counter without
273273
/// stopping.
274-
if (this->_config.period_or_frequency().has_value() && this->_config.precision().has_value()) {
274+
if (const auto period_or_frequency = this->_config.period_or_frequency();
275+
period_or_frequency.has_value() && this->_config.precision().has_value()) {
275276
attribute.sample_id_all = 1U;
276277

277278
/// Set period of frequency, based on the PeriodOrFrequency variant.
278-
std::visit(PeriodOrFrequencyVisitor{ attribute }, this->_config.period_or_frequency().value());
279+
std::visit(PeriodOrFrequencyVisitor{ attribute }, period_or_frequency.value());
279280

280281
/// Set sampled fields.
281282
attribute.branch_sample_type = sample_recording_values.branch_mask();

src/counter/event_provider.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,20 @@ perf::AMDIbsEventProvider::add_fetch_events(CounterDefinition& counter_definitio
229229
{
230230
const auto& ibs_info = HardwareInfo::amd_ibs();
231231
if (const auto fetch_type = ibs_info.fetch_type(); ibs_info.is_supported() && fetch_type.has_value()) {
232-
const auto rand_value = ibs_info.fetch_rand_bit().has_value() ? 1ULL << ibs_info.fetch_rand_bit().value() : 0ULL;
232+
/// Setup random bit if requested.
233+
auto rand_value = 0UL;
234+
if (const auto rand_bit = ibs_info.fetch_rand_bit(); rand_bit.has_value()) {
235+
rand_value = 1UL << rand_bit.value();
236+
}
237+
233238
/// Event that is triggered by cycles.
234239
counter_definition.add("ibs_fetch", "ibs_fetch", CounterConfig{ fetch_type.value(), rand_value });
235240

236241
if (const auto l3_miss_only_bit = ibs_info.fetch_l3_miss_only_bit(); l3_miss_only_bit.has_value()) {
237242
/// Event that is triggered by cycles and applies the L3 miss filter.
238-
counter_definition.add(
239-
"ibs_fetch",
240-
"ibs_fetch_l3missonly",
241-
CounterConfig{ ibs_info.fetch_type().value(), rand_value | (1ULL << l3_miss_only_bit.value()) });
243+
counter_definition.add("ibs_fetch",
244+
"ibs_fetch_l3missonly",
245+
CounterConfig{ fetch_type.value(), rand_value | (1ULL << l3_miss_only_bit.value()) });
242246
}
243247
}
244248
}

0 commit comments

Comments
 (0)