pyroscope-io 1.2.2__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyroscope_io-1.2.2/python/pyroscope_io.egg-info → pyroscope_io-1.2.3}/PKG-INFO +1 -1
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/pyproject.toml +1 -1
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3/python/pyroscope_io.egg-info}/PKG-INFO +1 -1
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/Cargo.lock +33 -12
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/Cargo.toml +2 -2
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/ffikit.rs +6 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/forksafety.rs +58 -15
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/LICENSE +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/MANIFEST.in +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/README.md +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/BundleStaticLibrary.cmake +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/CMakeLists.txt +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/Pyroscope.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc.cpp +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_debug.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_frame.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_gc_guard.hpp +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_heap.cpp +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_heap.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_reentrant.cpp +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_reentrant.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_tb.cpp +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_memalloc_tb.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/_pymacro.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/profiling_helpers/frame_accessors.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/profiling_helpers/linetable_parser.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/cpp/profiling_helpers/version_compat.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/python/pyroscope/__init__.py +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/python/pyroscope_io/__init__.py +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/python/pyroscope_io.egg-info/SOURCES.txt +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/python/pyroscope_io.egg-info/dependency_links.txt +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/python/pyroscope_io.egg-info/top_level.txt +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/build.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/include/pyroscope_ffi.h +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/backend/backend.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/backend/mod.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/backend/ruleset.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/backend/tests.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/backend/types.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/gen/google.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/gen/mod.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/gen/push.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/gen/types.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/mod.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/encode/pprof.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/error.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/lib.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/memory.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/pyroscope.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/pyspy_backend.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/session.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/rust/src/utils.rs +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/setup.cfg +0 -0
- {pyroscope_io-1.2.2 → pyroscope_io-1.2.3}/setup.py +0 -0
|
@@ -108,6 +108,8 @@ dependencies = [
|
|
|
108
108
|
"cexpr",
|
|
109
109
|
"clang-sys",
|
|
110
110
|
"itertools 0.13.0",
|
|
111
|
+
"log",
|
|
112
|
+
"prettyplease",
|
|
111
113
|
"proc-macro2",
|
|
112
114
|
"quote",
|
|
113
115
|
"regex",
|
|
@@ -865,6 +867,12 @@ dependencies = [
|
|
|
865
867
|
"libc",
|
|
866
868
|
]
|
|
867
869
|
|
|
870
|
+
[[package]]
|
|
871
|
+
name = "mach2"
|
|
872
|
+
version = "0.6.0"
|
|
873
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
874
|
+
checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b"
|
|
875
|
+
|
|
868
876
|
[[package]]
|
|
869
877
|
name = "mach_o_sys"
|
|
870
878
|
version = "0.1.1"
|
|
@@ -1128,7 +1136,21 @@ dependencies = [
|
|
|
1128
1136
|
"bindgen 0.70.1",
|
|
1129
1137
|
"libc",
|
|
1130
1138
|
"libproc",
|
|
1131
|
-
"mach2",
|
|
1139
|
+
"mach2 0.4.3",
|
|
1140
|
+
"winapi",
|
|
1141
|
+
]
|
|
1142
|
+
|
|
1143
|
+
[[package]]
|
|
1144
|
+
name = "proc-maps"
|
|
1145
|
+
version = "0.5.0"
|
|
1146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1147
|
+
checksum = "221de5f6ef11b9be9d59b330c5b81799b3e7c51b18af84c1f235ef88998b00e1"
|
|
1148
|
+
dependencies = [
|
|
1149
|
+
"anyhow",
|
|
1150
|
+
"bindgen 0.72.1",
|
|
1151
|
+
"libc",
|
|
1152
|
+
"libproc",
|
|
1153
|
+
"mach2 0.6.0",
|
|
1132
1154
|
"winapi",
|
|
1133
1155
|
]
|
|
1134
1156
|
|
|
@@ -1158,7 +1180,7 @@ dependencies = [
|
|
|
1158
1180
|
[[package]]
|
|
1159
1181
|
name = "py-spy"
|
|
1160
1182
|
version = "0.4.2"
|
|
1161
|
-
source = "git+https://github.com/
|
|
1183
|
+
source = "git+https://github.com/grafana/pyroscope-py-spy?rev=8065105#80651059d2bc419d0d7c61c9509cccbb54d57088"
|
|
1162
1184
|
dependencies = [
|
|
1163
1185
|
"anyhow",
|
|
1164
1186
|
"chrono",
|
|
@@ -1171,7 +1193,7 @@ dependencies = [
|
|
|
1171
1193
|
"memmap2",
|
|
1172
1194
|
"num-traits",
|
|
1173
1195
|
"page_size",
|
|
1174
|
-
"proc-maps",
|
|
1196
|
+
"proc-maps 0.4.0",
|
|
1175
1197
|
"rand",
|
|
1176
1198
|
"rand_distr",
|
|
1177
1199
|
"regex",
|
|
@@ -1243,7 +1265,7 @@ dependencies = [
|
|
|
1243
1265
|
|
|
1244
1266
|
[[package]]
|
|
1245
1267
|
name = "pyroscope_python_extension"
|
|
1246
|
-
version = "1.2.
|
|
1268
|
+
version = "1.2.3"
|
|
1247
1269
|
dependencies = [
|
|
1248
1270
|
"cmake",
|
|
1249
1271
|
"hashbrown 0.17.1",
|
|
@@ -1323,14 +1345,14 @@ dependencies = [
|
|
|
1323
1345
|
|
|
1324
1346
|
[[package]]
|
|
1325
1347
|
name = "read-process-memory"
|
|
1326
|
-
version = "0.
|
|
1348
|
+
version = "0.2.0"
|
|
1327
1349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1328
|
-
checksum = "
|
|
1350
|
+
checksum = "98379bd2cb26a9ad7d0af215816348a41279285fd15e40b398af97108207a9d3"
|
|
1329
1351
|
dependencies = [
|
|
1330
1352
|
"libc",
|
|
1331
1353
|
"log",
|
|
1332
|
-
"
|
|
1333
|
-
"
|
|
1354
|
+
"mach2 0.6.0",
|
|
1355
|
+
"windows-sys",
|
|
1334
1356
|
]
|
|
1335
1357
|
|
|
1336
1358
|
[[package]]
|
|
@@ -1364,9 +1386,8 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
|
1364
1386
|
|
|
1365
1387
|
[[package]]
|
|
1366
1388
|
name = "remoteprocess"
|
|
1367
|
-
version = "0.5.
|
|
1368
|
-
source = "
|
|
1369
|
-
checksum = "1861c221cfbe6c963fd804eb56c64c0fa25d133b06537ac6cba7ca56085ae556"
|
|
1389
|
+
version = "0.5.3"
|
|
1390
|
+
source = "git+https://github.com/grafana/pyroscope-remoteprocess?rev=579e513a5584adc55b9c88e3d5212bb41c328315#579e513a5584adc55b9c88e3d5212bb41c328315"
|
|
1370
1391
|
dependencies = [
|
|
1371
1392
|
"addr2line",
|
|
1372
1393
|
"cfg-if",
|
|
@@ -1380,7 +1401,7 @@ dependencies = [
|
|
|
1380
1401
|
"memmap2",
|
|
1381
1402
|
"nix",
|
|
1382
1403
|
"object",
|
|
1383
|
-
"proc-maps",
|
|
1404
|
+
"proc-maps 0.5.0",
|
|
1384
1405
|
"read-process-memory",
|
|
1385
1406
|
"regex",
|
|
1386
1407
|
"winapi",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "pyroscope_python_extension"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.3" # x-release-please-version
|
|
4
4
|
authors = [
|
|
5
5
|
"Tolyan Korniltsev <anatoly.korniltsev@grafana.com>"
|
|
6
6
|
]
|
|
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
|
|
|
12
12
|
name = "_native"
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
|
-
py-spy = { git = "https://github.com/
|
|
15
|
+
py-spy = { git = "https://github.com/grafana/pyroscope-py-spy", rev = "8065105", default-features = false }
|
|
16
16
|
pretty_env_logger = "0.5"
|
|
17
17
|
log = "0.4"
|
|
18
18
|
libc = "0.2"
|
|
@@ -125,5 +125,11 @@ pub fn at_fork_after_in_child(_py: Python<'_>) {
|
|
|
125
125
|
// Here we intentionally leak the whole running agent.
|
|
126
126
|
// This runs post-fork in the child, the old agent must never be dropped there (its
|
|
127
127
|
// stop() joins threads that don't survive fork)
|
|
128
|
+
#[cfg(not(miri))]
|
|
128
129
|
STATE.leak_and_reset();
|
|
130
|
+
// The miri variant returns the abandoned allocation so tests can reclaim
|
|
131
|
+
// it. This hook is never exercised under Miri, and leaking is the whole
|
|
132
|
+
// point here, so discard it.
|
|
133
|
+
#[cfg(miri)]
|
|
134
|
+
let _ = STATE.leak_and_reset();
|
|
129
135
|
}
|
|
@@ -79,6 +79,10 @@ where
|
|
|
79
79
|
/// fork: after `leak_and_reset` it points at the abandoned parent-era mutex.
|
|
80
80
|
/// Always re-fetch it via `STATE.mutex()` at the point of use.
|
|
81
81
|
///
|
|
82
|
+
/// The accessors take `&'static self`, so the type is only usable from a
|
|
83
|
+
/// `static` (or another never-dropped location such as a leaked allocation);
|
|
84
|
+
/// non-static usage does not compile.
|
|
85
|
+
///
|
|
82
86
|
/// [`mutex`]: LeakableMutex::mutex
|
|
83
87
|
pub struct LeakableMutex<T> {
|
|
84
88
|
state: AtomicPtr<Mutex<T>>,
|
|
@@ -104,7 +108,11 @@ impl<T: Default> LeakableMutex<T> {
|
|
|
104
108
|
/// Call this at every point of use instead of caching the returned
|
|
105
109
|
/// reference, so that after [`leak_and_reset`](LeakableMutex::leak_and_reset)
|
|
106
110
|
/// you observe the fresh mutex rather than the abandoned one.
|
|
107
|
-
|
|
111
|
+
///
|
|
112
|
+
/// Takes `&'static self`: this type is only meant to live in a `static`
|
|
113
|
+
/// (its leak-instead-of-drop contract assumes the instance itself is
|
|
114
|
+
/// never dropped), so non-static usage is rejected at compile time.
|
|
115
|
+
pub fn mutex(&'static self) -> &'static Mutex<T> {
|
|
108
116
|
unsafe {
|
|
109
117
|
let cur = self.state.load(Ordering::SeqCst);
|
|
110
118
|
if !cur.is_null() {
|
|
@@ -139,8 +147,26 @@ impl<T: Default> LeakableMutex<T> {
|
|
|
139
147
|
/// process is effectively single-threaded. Callers racing with this from
|
|
140
148
|
/// other threads may still hold references to the old mutex, which stays
|
|
141
149
|
/// valid (it is leaked, not freed), but their updates will be lost.
|
|
142
|
-
|
|
143
|
-
|
|
150
|
+
///
|
|
151
|
+
/// Takes `&'static self` for the same reason as
|
|
152
|
+
/// [`mutex`](LeakableMutex::mutex).
|
|
153
|
+
#[cfg(not(miri))]
|
|
154
|
+
pub fn leak_and_reset(&'static self) {
|
|
155
|
+
self.leak_and_reset_impl();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// Miri-only variant of `leak_and_reset` (see the `#[cfg(not(miri))]`
|
|
159
|
+
/// item for the full contract). It additionally returns the abandoned
|
|
160
|
+
/// allocation so tests can reclaim it and keep Miri's leak checker happy,
|
|
161
|
+
/// or `None` if the mutex was never initialized.
|
|
162
|
+
#[cfg(miri)]
|
|
163
|
+
#[must_use = "reclaim the returned allocation or Miri reports a leak"]
|
|
164
|
+
pub fn leak_and_reset(&'static self) -> Option<std::ptr::NonNull<Mutex<T>>> {
|
|
165
|
+
std::ptr::NonNull::new(self.leak_and_reset_impl())
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
fn leak_and_reset_impl(&self) -> *mut Mutex<T> {
|
|
169
|
+
self.state.swap(Self::new_static(), Ordering::SeqCst)
|
|
144
170
|
}
|
|
145
171
|
|
|
146
172
|
fn new_static() -> *mut Mutex<T> {
|
|
@@ -148,6 +174,15 @@ impl<T: Default> LeakableMutex<T> {
|
|
|
148
174
|
}
|
|
149
175
|
}
|
|
150
176
|
|
|
177
|
+
// No `Drop` impl on purpose: `mutex` takes `&'static self`, so an instance
|
|
178
|
+
// that could be dropped can never have allocated its inner mutex — there is
|
|
179
|
+
// nothing to free. Dropping inherited state is the exact hazard this type
|
|
180
|
+
// exists to avoid, so leaking on drop is the correct default anyway.
|
|
181
|
+
|
|
182
|
+
// Each test declares its own `static` because the accessors take
|
|
183
|
+
// `&'static self`. The mutex still reachable through a static at process
|
|
184
|
+
// exit is not a leak for Miri (its leak checker is reachability-based);
|
|
185
|
+
// only allocations abandoned by `leak_and_reset` need reclaiming.
|
|
151
186
|
#[cfg(test)]
|
|
152
187
|
mod tests {
|
|
153
188
|
use super::LeakableMutex;
|
|
@@ -156,27 +191,26 @@ mod tests {
|
|
|
156
191
|
|
|
157
192
|
#[test]
|
|
158
193
|
fn initializes_lazily_once() {
|
|
159
|
-
|
|
194
|
+
static STATE: LeakableMutex<usize> = LeakableMutex::new();
|
|
160
195
|
|
|
161
|
-
assert_eq!(*
|
|
162
|
-
*
|
|
163
|
-
assert_eq!(*
|
|
196
|
+
assert_eq!(*STATE.mutex().lock().unwrap(), 0);
|
|
197
|
+
*STATE.mutex().lock().unwrap() = 42;
|
|
198
|
+
assert_eq!(*STATE.mutex().lock().unwrap(), 42);
|
|
164
199
|
}
|
|
165
200
|
|
|
166
201
|
#[test]
|
|
167
202
|
fn concurrent_initialization_uses_one_mutex() {
|
|
168
203
|
const THREADS: usize = 4;
|
|
204
|
+
static STATE: LeakableMutex<usize> = LeakableMutex::new();
|
|
169
205
|
|
|
170
|
-
let state = Arc::new(LeakableMutex::<usize>::new());
|
|
171
206
|
let barrier = Arc::new(Barrier::new(THREADS));
|
|
172
207
|
let mut handles = Vec::with_capacity(THREADS);
|
|
173
208
|
|
|
174
209
|
for _ in 0..THREADS {
|
|
175
|
-
let state = Arc::clone(&state);
|
|
176
210
|
let barrier = Arc::clone(&barrier);
|
|
177
211
|
handles.push(thread::spawn(move || {
|
|
178
212
|
barrier.wait();
|
|
179
|
-
*
|
|
213
|
+
*STATE.mutex().lock().unwrap() += 1;
|
|
180
214
|
}));
|
|
181
215
|
}
|
|
182
216
|
|
|
@@ -184,21 +218,30 @@ mod tests {
|
|
|
184
218
|
handle.join().unwrap();
|
|
185
219
|
}
|
|
186
220
|
|
|
187
|
-
assert_eq!(*
|
|
221
|
+
assert_eq!(*STATE.mutex().lock().unwrap(), THREADS);
|
|
188
222
|
}
|
|
189
223
|
|
|
190
224
|
#[test]
|
|
191
225
|
fn reset_preserves_old_reference_and_uses_fresh_default() {
|
|
192
|
-
|
|
193
|
-
|
|
226
|
+
static STATE: LeakableMutex<usize> = LeakableMutex::new();
|
|
227
|
+
|
|
228
|
+
let old = STATE.mutex();
|
|
194
229
|
*old.lock().unwrap() = 42;
|
|
195
230
|
|
|
196
|
-
|
|
231
|
+
#[cfg(miri)]
|
|
232
|
+
let leaked = STATE.leak_and_reset();
|
|
233
|
+
#[cfg(not(miri))]
|
|
234
|
+
STATE.leak_and_reset();
|
|
197
235
|
|
|
198
|
-
let new =
|
|
236
|
+
let new = STATE.mutex();
|
|
199
237
|
assert!(!std::ptr::eq(old, new));
|
|
200
238
|
assert_eq!(*new.lock().unwrap(), 0);
|
|
201
239
|
assert_eq!(*old.lock().unwrap(), 42);
|
|
240
|
+
|
|
241
|
+
#[cfg(miri)]
|
|
242
|
+
unsafe {
|
|
243
|
+
drop(Box::from_raw(leaked.unwrap().as_ptr())); // no leaks under miri
|
|
244
|
+
}
|
|
202
245
|
}
|
|
203
246
|
|
|
204
247
|
#[test]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|