Skip to content

Commit

Permalink
add test_kunpeng
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaumy committed Mar 19, 2024
1 parent a66d018 commit 778bd44
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions src/perf_event/counting/group/tests/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.gnu.org/licenses/>.

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() {
Expand All @@ -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);
}

0 comments on commit 778bd44

Please sign in to comment.