diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs
index bfd8f7c5ffe6c158dc99873913523e51f2ce4fa9..b87913f3692dc1d3002a335a5ecda17fce2c662c 100644
--- a/src/unix/notbsd/linux/musl/b32/arm.rs
+++ b/src/unix/notbsd/linux/musl/b32/arm.rs
@@ -304,3 +304,4 @@ pub const FIONREAD: ::c_ulong = 0x541B;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
 pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 364;
diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs
index 1fd9280f75698ae5aa9bb10a41ede6413335e365..afe806acec6fefd1a8a3810456c8785ff1b1af63 100644
--- a/src/unix/notbsd/linux/musl/b32/mips.rs
+++ b/src/unix/notbsd/linux/musl/b32/mips.rs
@@ -303,3 +303,4 @@ pub const FIONREAD: ::c_ulong = 0x467F;
 pub const TIOCCONS: ::c_ulong = 0x80047478;
 
 pub const SYS_gettid: ::c_long = 4222;   // Valid for O32
+pub const SYS_perf_event_open: ::c_long = 4333;  // Valid for O32
diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs
index 6a77e8191167a2c3354463f2607f6a9803641918..2785547820c93fddc134f9805b04802cf37857e7 100644
--- a/src/unix/notbsd/linux/musl/b32/x86.rs
+++ b/src/unix/notbsd/linux/musl/b32/x86.rs
@@ -305,3 +305,4 @@ pub const FIONREAD: ::c_ulong = 0x541B;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
 pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 336;
diff --git a/src/unix/notbsd/linux/musl/b64/aarch64.rs b/src/unix/notbsd/linux/musl/b64/aarch64.rs
new file mode 100644
index 0000000000000000000000000000000000000000..51db30f2f1a6786bef2ad50a18edd4678520eea3
--- /dev/null
+++ b/src/unix/notbsd/linux/musl/b64/aarch64.rs
@@ -0,0 +1 @@
+pub const SYS_perf_event_open: ::c_long = 241;
diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs
index c49ab6d2b1837f834bd23f01dc5b7f5785315da9..6946b66eaa6981f7d786d9c2ef7e2f2a28ab9c20 100644
--- a/src/unix/notbsd/linux/musl/b64/mod.rs
+++ b/src/unix/notbsd/linux/musl/b64/mod.rs
@@ -325,4 +325,17 @@ pub const TIOCMSET: ::c_ulong = 0x5418;
 pub const FIONREAD: ::c_ulong = 0x541B;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
-pub const SYS_gettid: ::c_long = 186;    // Valid for x86_64
+cfg_if! {
+    if #[cfg(target_arch = "aarch64")] {
+        mod aarch64;
+        pub use self::aarch64::*;
+    } else if #[cfg(any(target_arch = "powerpc64"))] {
+        mod powerpc64;
+        pub use self::powerpc64::*;
+    } else if #[cfg(any(target_arch = "x86_64"))] {
+        mod x86_64;
+        pub use self::x86_64::*;
+    } else {
+        // Unknown target_arch
+    }
+}
diff --git a/src/unix/notbsd/linux/musl/b64/powerpc64.rs b/src/unix/notbsd/linux/musl/b64/powerpc64.rs
new file mode 100644
index 0000000000000000000000000000000000000000..bb81863654136fbb50bf4dcd1610dc759c8103fa
--- /dev/null
+++ b/src/unix/notbsd/linux/musl/b64/powerpc64.rs
@@ -0,0 +1 @@
+pub const SYS_perf_event_open: ::c_long = 319;
diff --git a/src/unix/notbsd/linux/musl/b64/x86_64.rs b/src/unix/notbsd/linux/musl/b64/x86_64.rs
new file mode 100644
index 0000000000000000000000000000000000000000..168e24292738670382f425ad2f9eb1de01be8683
--- /dev/null
+++ b/src/unix/notbsd/linux/musl/b64/x86_64.rs
@@ -0,0 +1,3 @@
+pub const SYS_gettid: ::c_long = 186;
+
+pub const SYS_perf_event_open: ::c_long = 298;
diff --git a/src/unix/notbsd/linux/other/b32/arm.rs b/src/unix/notbsd/linux/other/b32/arm.rs
index 8537d52a6acc49302e82b4c845ef6f1ebe9bd149..7de4b8b990ea152591014b4460ccb662ca1eb837 100644
--- a/src/unix/notbsd/linux/other/b32/arm.rs
+++ b/src/unix/notbsd/linux/other/b32/arm.rs
@@ -20,3 +20,4 @@ pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
 pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 364;
diff --git a/src/unix/notbsd/linux/other/b32/powerpc.rs b/src/unix/notbsd/linux/other/b32/powerpc.rs
index 52c285c4e1a11efed3aa7ce0e9e67c5bb7531e87..2334c1f8cd66485373e174c3d1d7c6225ea715bf 100644
--- a/src/unix/notbsd/linux/other/b32/powerpc.rs
+++ b/src/unix/notbsd/linux/other/b32/powerpc.rs
@@ -20,3 +20,4 @@ pub const FIOCLEX: ::c_ulong = 0x20006601;
 pub const FIONBIO: ::c_ulong = 0x8004667e;
 
 pub const SYS_gettid: ::c_long = 207;
+pub const SYS_perf_event_open: ::c_long = 319;
diff --git a/src/unix/notbsd/linux/other/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs
index edb5aa5d17aa6436baccc3e675be73a17a4380b1..1b215a977dec4676aeac11434db066aa055cf987 100644
--- a/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/src/unix/notbsd/linux/other/b32/x86.rs
@@ -36,6 +36,7 @@ pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
 pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 336;
 
 extern {
     pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
diff --git a/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs
index d6f8b7ce9ab25c07b6730a5b5b6ce31309936827..d227c466cb4260cd7d61c89bb5955661879a1a6c 100644
--- a/src/unix/notbsd/linux/other/b64/aarch64.rs
+++ b/src/unix/notbsd/linux/other/b64/aarch64.rs
@@ -77,3 +77,4 @@ pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
 pub const SYS_gettid: ::c_long = 178;
+pub const SYS_perf_event_open: ::c_long = 241;
diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs
index e9494ddd7df651d717c64ea2dabe120db406c9ed..72db09e9115bb4a32688c4251d058d3601ecd5d1 100644
--- a/src/unix/notbsd/linux/other/b64/powerpc64.rs
+++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs
@@ -75,3 +75,4 @@ pub const FIOCLEX: ::c_ulong = 0x20006601;
 pub const FIONBIO: ::c_ulong = 0x8004667e;
 
 pub const SYS_gettid: ::c_long = 207;
+pub const SYS_perf_event_open: ::c_long = 319;
diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs
index 5b608e1f8dc17ea1daed7e20416a87237bb747e2..6903c62751fceb5db0156c2138a2fc193bb2f4fa 100644
--- a/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -96,6 +96,7 @@ pub const PTRACE_GETREGS: ::c_uint = 12;
 pub const PTRACE_SETREGS: ::c_uint = 13;
 
 pub const SYS_gettid: ::c_long = 186;
+pub const SYS_perf_event_open: ::c_long = 298;
 
 extern {
     pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;