diff --git a/src/perf_event/counting/group/tests/hardware.rs b/src/perf_event/counting/group/tests/hardware.rs index 29ebe99..441face 100644 --- a/src/perf_event/counting/group/tests/hardware.rs +++ b/src/perf_event/counting/group/tests/hardware.rs @@ -12,9 +12,10 @@ // You should have received a copy of the GNU Lesser General Public License along with Perf-event-rs. If not, // see . -use crate::counting::group::tests::test_group; +use crate::counting::group::tests::{gen_group, test_group}; +use crate::counting::Config; use crate::test::cpu_workload; -use crate::{Event, HardwareEvent}; +use crate::{Event, EventScope, HardwareEvent, RawEvent}; #[test] fn test_ipc() { @@ -24,3 +25,49 @@ fn test_ipc() { test_group(&Event::from(ev_1), &Event::from(ev_2), &mut workload); } + +#[test] +fn test_kunpeng() { + let mut group = gen_group(); + + let configs = [ + 0x11, // r11 + 0x1b, // r1b + 0x70, // r70 + 0x71, // r71 + 0x73, // r73 + 0x75, // r75 + 0x8004, // r8004 + ]; + + let scopes = EventScope::all(); + + let guards = configs.map(|config| { + let event = unsafe { RawEvent::new(config) }; + let mut config = Config::new(&event.into(), &scopes); + group.add_member(&mut config).unwrap() + }); + + let fixed_group = group.enable().unwrap(); + cpu_workload(); + fixed_group.disable().unwrap(); + + #[rustfmt::skip] + let [ + r11, + r1b, + r70, + r71, + r73, + r75, + r8004 + ] = guards.map(|mut guard| guard.stat().unwrap().event_count); + + dbg!(r11); + dbg!(r1b); + dbg!(r70); + dbg!(r71); + dbg!(r73); + dbg!(r75); + dbg!(r8004); +}